#!/bin/bash
# $Id: eagleconfig,v 1.44 2004/08/29 21:29:53 Tux Exp $
# Name: eagleconfig
# Goal: configuration utility for Eagle-USB modems
# Author: Tux
# Params:
#	h = display help
#	l = choose language (keep, auto or [LL])
#		keep => use previous language (read $LANG in eagle-usb.conf)
#		auto => use system language (given by $LANG var)
#		LL   => language you want to use (en, fr, pl...)
#	e = expert mode (additional choices)
# Params set by setvars:
#	USE_HOTPLUG=1		=> use hotplug
#	USE_IFUPDOWN=1		=> use ifup/ifdown scripts instead of ifconfig
#	SIMPLE=1		=> don't use hotplug nor ifup/ifdown

exit 123

SERVICE_MISSING_MSG="\nwarning: 'internet' service is not present, connection on boot is disabled.\n"\
"You should try to install eagle-usb package first."
CRON_MISSING_MSG="\nwarning: /etc/cron.d does not exist. testconnec is disabled."

set -- "${@//#--help/-h}"
set -- "${@//#--params=/-p}"
# params for eu_config_*
set -- "${@//#--lang=/-l}"
set -- "${@//#--expert/-e}"
evalParams() {
	while getopts "hp:l:e" opt; do
		case $opt in
			h  )	echo -e $EAGLECONFIG_USAGE_MSG ; exit 0 ;;
			p  )	LSTOPTIONS="$OPTARG" ;;
			# params for eu_config_*
			l  )	;;
			e  )	;;
			\? )	echo -e $EAGLECONFIG_USAGE_MSG ; exit 1 ;;
		esac
	done
}
TESTCONNEC_DELAY=2	# check every 2min
LSTOPTIONS=""
# keep old ISP_LOGIN (returned by setvars)
OLD_ISP_LOGIN="$ISP_LOGIN"
evalParams "$@"

SEND_DSP_NEEDED=0

if [ -z "$LSTOPTIONS" ] ; then
	exec $EU_SCRIPT_DIR/eu_config_bash "$@"
	# => exit
fi

# params are already initialized by setvars
# can be the real value or "keep"
OLD_IFS=$IFS
IFS=\|
for OPT in $LSTOPTIONS ; do
	NAME=`echo $OPT | cut -d "=" -f1`
	VALUE=`echo $OPT | cut -d "=" -f2`
	OLDVAL=`eval "echo \\\$\$NAME"`
	#echo "NAME=$NAME # OLDVAL=$OLDVAL # VALUE=$VALUE"
	case $NAME in
		"LINETYPE" | "VPI" | "VCI" | "ENC" | "ISP" | "FORCE_IF" )
			if [ "x$VALUE" != "xkeep" ] && [ "x$VALUE" != "x$OLDVAL" ]; then
				SEND_DSP_NEEDED=1
				eval "$NAME='$VALUE'"
			fi
			;;
		"EU_LANG" )
			if [ "x$VALUE" != "xkeep" ]; then
				eval "$NAME='$VALUE'"
				setStrings # necessary to take in account $LANG parameter
			fi
			;;
		* )
			if [ "x$VALUE" != "xkeep" ]; then
				eval "$NAME='$VALUE'"
			fi
			;;
	esac
done
IFS=$OLD_IFS
#echo "VPI=$VPI VCI=$VCI ENC=$ENC ISP=$ISP ISP_LOGIN=$ISP_LOGIN"
#echo "ISP_PWD=$ISP_PWD PWD_ENCRYPT=$PWD_ENCRYPT STATIC_IP=$STATIC_IP"
#echo "USE_TESTCONNEC=$USE_TESTCONNEC EU_LANG=$EU_LANG"
#echo "FORCE_IF=$FORCE_IF SEND_DSP_NEEDED=$SEND_DSP_NEEDED"

# ============== APPLY CHANGES TO SYSTEM =================
# should /etc/eagle-usb/eagle-usb.conf be created?
if [ ! -f $EU_DIR/eagle-usb.conf ] ; then
	#echo -e "\nThe file $EU_DIR/eagle-usb.conf is missing!\nYou should reinstall this driver!\n"
	cp $EU_SCRIPT_DIR/eagle-usb.conf.template $EU_DIR/eagle-usb.conf
