#!/bin/sh # # Ian Vince McLoughlin (IVM), 22/12/2001 echo ADSL: TO DO - log errors in the system logfile.... echo ADSL: bringing up the service... if (/sbin/lsmod | grep itex); then echo ADSL: itex module already loaded; else if (/sbin/insmod -q /root/ADSL/itex1577-2.4.2.o); then echo ADSL: itex module loaded; else echo ADSL FATAL ERROR: could not load module; exit; fi fi ADSL_LPCNT=0; ADSL_OK=0; sleep 2; while [$ADSL_OK -eq 0 ] ; do #look for a bracket after the lsmod listing (says something #like (initializing) - once it's ready this is gone # if (/sbin/lsmod | grep itex | grep \(); then #Now look in the /var/log/messages file if (tail -20 /var/log/messages | grep SHOWTIME_L0); then ADSL_OK=1; else echo ADSL WARNING: modem not yet online, wait for 4 seconds then retry; sleep 4; fi; ADSL_LPCNT=$[$ADSL_LPCNT+1]; if [ $ADSL_LPCNT -ge 10 ]; then echo ADSL FATAL ERROR: timeout waiting for modem to sync; exit; fi; done; echo ADSL: starting PPPD /usr/sbin/pppd sleep 5; if (netstat -i | grep ppp); then echo ADSL: PPPD up and running, connection established OK; else echo ADSL FATAL ERROR: PPPD not working properly....; exit; fi #Now pppd is working properly, just go and get the DNS names from #the logfile and insert into /etc/resolv.conf # # This sample code shows you one way to modify your setup to allow automatic # configuration of your resolv.conf for peer supplied DNS addresses when using # the `usepeerdns' option. # # In my case I just added this to my /etc/ppp/ip-up.local script. You may need to # create an executable script if one does not exist. # # Nick Walker (nickwalker@email.com) # #IVM: assume usepeerdns means /etc/ppp/resolv.conf automatically done if [ -a -f /etc/ppp/resolv.conf ]; then rm -f /etc/ppp/resolv.prev if [ -f /etc/resolv.conf ]; then cp /etc/resolv.conf /etc/ppp/resolv.prev grep domain /etc/ppp/resolv.prev > /etc/resolv.conf grep search /etc/ppp/resolv.prev >> /etc/resolv.conf cat /etc/ppp/resolv.conf >> /etc/resolv.conf else cp /etc/ppp/resolv.conf /etc fi else echo ADSL WARNING: Godzone gateway did not supply DNS names... echo ADSL WARNING: running with old DNS IPs... fi echo ADSL: up and running, ready to surf...