#! /bin/sh
# ************************************************************************
# *                                                                      *
# *      remove_dabusb v0.1 - dabusb destroyer script                    *
# *                           by FlashCode and Crevetor (c) 14/04/2002   *
# *                                                                      *
# *          For any support, contact one of us :                        *
# *           - FlashCode: flashcode@free.fr  http://flashcode.free.fr   *
# *           - Crevetor : ziva@caramail.com                             *
# *                                                                      *
# *          License : GPL                                              *
# *                                                                      *
# ************************************************************************

# <CONFIG>
BIN_DIR="/usr/local/bin"
ETC_DIR="/etc"
CONF_DIR="/etc/eciadsl"
PPPD_DIR="/etc/ppp"
VERSION=""
# </CONFIG>

if [ "$1" == "--version" -o "$1" == "-v" ]; then
	echo "$VERSION"
	exit 0
fi

lsmod | grep dabusb
if [ $? -ne 0 ]; then
    echo "dabusb not present - nothing to do !"
else
	module=$(modprobe -l | grep dabusb)
	if [ -n "$module" ]: then
	then
	    mv "$module" "$module.removed"
	    if [ $? -eq 0 ]; then
			echo -e "\ndabusb module file renamed to $module.removed"
			depmod -a
		else
			echo -e "\ncouldn't rename file $module"
		fi
	else
		echo -e "\ncouldn't find dabusb module file"
	fi
    modprobe -r dabusb
	sleep 1
    lsmod | grep dabusb
    if [ $? -ne 0 ]; then
        echo "dabusb successfully unloaded"
    else
        echo "couldn't unload dabusb module... try to rmmod dabusb after unplugging your modem"
    fi
fi
