Bonjour,
J'essaye de faire marcher le driver eagle-usb sur une mini-distribution
firewall personnelle sans les outils GNU (bash, gawk, GNU cut, sed...),
j'utilise busybox a la place ( http://busybox.net/ ).
Ma plateforme materielle est une soekris net4801 ( http://www.soekris.com/)
avec comme disque une compact flash de 8Mo.
Je me suis apercu que les scripts de configuration et demarrage/arret
acceptes par bash ne le sont pas par ash (le script de busybox), ni sh
ou ksh.
- il y a plein de 'if $VAR == VALEUR'
- le mot-cle function n'est pas accepte
- ni les substitutions du genre: 'set -- "${@//#--help/-h}"'
Voici donc quatre patchs pour tenter d'ameliorer les choses:
1/ patch1
corrige deux typo (treshold->threshold et launch->launched)
remplace tous les '$? ==' et '$? !=' par '$? -eq' et '$? -ne'
2/ patch2
corrige d'autres '==' et '!=' en '-eq' et '-ne'
3/ patch.setvars
simplifications pour setvars
- fonction readConf pour lire les valeurs dans eagle-conf
- utilisation de case dans encapsToPppox et pour determiner la version du kernel
4/ patch.eaglediag
- suppression du mot-cle function
- simplfication de VERSION_DIAG
A part le patch.setvars qui modifie radicalement le script, les modifications
sont relativement legeres et ne devraient pas poser de probleme.
J'ai aussi essaye de reduire le nombre de processus lances a l'execution
en reduisant les pipe genre 'grep | sed | cut' par du awk
Pouvez-vous regarder ces patches et me donner votre avis.
Je travaille actuellement aux problemes des substitutions pour supporter
les options longues.
NB: les patches ont ete faits pour la version 1.9.9.1, je n'ai pas
utilise la version CVS.
Merci,
--
Stéphane
diff -ruN eagle-usb-1.9.9.1.orig/driver/Sm.c eagle-usb-1.9.9.1/driver/Sm.c
--- eagle-usb-1.9.9.1.orig/driver/Sm.c 2004-06-30 16:32:02.000000000 -0400
+++ eagle-usb-1.9.9.1/driver/Sm.c 2004-09-26 03:54:01.000000000 -0400
@@ -715,7 +715,7 @@
{
eu_dbg (DBG_SM,"OPSTAT step1 CRC
thresh RESET\n");
- eu_err("CRC count treshold reached.
Rebooting\n");
+ eu_err("CRC count threshold reached.
Rebooting\n");
ResetModemSM(pAdiSM);
}
}
diff -ruN eagle-usb-1.9.9.1.orig/utils/scripts/eagleconfig
eagle-usb-1.9.9.1/utils/scripts/eagleconfig
--- eagle-usb-1.9.9.1.orig/utils/scripts/eagleconfig 2004-08-29
17:29:53.000000000 -0400
+++ eagle-usb-1.9.9.1/utils/scripts/eagleconfig 2004-09-26 03:58:42.000000000
-0400
@@ -408,7 +408,7 @@
# stop adsl (else eaglectrl -d can't send DSP)
fctStopAdsl -sf
$EAGLECTRL -d 1>/dev/null 2>/dev/null
- if [ $? == 0 ] ; then
+ if [ $? -eq 0 ] ; then
echo $OK_MSG
# ==== waiting for "operational state" ===
@@ -425,7 +425,7 @@
# not crashed => wait until end of synchro (or timeout)
$EAGLECTRL -s 1>/dev/null 2>/dev/null
fi
- if [ $? == 0 ] ; then
+ if [ $? -eq 0 ] ; then
echo -e "$OK_MSG\n"
else
echo $ERR_MSG
@@ -609,4 +609,4 @@
# Revision 1.8 2004/03/22 21:10:25 Tux
# new usb.usermap location (/etc/hotplug/usb/)
#
-#***************************************************************************/
\ No newline at end of file
+#***************************************************************************/
diff -ruN eagle-usb-1.9.9.1.orig/utils/scripts/fctStartAdsl
eagle-usb-1.9.9.1/utils/scripts/fctStartAdsl
--- eagle-usb-1.9.9.1.orig/utils/scripts/fctStartAdsl 2004-08-26
17:40:48.000000000 -0400
+++ eagle-usb-1.9.9.1/utils/scripts/fctStartAdsl 2004-09-26
03:59:45.000000000 -0400
@@ -101,7 +101,7 @@
# waiting Nsec for synchro (default: N=60)
$EAGLECTRL -s$TIMEOUT &>/dev/null
-if [ $? != 0 ] ; then
+if [ $? -ne 0 ] ; then
exit 2
fi
@@ -116,7 +116,7 @@
if [ "$STATIC_IP" != "none" ] ; then
GATEWAY="`echo $STATIC_IP | cut -d '.' -f1-3`.254"
ifconfig $INTERFACE $STATIC_IP netmask 255.255.255.0
- if [ $? != 0 ] ; then exit 4 ; fi
+ if [ $? -ne 0 ] ; then exit 4 ; fi
route add default gw $GATEWAY
else
if [ $USE_IFUPDOWN == 1 ] && [ $SIMPLE == 0 ] ; then
@@ -124,7 +124,7 @@
else
dhclient $INTERFACE &>/dev/null
fi
- if [ $? != 0 ] ; then exit 4 ; fi
+ if [ $? -ne 0 ] ; then exit 4 ; fi
fi
else
# ===== pppd => ifup & pppd =====
@@ -152,7 +152,7 @@
else
pppd debug file $OPTIONS &>/dev/null
fi
- if [ $? != 0 ] ; then exit 4 ; fi
+ if [ $? -ne 0 ] ; then exit 4 ; fi
else
if [ $PPPD_DEBUG == 0 ] ; then
pppd file $OPTIONS &>/dev/null &
diff -ruN eagle-usb-1.9.9.1.orig/utils/scripts/fctStopAdsl
eagle-usb-1.9.9.1/utils/scripts/fctStopAdsl
--- eagle-usb-1.9.9.1.orig/utils/scripts/fctStopAdsl 2004-08-14
14:00:53.000000000 -0400
+++ eagle-usb-1.9.9.1/utils/scripts/fctStopAdsl 2004-09-26 03:58:45.000000000
-0400
@@ -55,7 +55,7 @@
# if the modem is still plugged, modem interface is putted down
# if the modem is unplugged, hotplug should already have done that => do
nothing
INTERFACE=`eaglectrl -i 2>/dev/null`
-if [ $? == 0 ] ; then
+if [ $? -eq 0 ] ; then
if [ $USE_IFUPDOWN == 1 ] && [ $SIMPLE == 0 ] ; then
ifdown $INTERFACE
else
diff -ruN eagle-usb-1.9.9.1.orig/utils/scripts/setvars
eagle-usb-1.9.9.1/utils/scripts/setvars
--- eagle-usb-1.9.9.1.orig/utils/scripts/setvars 2004-08-29
17:20:19.000000000 -0400
+++ eagle-usb-1.9.9.1/utils/scripts/setvars 2004-09-26 03:59:53.000000000
-0400
@@ -54,8 +54,8 @@
encapsToPppox() {
if [ "$1" = "00000001" ] || [ "$1" = "00000002" ] ; then
pppoe -h 1>/dev/null 2>/dev/null
- if [ $? != 0 ] ; then
- echo -e "\nError: pppoe cannot be launch. Exiting...\n"
+ if [ $? -ne 0 ] ; then
+ echo -e "\nError: pppoe cannot be launched.
Exiting...\n"
exit 1
fi
PPPOX="pppoe"
@@ -228,7 +228,7 @@
ping_test() {
touch /tmp/setvars_ping
ping -n -q -c 1 -i 1 $1 1>/dev/null 2>/dev/null
- if [ $? == 0 ] ; then
+ if [ $? -eq 0 ] ; then
rm -f /tmp/setvars_ping
fi
}
diff -ruN eagle-usb-1.9.9.1.orig/utils/scripts/testconnec
eagle-usb-1.9.9.1/utils/scripts/testconnec
--- eagle-usb-1.9.9.1.orig/utils/scripts/testconnec 2004-08-26
17:43:11.000000000 -0400
+++ eagle-usb-1.9.9.1/utils/scripts/testconnec 2004-09-26 03:59:57.000000000
-0400
@@ -49,7 +49,7 @@
echo_log "Modem crashed! rebooting..."
fctStopAdsl
$EAGLECTRL -w 1>/dev/null 2>/dev/null
- if [ $? != 0 ] ; then
+ if [ $? -ne 0 ] ; then
exit 1
fi
fi
@@ -71,7 +71,7 @@
for i in $TESTIP; do
if [ "$OK" = "no" ]; then
ping_w $i 5
- if [ $? == 0 ]; then
+ if [ $? -eq 0 ]; then
OK="$i"
fi
CPT=$(($CPT+1))
diff -ruN eagle-usb-1.9.9.1.orig/utils/scripts/eu_dsp
eagle-usb-1.9.9.1/utils/scripts/eu_dsp
--- eagle-usb-1.9.9.1.orig/utils/scripts/eu_dsp 2004-08-29 17:36:54.000000000
-0400
+++ eagle-usb-1.9.9.1/utils/scripts/eu_dsp 2004-09-26 04:44:53.000000000
-0400
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
# $Id: eu_dsp,v 1.10 2004/08/29 21:36:54 Tux Exp $
# Name: eu_dsp
# Goal: This script handles the ADI ADSL Modem USB driver after firmware
@@ -26,7 +26,7 @@
# this script is called multiple times by hotplug, so we try to
# send DSP only one time
SEND_DSP=0
-if [ -z $DEVPATH ] ; then
+if [ -z "$DEVPATH" ] ; then
# kernel 2.4
SEND_DSP=1
else
@@ -37,13 +37,13 @@
fi
fi
-if [ $SEND_DSP == 1 ] ; then
+if [ $SEND_DSP -eq 1 ] ; then
if ! eaglestat | grep -q "$SEND_DSP_STR" ; then
SEND_DSP=0
fi
fi
-if [ $SEND_DSP == 1 ] ; then
+if [ $SEND_DSP -eq 1 ] ; then
# small delay to prevent a bug
sleep 1s
@@ -52,7 +52,7 @@
if [ -z "$REMOVER" ] ; then
REMOVER="/var/run/usb/`echo $DEVICE | sed 's/\//%/g'`"
fi
- echo "#!/bin/bash" > $REMOVER
+ echo "#!/bin/sh" > $REMOVER
echo "${SBIN_DIR}/fctStopAdsl" >> $REMOVER
echo "rmmod $MODULE_STR" >> $REMOVER
chmod u+x $REMOVER
diff -ruN eagle-usb-1.9.9.1.orig/utils/scripts/eu_init
eagle-usb-1.9.9.1/utils/scripts/eu_init
--- eagle-usb-1.9.9.1.orig/utils/scripts/eu_init 2004-07-16
17:52:51.000000000 -0400
+++ eagle-usb-1.9.9.1/utils/scripts/eu_init 2004-09-26 04:48:12.000000000
-0400
@@ -52,7 +52,7 @@
start)
$CMDECHO $START_SERVICE_MSG
touch $SYSCONF_FILE
- if [ $ASYNCHRONOUS_START == 0 ] ; then
+ if [ $ASYNCHRONOUS_START -eq 0 ] ; then
if fctStartAdsl ; then
echo_success
else
diff -ruN eagle-usb-1.9.9.1.orig/utils/scripts/fctStartAdsl
eagle-usb-1.9.9.1/utils/scripts/fctStartAdsl
--- eagle-usb-1.9.9.1.orig/utils/scripts/fctStartAdsl 2004-09-26
13:56:08.000000000 -0400
+++ eagle-usb-1.9.9.1/utils/scripts/fctStartAdsl 2004-09-26
14:17:01.000000000 -0400
@@ -49,7 +49,7 @@
ping_test_mt() {
touch /tmp/setvars_ping_mt
PING_MT_RES=1
- while [ $PING_MT_RES != 0 ]
+ while [ $PING_MT_RES -ne 0 ]
do
sleep 2
ping_w $1 $2
@@ -70,6 +70,7 @@
}
#STATIC_IP="none"
MIRE=0
+SIMPLE=0
TIMEOUT=60
DONT_START=0
PPPD_DEBUG=0
@@ -78,21 +79,19 @@
# lock still present? (user forgot to run eagleconfig)
-if [ -f $EU_SCRIPT_DIR/lock ] ; then
- exit 5
-fi
+[ -f $EU_SCRIPT_DIR/lock ] || exit 5
if [ "$PPPOX" != "none" ] ; then
# startadsl or startmire?
- if [ $MIRE == 1 ] ; then
+ if [ $MIRE -eq 1 ] ; then
OPTIONS=$PPP_OPTIONS_MIRE
else
OPTIONS=$PPP_OPTIONS_ADSL
fi
# pppd already lanched?
- if [ $DONT_START == 0 ] && [ ! -z "`pidof pppd`" ] ; then
+ if [ $DONT_START -eq 0 ] && [ ! -z "`pidof pppd`" ] ; then
exit 1
fi
@@ -101,9 +100,7 @@
# waiting Nsec for synchro (default: N=60)
$EAGLECTRL -s$TIMEOUT &>/dev/null
-if [ $? -ne 0 ] ; then
- exit 2
-fi
+[ $? -eq 0 ] || exit 2
if [ ! -z "`route | grep default`" ] ; then
route del default
@@ -116,24 +113,24 @@
if [ "$STATIC_IP" != "none" ] ; then
GATEWAY="`echo $STATIC_IP | cut -d '.' -f1-3`.254"
ifconfig $INTERFACE $STATIC_IP netmask 255.255.255.0
- if [ $? -ne 0 ] ; then exit 4 ; fi
+ [ $? -eq 0 ] || exit 4
route add default gw $GATEWAY
else
- if [ $USE_IFUPDOWN == 1 ] && [ $SIMPLE == 0 ] ; then
+ if [ "$USE_IFUPDOWN" = "1" -a $SIMPLE -eq 0 ] ; then
ifup $INTERFACE &>/dev/null
else
dhclient $INTERFACE &>/dev/null
fi
- if [ $? -ne 0 ] ; then exit 4 ; fi
+ [ $? -eq 0 ] || exit 4
fi
else
# ===== pppd => ifup & pppd =====
- if [ $DONT_START == 1 ] ; then
+ if [ $DONT_START -eq 1 ] ; then
RES="`ifconfig | grep $INTERFACE`"
if [ -z "$RES" ] ; then
# - pppd call adsl => interface is not up yet
# - startadsl => interface is already up, skip this step
- if [ $USE_IFUPDOWN == 1 ] && [ $SIMPLE == 0 ] ; then
+ if [ "$USE_IFUPDOWN" = "1" -a $SIMPLE -eq 0 ] ; then
ifup $INTERFACE &>/dev/null
else
ifconfig $INTERFACE 0.0.0.0 up
@@ -141,20 +138,20 @@
fi
exec $PPPOX -I $INTERFACE 2>/dev/null
fi
- if [ $USE_IFUPDOWN == 1 ] && [ $SIMPLE == 0 ] ; then
+ if [ "$USE_IFUPDOWN" = "1" -a $SIMPLE -eq 0 ] ; then
ifup $INTERFACE &>/dev/null
else
ifconfig $INTERFACE 0.0.0.0 up
fi
if [ "$DISTRIB" != "Suse" ] ; then
- if [ $PPPD_DEBUG == 0 ] ; then
+ if [ $PPPD_DEBUG -eq 0 ] ; then
pppd file $OPTIONS &>/dev/null
else
pppd debug file $OPTIONS &>/dev/null
fi
- if [ $? -ne 0 ] ; then exit 4 ; fi
+ [ $? -eq 0 ] || exit 4
else
- if [ $PPPD_DEBUG == 0 ] ; then
+ if [ $PPPD_DEBUG -eq= 0 ] ; then
pppd file $OPTIONS &>/dev/null &
else
pppd debug file $OPTIONS &>/dev/null &
@@ -162,12 +159,11 @@
fi
fi
-if [ $KEEP != 0 ] ; then
+if [ $KEEP -ne 0 ] ; then
ping_w_maxtimeout 213.228.0.42 $KEEP
exit $?
-else
- exit 0
fi
+exit 0
#***************************************************************************
# $Log: fctStartAdsl,v $
diff -ruN eagle-usb-1.9.9.1.orig/utils/scripts/fctStopAdsl
eagle-usb-1.9.9.1/utils/scripts/fctStopAdsl
--- eagle-usb-1.9.9.1.orig/utils/scripts/fctStopAdsl 2004-09-26
13:56:08.000000000 -0400
+++ eagle-usb-1.9.9.1/utils/scripts/fctStopAdsl 2004-09-26 14:14:37.000000000
-0400
@@ -39,7 +39,7 @@
evalParams "$@"
-if [ $KILLPPP == 1 ] ; then
+if [ $KILLPPP -eq 1 ] ; then
# kill pppd (let Nsec after killall to stop properly)
if [ ! -z "`pidof pppd`" ] ; then
killall -q pppd
@@ -56,7 +56,7 @@
# if the modem is unplugged, hotplug should already have done that => do
nothing
INTERFACE=`eaglectrl -i 2>/dev/null`
if [ $? -eq 0 ] ; then
- if [ $USE_IFUPDOWN == 1 ] && [ $SIMPLE == 0 ] ; then
+ if [ "$USE_IFUPDOWN" = "1" -a "$SIMPLE" = "0" ] ; then
ifdown $INTERFACE
else
ifconfig $INTERFACE down
--- eagle-usb-1.9.9.1.orig/utils/scripts/setvars 2004-09-26
13:56:08.000000000 -0400
+++ eagle-usb-1.9.9.1/utils/scripts/setvars 2004-09-26 19:10:43.000000000
-0400
@@ -50,123 +50,84 @@
BOOTING_STR="Modem is booting"
PREFIRMWARE_STR="Pre-firmware device"
+# readConf name default_value
+readConf(){
+ awk -F= -v name=$1 -v value=$2 '{gsub(/
/,"")}$1==name{value=$2;exit}END{print value}' $EU_DIR/eagle-usb.conf
2>/dev/null || echo $2
+}
+
# === Encapsulation => pppoa/pppoe/none ===
encapsToPppox() {
- if [ "$1" = "00000001" ] || [ "$1" = "00000002" ] ; then
+ case "$1" in
+ 00000000|00000005|00000006)
+ PPPOX="pppoa";;
+ 00000001|00000002)
pppoe -h 1>/dev/null 2>/dev/null
if [ $? -ne 0 ] ; then
echo -e "\nError: pppoe cannot be launched.
Exiting...\n"
exit 1
fi
PPPOX="pppoe"
- elif [ "$1" = "00000003" ] || [ "$1" = "00000004" ] ; then
- PPPOX="none"
- elif [ "$1" = "00000005" ] || [ "$1" = "00000006" ] ; then
- PPPOX="pppoa"
- fi
+ 00000003|00000004)
+ PPPOX="none";;
+ *)
+ echo -e "\nError: unsupported encapsulation value $1.\n"
+ exit 1
+ esac
}
# === Language, load default from eagle-usb.conf ===
setStrings() {
# auto => use system settings
- if [ "x$EU_LANG" = "xauto" ] ; then
+ if [ "$EU_LANG" = "auto" ] ; then
EU_LANG=`echo $LANG | cut -c 1-2`
# instead of "fr", should we use simplified language file?
(without french chars)
- if [ "x$EU_LANG" = "xfr" ] && [ "x$DISTRIB" = "xSuse" ] ; then
- EU_LANG=f2
- fi
- elif [ "x$EU_LANG" = "xkeep" ] ; then
- readLangFromConfigFile
+ [ "$EU_LANG" = "fr" -a "$DISTRIB" = "Suse" ] && EU_LANG=f2
+ elif [ "$EU_LANG" = "keep" ] ; then
+ EU_LANG="`readConf LANG @[EMAIL PROTECTED]"
fi
# now read the real language-file
- if [ -z "$EU_LANG" ] || [ ! -f $EU_LANG_DIR/$EU_LANG ] ; then
- EU_LANG=en
- fi
+ [ -z "$EU_LANG" -o ! -f $EU_LANG_DIR/$EU_LANG ] && EU_LANG=en
. $EU_LANG_DIR/$EU_LANG
}
-readLangFromConfigFile() {
- if [ -e $EU_DIR/eagle-usb.conf ] && grep -q "^LANG="
$EU_DIR/eagle-usb.conf ; then
- EU_LANG="`grep '^LANG=' $EU_DIR/eagle-usb.conf | cut -d '='
-f2`"
- else
- # if --with-lang was not specified in ./configure,
EU_LANG="auto"
- EU_LANG="@EU_LANG@"
- fi
-}
# fr is usually the most up-to-date language
# => it is better to display some french sentences than nothing!
-. $EU_LANG_DIR/f2
-readLangFromConfigFile
+EU_LANG="`readConf LANG @[EMAIL PROTECTED]"
setStrings
# === Load config from eagle-usb.conf ===
-# Linetype
-LINETYPE="00000000"
-if [ -e $EU_DIR/eagle-usb.conf ] && grep -q "^Linetype="
$EU_DIR/eagle-usb.conf ; then
- LINETYPE="`grep '^Linetype=' $EU_DIR/eagle-usb.conf | cut -d '=' -f2`"
-fi
-
-# VPI
-VPI="00000000"
-if [ -e $EU_DIR/eagle-usb.conf ] && grep -q "^VPI=" $EU_DIR/eagle-usb.conf ;
then
- VPI="`grep '^VPI=' $EU_DIR/eagle-usb.conf | cut -d '=' -f2`"
-fi
-
-# VCI
-VCI="00000000"
-if [ -e $EU_DIR/eagle-usb.conf ] && grep -q "^VCI=" $EU_DIR/eagle-usb.conf ;
then
- VCI="`grep '^VCI=' $EU_DIR/eagle-usb.conf | cut -d '=' -f2`"
-fi
+# Linetype, VPI, VCI
+LINETYPE=`readConf Linetype 00000000`
+VPI=`readConf VPI 00000000`
+VCI=`readConf VCI 00000000`
# ENC + PPPOX (pppoe/pppoa/none)
-ENC="00000000"
-PPPOX="pppoa"
-if [ -e $EU_DIR/eagle-usb.conf ] && grep -q "^Encapsulation="
$EU_DIR/eagle-usb.conf ; then
- ENC="`grep '^Encapsulation=' $EU_DIR/eagle-usb.conf | cut -d '=' -f2`"
- encapsToPppox $ENC
-fi
+ENC=`readConf Encapsulation 00000000`
+encapsToPppox $ENC
# ISP
-ISP=""
-if [ -e $EU_DIR/eagle-usb.conf ] && grep -q "^ISP=" $EU_DIR/eagle-usb.conf ;
then
- ISP="`grep '^ISP=' $EU_DIR/eagle-usb.conf | cut -d '=' -f2`"
-fi
+ISP=`readConf ISP ""`
# ISP_Login
-ISP_LOGIN=""
-if [ -e $PPP_OPTIONS_ADSL ] && grep -q "^user" $PPP_OPTIONS_ADSL ; then
- ISP_LOGIN=`grep '^user' $PPP_OPTIONS_ADSL | sed -r 's/( |")+/\t/g' |
cut -f2`
-fi
+ISP_LOGIN=`awk '$1=="user"{gsub(/"/,"",$2);print $2;exit}' $PPP_OPTIONS_ADSL
2>/dev/null`
# ISP_Password
ISP_PWD=""
+PWD_ENCRYPT=0
if [ ! -z "$ISP_LOGIN" ] ; then
- if [ -e $PPP_DIR/chap-secrets ] ; then
- ISP_PWD=`grep -e $ISP_LOGIN $PPP_DIR/chap-secrets | sed -r -e
"s/^('|\")//" -e "s/( |'|\")+/\t/g" | cut -f3`
- fi
- if [ -z "$ISP_PWD" ] && [ -e $PPP_DIR/pap-secrets ] ; then
- ISP_PWD=`grep -e $ISP_LOGIN $PPP_DIR/pap-secrets | sed -r -e
"s/^('|\")//" -e "s/( |'|\")+/\t/g" | cut -f3`
- fi
+ for f in $PPP_DIR/chap-secrets $PPP_DIR/pap-secrets ;do
+ ISP_PWD=`awk -v user=$ISP_LOGIN
'$1==user{gsub(/"/,"",$3);gsub(/'/,"",$3);print $3;exit}' $f 2>/dev/null`
+ [ ! -z "$ISP_PWD" ] && break
+ done
+ # Password encryption? (CHAP)
+ [ $f = "$PPP_DIR/chap-secrets" ] && PWD_ENCRYPT=1
fi
-# Password encryption (CHAP)
-PWD_ENCRYPT=0
-if [ -e $PPP_DIR/chap-secrets ] && [ ! -z $ISP_LOGIN ] ; then
- if grep -q -e "$ISP_LOGIN" $PPP_DIR/chap-secrets ; then
- PWD_ENCRYPT=1
- fi
-fi
# Static IP
-STATIC_IP="none"
-if [ -e $EU_DIR/eagle-usb.conf ] && grep -q "^STATIC_IP="
$EU_DIR/eagle-usb.conf ; then
- STATIC_IP="`grep '^STATIC_IP=' $EU_DIR/eagle-usb.conf | cut -d '=' -f2`"
-fi
+STATIC_IP=`readConf STATIC_IP "none"`
# Asynchronous start
-ASYNCHRONOUS_START=1
-if [ -e $EU_DIR/eagle-usb.conf ] && grep -q "^ASYNCHRONOUS_START="
$EU_DIR/eagle-usb.conf ; then
- ASYNCHRONOUS_START="`grep '^ASYNCHRONOUS_START=' $EU_DIR/eagle-usb.conf
| cut -d '=' -f2`"
-fi
+ASYNCHRONOUS_START=`readConf ASYNCHRONOUS_START 1`
# Start on boot?
START_ON_BOOT=0
@@ -188,12 +149,10 @@
# Virtual interface name?
FORCE_IF="auto"
-VAR="`uname -r | cut -c 1-3`"
-if [ "x$VAR" = "x2.4" ] ; then
- MODCONF=/etc/modules.conf
-else
- MODCONF=/etc/modprobe.conf
-fi
+case "`uname -r`" in
+2.4*) MODCONF=/etc/modules.conf ;;
+2.6*) MODCONF=/etc/modprobe.conf ;;
+esac
if [ -e $MODCONF ] && grep -q "eagle-usb" $MODCONF ; then
FORCE_IF="`grep 'eagle-usb' $MODCONF | cut -d '=' -f2`"
FORCE_IF=`echo $FORCE_IF | sed 's/"//g'`
@@ -212,7 +171,7 @@
# === Generic confirm function ===
confirm() {
echo -en $1
- if [ $2 == 1 ] ; then
+ if [ "$2" = "1" ] ; then
echo -en " $YES_DEFAULT_MSG"
else
echo -en " $NO_DEFAULT_MSG"
@@ -227,10 +186,7 @@
# === Generic ping -w function ===
ping_test() {
touch /tmp/setvars_ping
- ping -n -q -c 1 -i 1 $1 1>/dev/null 2>/dev/null
- if [ $? -eq 0 ] ; then
- rm -f /tmp/setvars_ping
- fi
+ ping -n -q -c 1 -i 1 $1 1>/dev/null 2>/dev/null && rm -f
/tmp/setvars_ping
}
kill_ping() {
pid_ping=$1
@@ -263,9 +219,9 @@
# === Debug mode ===
echo_log() {
- if [ "x$DEBUG" = "x2" ] || [ "x$2" = "x2" ] ; then
+ if [ "x$DEBUG" = "x2" -o "x$2" = "x2" ] ; then
echo $1
- elif [ "x$DEBUG" = "x1" ] || [ "x$2" = "x1" ] ; then
+ elif [ "x$DEBUG" = "x1" -o "x$2" = "x1" ] ; then
logger $1
fi
}
--- eagle-usb-1.9.9.1.orig/utils/scripts/eaglediag 2004-08-29
17:41:54.000000000 -0400
+++ eagle-usb-1.9.9.1/utils/scripts/eaglediag 2004-09-26 18:53:12.000000000
-0400
@@ -10,7 +10,7 @@
# Must be run as root
# Availability : see http://baud123.free.fr/eagle/eaglediag
# Documentation : see http://faq.eagle-usb.org
-VERSION_DIAG=`head -2 $0|grep Id | cut -d " " --fields=4-5`
+VERSION_DIAG=`awk '/Id/{print $4}NR>2{exit}' $0`
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation either version 2 of the License, or
@@ -82,7 +82,7 @@
### Definition of global functions ###
###_________________________________________________________________________###
-function evalParams() {
+evalParams() {
while getopts "hmscuidlavno:" opt; do # t:
# with an argument add ":" after letter and take the
argument with :
#t ) TIMEOUT=$OPTARG ;;
@@ -104,19 +104,19 @@
done
}
-function echoLog () {
+echoLog () {
# display to screen & into log file
# add a -n to display without "\n" at the end (result following...)
echo "$@" | tee -a ${LOG_FILE}
}
-function echoNewbie () {
+echoNewbie () {
if [ ${HELP_NEWBIE} -eq 1 ]; then
echo "$@" | tee -a ${NEWBIE_FILE}
fi
}
-function encapsToPppox() {
+encapsToPppox() {
case "$1" in
"1" | "2" ) echo pppoe ;;
"3" | "4" ) echo none ;;