fi
if ! grep -q "STATIC_IP=" $EU_DIR/eagle-usb.conf ; then
	echo "STATIC_IP=" >> $EU_DIR/eagle-usb.conf
fi
if ! grep -q "ISP=" $EU_DIR/eagle-usb.conf ; then
	echo "ISP=" >> $EU_DIR/eagle-usb.conf
fi
if ! grep -q "LANG=" $EU_DIR/eagle-usb.conf ; then
	echo "LANG=" >> $EU_DIR/eagle-usb.conf
fi
if ! grep -q "ASYNCHRONOUS_START=" $EU_DIR/eagle-usb.conf ; then
	echo "ASYNCHRONOUS_START=1" >> $EU_DIR/eagle-usb.conf
fi

# language, VPI, VCI, encapsulation
cat $EU_DIR/eagle-usb.conf | sed \
	-e "s|STATIC_IP *=.*|STATIC_IP=$STATIC_IP|g" \
	-e "s|ISP *=.*|ISP=$ISP|g" \
	-e "s|LANG *=.*|LANG=$EU_LANG|g" \
	-e "s|Linetype *=.*|Linetype=$LINETYPE|g" \
	-e "s|VCI *=.*|VCI=$VCI|g" \
	-e "s|VPI *=.*|VPI=$VPI|g" \
	-e "s|Encapsulation *=.*|Encapsulation=$ENC|g" > $EU_DIR/tmp
cat $EU_DIR/tmp > $EU_DIR/eagle-usb.conf

# $ENC => $PPPOX
encapsToPppox "$ENC"

if [ "$PPPOX" = "none" ] ; then
	if [ "$STATIC_IP" = "none" ] ; then
	# degroup - dhcp
		# if /etc/resolv.conf is a link (probably -> /etc/ppp/resolv.conf), it is removed
		if [ -h /etc/resolv.conf ] ; then
			rm -f /etc/resolv.conf
			if [ -f /etc/resolv.conf.old ] ; then
				cat /etc/resolv.conf.old >/etc/resolv.conf
			fi
		fi
	fi
else
	# ensure that /etc/ppp/peers exists
	mkdir -p $PPP_OPTIONS_DIR

	# == temporary solution ==
	# in fact, we should sure that $PPP_OPTIONS_ADSL contains at least
	# the same content as $EU_SCRIPT_DIR/options!
	if [ ! -f $PPP_OPTIONS_ADSL ] ; then
		cat $EU_SCRIPT_DIR/options > $PPP_OPTIONS_ADSL
	fi
	touch $PPP_OPTIONS_MIRE

	# remove unnecessary lines	
	grep -v -e "pty" -e "nodetach" -e "adictrl" -e "eaglectrl" $PPP_OPTIONS_ADSL > $EU_DIR/tmp
	cat $EU_DIR/tmp > $PPP_OPTIONS_ADSL
	
	# then add new options
	if ! grep -q "updetach" $PPP_OPTIONS_ADSL ; then
		echo "updetach" >> $PPP_OPTIONS_ADSL
	fi
	echo "pty \"$SBIN_DIR/fctStartAdsl -i\"" >> $PPP_OPTIONS_ADSL
	
	if [ "$ISP_LOGIN" != "keep" ] ; then
		# user/password not found or user wants to change there
		
		# update $PPP_OPTIONS_ADSL with the new login
		echo "user \"$ISP_LOGIN\"" > $EU_DIR/tmp
		cat $PPP_OPTIONS_ADSL | grep -v "^user " >> $EU_DIR/tmp
		cat $EU_DIR/tmp > $PPP_OPTIONS_ADSL

		# to simplify, $PPP_OPTIONS_MIRE is recreated every time
		echo "user \"adsl@adsl\"" > $PPP_OPTIONS_MIRE
		echo "pty \"$SBIN_DIR/fctStartAdsl -i\"" >> $PPP_OPTIONS_MIRE
		cat $EU_SCRIPT_DIR/options >> $PPP_OPTIONS_MIRE

		if [ $PWD_ENCRYPT == 0 ]
		then	WITH_PWD="pap" ; WITHOUT_PWD="chap"
		else	WITH_PWD="chap" ; WITHOUT_PWD="pap"
		fi

		# Write login and passwd, we must be careful
		umask 0077
		TEMP="$PPP_DIR/secret$$.temp"
		rm -f $TEMP ; touch $TEMP

		# if ${WITHOUT_PWD}-secrets exists, remove references to the adsl account
		if [ -f $PPP_DIR/${WITHOUT_PWD}-secrets ]; then
			# remove old account
			if [ -n "$OLD_ISP_LOGIN" ] ; then
				grep -v -e "$OLD_ISP_LOGIN" $PPP_DIR/${WITHOUT_PWD}-secrets > $TEMP
				cat $TEMP > $PPP_DIR/${WITHOUT_PWD}-secrets
			fi
			# remove new account
			if [ -n "$ISP_LOGIN" ] ; then
				grep -v -e "$ISP_LOGIN" -e "adsl@adsl" $PPP_DIR/${WITHOUT_PWD}-secrets > $TEMP
			else
				grep -v -e "adsl@adsl" $PPP_DIR/${WITHOUT_PWD}-secrets > $TEMP
			fi
			cat $TEMP > $PPP_DIR/${WITHOUT_PWD}-secrets
		fi

		# if ${WITH_PWD}-secrets doesn't exist, set proper heading
		if [ ! -f $PPP_DIR/${WITH_PWD}-secrets ] ; then
			cat > $PPP_DIR/${WITH_PWD}-secrets << EOF
