Patrick Kirk wrote: > Hi, > > Did as you suggest and it errors. > > As this is Linux from scratch, there may be applications and libraries I > need to install. Let me know... > > I forgot to precise this script is specifically designed for rh/mdk or debian distros You'll have to modificate it in order to get it work for you. (But i've done it for you :-) I suggest you using the script i give you in attachement, I have removed any call to debian/rh/mdk specific script functions Let me know if it works for you :) Edouard Gomez PS : you must configure it again
#!/bin/sh # # Script Name : adsl # # chkconfig: 345 91 35 # authors: Edouard Gomez <[EMAIL PROTECTED]> # Bruno Bonfils <[EMAIL PROTECTED]> # revision: 1.5 # description: This SysV script try to establish a connection with an ISP # using an Alcatel SpeedTouch USB and benoit papillault's driver # usage: Depend on linux distro # # Return Values : # -1 argument unknown # 0 success # 1 kernel module loading failed # 2 kernel module unloading failed # 3 microcode file is missing # 4 modem_run executable missing # 5 modem_run failed to synchronise adsl line # 6 ppp executable missing # 7 ppp connection failed # 8 usbdevfs mounting failed # 9 usbdevfs umounting failed # 10 modprobe executable missing # 11 mount executable missing # 12 umount executable missing # 13 ifconfig executable missing # 14 peer file missing # 255 script not configured #Set this to 1 if you have configured the script CONFIGURED=0 #SYTEM DEPENDANT STUFF #Set them to 1 or 0 LOAD_USBCORE="not configured" LOAD_USBINTERFACE="not configured" LOAD_NHDLC="not configured" #Set the name of your default usb interface #usb-uhci, uhci or usb-ohci DEFAULT_USBINTERFACE="not configured" #VARIABLES MAX_LOOP=60 USBMODULE="not configured" VERBOSE=0 PEER="adsl" #Set the microcode path here MICROCODE="not configured" # Lock files SYSCONF_FILE="/var/lock/subsys/adsl" # Change PATH to be sure to include /usr/local/bin PATH=$PATH:/usr/local/bin #PROG NAMES MODPROBE=$(which modprobe) KILL=$(which killall) PPP=$(which pppd) MODEM_RUN=$(which modem_run) MOUNT=$(which mount) UMOUNT=$(which umount) IFCONFIG=$(which ifconfig) isconfigured() { if [ $CONFIGURED -eq 0 ] ; then myecho_failure exit 255 fi } myecho_success() { echo " done." } myecho_failure() { echo " failed." } load_kernel_module() { if [ ! -x $MODPROBE ] ; then myecho_failure exit 10 fi lsmod | grep -q $1 RETURNED=$? [ $RETURNED -ne 0 ] && $MODPROBE -k $1 RETURNED=$? if [ $RETURNED -ne 0 ] ; then myecho_failure exit 1 fi } unload_kernel_module() { if [ ! -x $MODPROBE ] ; then myecho_failure exit 10 fi lsmod | grep -q $1 RETURNED=$? [ $RETURNED -eq 0 ] && $MODPROBE -r $1 RETURNED=$? if [ $RETURNED -ne 0 ] ; then myecho_failure exit 2 fi } kill_process() { ps ax | grep -q $1 RETURNED=$? [ $RETURNED -eq 0 ] && ($KILL $1 >/dev/null 1>&2) } connect_adsl_line() { #Launch the modem_run driver if [ ! -f $MICROCODE ] ; then myecho_failure exit 3 fi if [ ! -x $MODEM_RUN ] ; then myecho_failure exit 4 fi $MODEM_RUN -v $VERBOSE -m -f $MICROCODE RETURNED=$? if [ $RETURNED -ne 0 ] ; then myecho_failure exit 5 fi } connect_ppp() { #Launch ppp daemon if [ ! -x $PPP ] ; then myecho_failure exit 6 fi if [ ! -f "/etc/ppp/peers/$PEER" ] ; then myecho_failure exit 14 fi if [ ! -x $IFCONFIG ] ; then myecho_failure exit 13 fi $PPP call $PEER >/dev/null 2>&1 RETURNED=1 LOOPS=0 # Loop until connection has been established with the ISP # or the transaction has failed while [ $RETURNED -ne 0 ] && [ $LOOPS -le $MAX_LOOP ] ; do $IFCONFIG | grep -q 'ppp' RETURNED=$? LOOPS=`expr $LOOPS + 1` sleep 1 done if [ $LOOPS -gt $MAX_LOOP ] && [ $RETURNED -ne 0 ] ; then myecho_failure exit 7 fi } mount_usb() { if [ ! -x $MOUNT ] ; then echo_failure exit 11 fi $MOUNT | grep -q usbdevfs RETURNED=$? if [ $RETURNED -ne 0 ] ; then $MOUNT none /proc/bus/usb -t usbdevfs RETURNED=$? if [ $RETURNED -ne 0 ] ; then myecho_failure exit 8 fi fi } umount_usb() { if [ ! -x $MOUNT ] ; then echo_failure exit 11 fi if [ ! -x $UMOUNT ] ; then echo_failure exit 12 fi $MOUNT | grep -q usbdevfs RETURNED=$? if [ $RETURNED -eq 0 ] ; then $UMOUNT /proc/bus/usb RETURNED=$? if [ $RETURNED -ne 0 ] ; then myecho_failure exit 9 fi fi } get_usb_module() { MODULE_CONF="/etc/modules.conf" [ -f /etc/conf.modules ] && MODULE_CONF="/etc/conf.modules" [ -f /etc/modules.conf ] && MODULE_CONF="/etc/modules.conf" USBMODULE=$(grep "usb-interface" ${MODULE_CONF} | awk '{ print $3 }') RETURNED=$? [ $RETURNED -ne 0 ] && USBMODULE=${DEFAULT_USBINTERFACE} } ############################################################################### # # Beginning of the script # ############################################################################### case "$1" in start) echo -n Starting ADSL connection: isconfigured # At least but not at last, Mandrake dependant USB daemon [ -x /usr/sbin/usbd ] && usbd -k 1>&2 >/dev/null # Load usb core if needed if [ $LOAD_USBCORE -ne 0 ] ; then load_kernel_module "usbcore" fi # If one of usb modules has been loaded, mount the usbdevfs if [ $LOAD_USBCORE -ne 0 ] || [ $LOAD_USBINTERFACE -ne 0 ] ; then mount_usb sleep 2 fi # Load usb-interface module described in /etc/modules.conf if [ $LOAD_USBCORE -ne 0 ] || [ $LOAD_USBINTERFACE -ne 0 ] ; then get_usb_module sleep 1 load_kernel_module "$USBMODULE" sleep 3 fi # ADSL synchro connect_adsl_line sleep 1 # Load n_hdlc line discipline if [ $LOAD_NHDLC -ne 0 ] ; then load_kernel_module "n_hdlc" fi # ISP connection connect_ppp # Report success myecho_success touch $SYSCONF_FILE ;; stop) echo -n Shutting down ADSL connection: isconfigured # Kill pppd to break ppp connection kill_process pppd sleep 2 kill_process modem_run # Unload HDLC line discipline if [ $LOAD_NHDLC -ne 0 ] ; then unload_kernel_module "n_hdlc" fi # At least but not at last, Mandrake dependant USB daemon [ -x /usr/sbin/usbd ] && (usbd -k 1>&2 >/dev/null) # Unload modules if [ $LOAD_USBCORE -ne 0 ] || [ $LOAD_USBINTERFACE -ne 0 ] ; then kill_process khubd sleep 1 get_usb_module unload_kernel_module "$USBMODULE" sleep 2 umount_usb sleep 2 if [ $LOAD_USBCORE -ne 0 ] ; then unload_kernel_module "usbcore" sleep 1 fi fi # Report success myecho_success # Remove lock file rm -f $SYSCONF_FILE ;; restart|force-reload) echo -n Restarting ADSL connection: isconfigured if [ $LOAD_USBCORE -ne 0 ] || [ $LOAD_USBINTERFACE -ne 0 ] ; then $0 stop >/dev/null RETURNED=$? if [ $RETURNED -ne 0 ] ; then myecho_failure exit $RETURNED fi $0 start >/dev/null RETURNED=$? if [ $RETURNED -ne 0 ] ; then myecho_failure exit $RETURNED fi else $0 reload >/dev/null RETURNED=$? if [ $RETURNED -ne 0 ] ; then myecho_failure exit $RETURNED fi fi myecho_success ;; reload) echo -n Reloading ADSL connection: isconfigured # Kills pppd to break ppp connection kill_process pppd sleep 2 connect_ppp myecho_success ;; status) exit 0 ;; *) echo "Usage : $0 {start|stop|restart|reload|status}" exit -1 esac exit 0