# Secrets for authentication using ${WITH_PWD}
# client	server	secret		IP addresses
# userlogin	*	password	*
EOF
			# may not be useful
			chown root.root $PPP_DIR/${WITH_PWD}-secrets
		fi
		
		# remove old account
		if [ -n "$OLD_ISP_LOGIN" ] ; then
			grep -v -e "$OLD_ISP_LOGIN" $PPP_DIR/${WITH_PWD}-secrets > $TEMP
			cat $TEMP > $PPP_DIR/${WITH_PWD}-secrets
		fi
		
		# append/update login&password to ${WITH_PWD}-secrets
		if [ -n "ISP_LOGIN" ] ; then
			grep -v -e "$ISP_LOGIN" $PPP_DIR/${WITH_PWD}-secrets > $TEMP
			cat $TEMP > $PPP_DIR/${WITH_PWD}-secrets
			echo "\"$ISP_LOGIN\" * \"$ISP_PWD\" *" >> $PPP_DIR/${WITH_PWD}-secrets
		fi
		
		# append mire
		if ! grep -q "adsl@adsl" $PPP_DIR/${WITH_PWD}-secrets ; then
			echo "\"adsl@adsl\" * \"adsl\" *" >> $PPP_DIR/${WITH_PWD}-secrets
		fi
		
		rm -f $TEMP
		umask 0022
	fi

	# DNS
	if [ "$DISTRIB" = "Mandrake" ] ; then
		# Mandrake use the ifup script to update /etc/resolv.conf
		touch /etc/resolv.conf
	else
		# if resolv.conf exists and is not a link, it is saved
		if [ -e /etc/resolv.conf ] && [ ! -h /etc/resolv.conf ] ; then
			cat /etc/resolv.conf >> /etc/resolv.conf.old
		fi
		ln -sf $PPP_DIR/resolv.conf /etc/resolv.conf
	fi

	# to allow "pppd call adsl", adsl must contains the right app
	#sed "s|/pppo[a-z]|/$PPPOX|" $PPP_OPTIONS_ADSL > $EU_DIR/tmp
	#cat $EU_DIR/tmp > $PPP_OPTIONS_ADSL
	# same thing for mire
	#if [ -e $PPP_OPTIONS_MIRE ] ; then
	#	sed "s|/pppo[a-z]|/$PPPOX|" $PPP_OPTIONS_MIRE > $EU_DIR/tmp
	#	cat $EU_DIR/tmp > $PPP_OPTIONS_MIRE
	#fi
fi
touch /etc/resolv.conf
chmod a+r /etc/resolv.conf


# === hotplug ===
#if [ $USE_HOTPLUG == 1 ] && [ $SIMPLE == 0 ] ; then
#	ln -sf $EU_SCRIPT_DIR/eu_dsp $HOTPLUG_SCRIPT_DIR/eagle-usb
	#the following line may not be useful (redundancy with /lib/modules/.../modules.usbmap)
	#ln -sf $EU_SCRIPT_DIR/usb.usermap $HOTPLUG_SCRIPT_DIR/eagle-usb.usermap
#fi


# === init.d ===
if [ "$DISTRIB" = "Fedora" ] || [ "$DISTRIB" = "Redhat" ] || [ "$DISTRIB" = "Suse" ] ; then
	#ln -sf $EU_SCRIPT_DIR/eu_init $INIT_DIR/eagle-usb
	if [ $START_ON_BOOT == 1 ] ; then
		chkconfig --add eagle-usb >/dev/null
	else
		chkconfig --del eagle-usb >/dev/null
	fi
elif [ "$DISTRIB" = "Debian" ] ; then
	#ln -sf $EU_SCRIPT_DIR/eu_init $INIT_DIR/eagle-usb
	if [ $START_ON_BOOT == 1 ] ; then
		update-rc.d eagle-usb start 99 2 3 4 5 . stop 01 0 1 6 . &>/dev/null
	else
		update-rc.d -f eagle-usb remove &>/dev/null
	fi
elif [ "$DISTRIB" = "Slackware" ] ; then
	# backup old MODCONF
	if [ ! -e "/etc/rc.d/rc.local.old" ] ; then
		cp /etc/rc.d/rc.local /etc/rc.d/rc.local.old
	fi
	grep -v "eagle-usb" /etc/rc.d/rc.local > $EU_DIR/tmp
	if [ $START_ON_BOOT == 1 ] ; then
		echo -e ". $EU_SCRIPT_DIR/rc.eagle-usb" >> $EU_DIR/tmp
	fi
	cat $EU_DIR/tmp > /etc/rc.d/rc.local
	chmod +x /etc/rc.d/rc.local
	#ln -sf $EU_SCRIPT_DIR/rc.eagle-usb /etc/rc.d/rc.eagle-usb
	#if [ $START_ON_BOOT == 1 ] ; then
	#	chmod a+x /etc/rc.d/rc.eagle-usb
	#else
	#	chmod a-x /etc/rc.d/rc.eagle-usb
	#fi
elif [ "$DISTRIB" = "Mandrake" ] ; then
	# Mdk<=10 use the "internet" service
	# Mdk10.1 use /etc/ppp/peers/ppp0 (see ifup/ifdown section)
	if [ `flt_to_str $DISTVER` -le `flt_to_str 10.0` ] ; then
		if [ -e /etc/init.d/internet ] ; then
			if [ $START_ON_BOOT == 1 ] ; then
				chkconfig --add internet
			else
				chkconfig --del internet
			fi
		else
			echo -e $SERVICE_MISSING_MSG
		fi
# 	else
# 		# Mdk10.1 use /etc/ppp/peers/ppp0
# 		rm -f $NET_SCRIPT_DIR/ifcfg-ppp0
# 		touch $NET_SCRIPT_DIR/ifcfg-ppp0
# 		echo "DEVICE=ppp0" >> $NET_SCRIPT_DIR/ifcfg-ppp0
# 		echo "TYPE=ADSL" >> $NET_SCRIPT_DIR/ifcfg-ppp0
# 		if [ $START_ON_BOOT == 1 ] ; then
# 			echo "ONBOOT=yes" >> $NET_SCRIPT_DIR/ifcfg-ppp0
# 		else
# 			echo "ONBOOT=no" >> $NET_SCRIPT_DIR/ifcfg-ppp0
# 		fi
 	fi
fi


# === testconnec ===
if [ $USE_TESTCONNEC == 1 ] ; then
	# add testconnec in /etc/cron.d
	if [ ! -d /etc/cron.d ] ; then
		echo -e $CRON_MISSING_MSG
	else
		echo "*/${TESTCONNEC_DELAY} * * * * root /etc/eagle-usb/scripts/testconnec -d1" > /etc/cron.d/eagle-usb
		chmod 644 /etc/cron.d/eagle-usb
	fi
else
	# remove testconnec in /etc/cron.d
	rm -f /etc/cron.d/eagle-usb
fi


# === custom interface name ===
if [ "$FORCE_IF" != "auto" ] ; then
	VAR="`uname -r`"
	if [ "x${VAR:0:3}" = "x2.4" ] ; then
		MODCONF=/etc/modules.conf
	else
		MODCONF=/etc/modprobe.conf
	fi
	if [ -e $MODCONF ] ; then
		# "-" character may lead to problems
		FORCE_IF=`echo $FORCE_IF | sed s/-/_/g`
		# backup old MODCONF
		if [ ! -e "$MODCONF.old" ] ; then
			cp "$MODCONF" "$MODCONF.old"
		fi
		grep -v "eagle-usb" $MODCONF > $EU_DIR/tmp
		echo -e "options eagle-usb if_name=$FORCE_IF" >> $EU_DIR/tmp
		cat $EU_DIR/tmp > $MODCONF
	else
		echo -e "warning: $MODCONF was not found!"
	fi
fi


# === load module, dsp... ===

# the following line (and SEND_DSP var) should be removed
SEND_DSP=$SEND_DSP_NEEDED

if [ $SEND_DSP == 1 ] ; then
	if lsmod | sed s/_/-/g | grep -q "${MODULE_STR}" ; then
		# if the module is already loaded, it is unloaded to
		# take in account a possible interface name change
		rmmod ${MODULE_STR}
		sleep 2s
	fi
fi

# note: on kernel 2.6 "lsmod" display "eagle_usb" instead of "eagle-usb"
if ! lsmod | sed s/_/-/g | grep -q "${MODULE_STR}" ; then
	echo -en "\n\n${MODULE_MSG}"
	depmod -a
	modprobe $MODULE_STR 1>/dev/null 2>/dev/null
	RES=$?
	sleep 5s
	if [ $RES == 0 ] ; then
		echo $OK_MSG
		# modem was not operational => send DSP
		SEND_DSP=1
	else
		echo $ERR_MSG
		exit 1
	fi
fi

# ensure that eaglestat displays "Pre-firmware device"
if $EAGLESTAT | grep -q "$PREFIRMWARE_STR" ; then
	# this problem occurs when the modem is not plugged
	echo -en "\n$DSP_MSG"
	echo $ERR_MSG
	# the configuration can be completed as soon as virtual interface name
	if [ -z "$FORCE_IF" ] || [ "x$FORCE_IF" = "xauto" ] ; then
		exit 1
	fi
	INTERFACE=$FORCE_IF
	# the modem is not plugged, so it's not useful to send DSP!
	SEND_DSP=0
fi

# only send DSP whether it's necessary (1st time or line option changed)
if [ $SEND_DSP == 1 ] ; then
	# === DSP & options are sent to take in account new params ==
	echo -en "\n$DSP_MSG"
	# stop adsl (else eaglectrl -d can't send DSP)
	fctStopAdsl -sf
	$EAGLECTRL -d 1>/dev/null 2>/dev/null
	if [ $? == 0 ] ; then
		echo $OK_MSG

		# ==== waiting for "operational state" ===
		echo -en "\n${WAIT_OPER_MSG}"
		# wait 5s to see if modem has crashed.
		# (5s is the maximum delay between "booting" and "initializing" states)
		$EAGLECTRL -s5 1>/dev/null 2>/dev/null
		if $EAGLESTAT | grep -q "${BOOTING_STR}" ; then
			# crashed when "booting"?
			echo_log "== Modem crashed! Rebooting... =="
			sleep 1
			$EAGLECTRL -w 1>/dev/null 2>/dev/null
		else
			# not crashed => wait until end of synchro (or timeout)
			$EAGLECTRL -s 1>/dev/null 2>/dev/null
		fi
		if [ $? == 0 ] ; then
			echo -e "$OK_MSG\n"
		else
			echo $ERR_MSG
			exit 1
		fi
		INTERFACE=`${EAGLECTRL} -i 2>/dev/null`
		RES=$?
	else
		echo $ERR_MSG
		exit 1
	fi
else
	INTERFACE=`${EAGLECTRL} -i 2>/dev/null`
	RES=0
fi

# === ifup / ifdown ===
if [ $RES == 0 ] && [ $USE_IFUPDOWN == 1 ] && [ $SIMPLE == 0 ] ; then
	rm -f $NET_SCRIPT_DIR/ifcfg-$INTERFACE
	touch $NET_SCRIPT_DIR/ifcfg-$INTERFACE
	echo "DEVICE=$INTERFACE" >> $NET_SCRIPT_DIR/ifcfg-$INTERFACE
	if [ $PPPOX != "none" ] ; then
		echo "BOOTPROTO=static" >> $NET_SCRIPT_DIR/ifcfg-$INTERFACE
		echo "IPADDR=0.0.0.0" >> $NET_SCRIPT_DIR/ifcfg-$INTERFACE
		echo "NETMASK=255.255.255.255" >> $NET_SCRIPT_DIR/ifcfg-$INTERFACE
	else
		echo "BOOTPROTO=dhcp" >> $NET_SCRIPT_DIR/ifcfg-$INTERFACE
	fi
	echo "ONBOOT=no" >> $NET_SCRIPT_DIR/ifcfg-$INTERFACE
	echo "MII_NOT_SUPPORTED=yes" >> $NET_SCRIPT_DIR/ifcfg-$INTERFACE
	
	# Mandrake 10.1 specific (allow "ifup ppp0" for pppd users)
	if [ $PPPOX != "none" ] && [ "$DISTRIB" = "Mandrake" ] && [ `flt_to_str $DISTVER` -ge `flt_to_str 10.1` ] ; then
		rm -f $NET_SCRIPT_DIR/ifcfg-ppp0
		touch $NET_SCRIPT_DIR/ifcfg-ppp0
		echo "DEVICE=ppp0" >> $NET_SCRIPT_DIR/ifcfg-ppp0
		echo "TYPE=ADSL" >> $NET_SCRIPT_DIR/ifcfg-ppp0
		if [ $START_ON_BOOT == 1 ] ; then
			echo "ONBOOT=yes" >> $NET_SCRIPT_DIR/ifcfg-ppp0
		else
			echo "ONBOOT=no" >> $NET_SCRIPT_DIR/ifcfg-ppp0
		fi
	fi
fi

rm -f $EU_DIR/tmp*
rm -f $EU_SCRIPT_DIR/lock


echo -e $GENER_MSG
if [ $SEND_DSP == 1 ] ; then
	echo -e $EAGLECONFIG_END_MSG
fi
echo

#***************************************************************************
# $Log: eagleconfig,v $
# Revision 1.44  2004/08/29 21:29:53  Tux
# *** empty log message ***
#
# Revision 1.43  2004/08/29 21:16:16  Tux
# - removed bc dependancy
# - let Makefile install eu_init script
#
# Revision 1.42  2004/08/27 14:29:48  mcoolive
# - fix last modifications
#
# Revision 1.41  2004/08/26 21:39:39  Tux
# - removed generation of the link to eu_dsp
# - moved ifcfg-ppp0 generation (Mdk10.1)
#
# Revision 1.40  2004/08/26 15:56:02  mcoolive
# - if the symbolic link /etc/resolv.conf is erased
#   then one tries to restore his old contents
# - don't filter and don't add the new login if it is the empty word
#
# Revision 1.39  2004/08/15 01:32:17  mcoolive
# - cancel the "add protections around ISP_LOGIN" (badly made)
#
# Revision 1.38  2004/08/15 01:21:48  mcoolive
# - add protection around ISP_LOGIN and mend a bad grep
#
# Revision 1.37  2004/08/10 21:01:26  Tux
# - do a mix between old & new methods to parse pppd config files
#
# Revision 1.36  2004/08/09 21:25:54  Tux
# - use pty "...fctStartAdsl -i" for all distributions
#
# Revision 1.34  2004/08/07 09:26:52  mcoolive
# - i ensure myself of the  access permissions of /etc/resolv.conf
# - fix the writing of pap-secret and chap-secret, marks are posed
#   to delimit what is written for the configuration of eagle-usb
#
# Revision 1.33  2004/08/05 22:52:03  mcoolive
# - replace forgotten ${MODULE} by ${MODULE_STR}
#
# Revision 1.32  2004/08/04 21:46:14  mcoolive
# - change file access permissions of /etc/cron.d/eagle-usb (755 => 644)
#
# Revision 1.31  2004/08/04 19:51:52  Tux
# - $MODULE => $MODULE_STR
#
# Revision 1.30  2004/08/04 01:57:34  mcoolive
# - removed intermediate $OLDNAME variable
#
# Revision 1.29  2004/08/03 17:51:34  Tux
# - support for spaces in options
#
# Revision 1.28  2004/07/26 19:34:44  Tux
# - removed unused $EXPERT variable
#
# Revision 1.27  2004/07/25 20:17:27  Tux
# - new method to update pppd's options files
#
# Revision 1.26  2004/07/19 20:41:40  Tux
# - change pty call in /etc/ppp/pears/adsl
# - add "updetach" to pppd options on Mandrake
#
# Revision 1.25  2004/07/17 15:40:47  Tux
# *** empty log message ***
#
# Revision 1.24  2004/07/16 21:07:44  Tux
# - simplify parameters processing
# - support for Mdk10.1 autostart (using ifcfg-ppp0)
#
# Revision 1.23  2004/07/12 21:06:13  Tux
# - modules.usbmap should already contains device IDs => remove /etc/hotplug/usb/eagle-usb
#
# Revision 1.22  2004/07/02 19:09:39  Tux
# - slackware 10 support
# - fixed bug with custom interface name on 2.4 kernels
#
# Revision 1.21  2004/06/23 20:47:54  Tux
# - fix bug: if_name is always eagle_usb
# - reload module when interface named change
#
# Revision 1.20  2004/06/06 20:47:15  Tux
# - added custom interface name
#
# Revision 1.19  2004/05/30 01:51:46  Tux
# - fixed bug with parameters
# - vars name "FAI..." => "ISP..."
#
# Revision 1.18  2004/05/23 20:11:38  Tux
# - improved $LSTOPTIONS loop (Cyril Olivier Martin)
# - do not ask questions anymore
#
# Revision 1.17  2004/05/11 19:44:17  Tux
# - netmask for pppd users = 255.255.255.255
#
# Revision 1.16  2004/04/24 10:57:14  Tux
# - network mask changed from 255.255.255.255 to 255.255.255.0 for non-pppd users
#
# Revision 1.15  2004/04/21 20:07:52  Tux
# *** empty log message ***
#
# Revision 1.14  2004/04/21 19:57:56  Tux
# - virtual interface does not use an IP anymore
# - bug fix: wrong variable names
#
# Revision 1.13  2004/04/21 18:18:53  Tux
# - some changes with ">/dev/null"
#
# Revision 1.12  2004/04/21 17:41:51  Tux
# - prevent empty values from crashing the script
# - fix bug: $INTERFACE is not initialized when $SEND_DSP=0
#
# Revision 1.11  2004/04/18 09:46:56  Tux
# - bugfix (lot of crashes)
#
# Revision 1.10  2004/04/03 16:12:27  Tux
# - cut eagleconfig into 2 parts: eagleconfig & eu_config_bash
# - removed $USE_UPD_USB_USERMAP
# - only stopadsl & send DSP when it's necessary
#
# Revision 1.9  2004/03/23 20:16:06  Tux
# - fixed bug "This language (C) is not supported!"
# - autostart on slackware
# - expert mode allow eagleconfig to finish even if modem is not plugged
#
# Revision 1.8  2004/03/22 21:10:25  Tux
# new usb.usermap location (/etc/hotplug/usb/)
#
#***************************************************************************/