#!/bin/sh ############################################################################### # # PPPSETUP -- Script to set up pppd # History: # 7/21/95 RSL Script created (v1.0) # 9/15/96 RSL Added code to get the ISP's domainname (v1.1) # 9/19/96 RSL Revamped interface to use the 'dialog' # program. (v1.2) ############################################################################### VERSION="1.2" echo > /tmp/txtTEMP$$ echo "PPPSETUP v$VERSION" >> /tmp/txtTEMP$$ echo >> /tmp/txtTEMP$$ echo "Written by Robert S. Liesenfeld " >> /tmp/txtTEMP$$ echo >> /tmp/txtTEMP$$ echo >> /tmp/txtTEMP$$ echo >> /tmp/txtTEMP$$ echo " press [enter]" >> /tmp/txtTEMP$$ clear dialog --title "PPPSETUP v$VERSION" --msgbox "`cat /tmp/txtTEMP$$`" 10 76 if [ -f /docs/pppsetup1.txt ]; then dialog --title "README" --textbox "/docs/pppsetup1.txt" 24 74 fi #if [ ! `whoami` = "root" ]; then # dialog --title "Must Be Root" --msgbox "You must be root to run #this script." 10 76 # exit 1 #fi while [ -z "$PHONENUM" ] do echo > /tmp/txtTEMP$$ echo "To begin setting up your PPP connection I need to know a few things." >> /tmp/txtTEMP$$ echo "For starters what is the phone number of your Internet service" >> /tmp/txtTEMP$$ echo "provider? For example: 6551886" >> /tmp/txtTEMP$$ echo >> /tmp/txtTEMP$$ echo "(Note: in the USA, use *70,6551886 [comma required!] to turn off call" >> /tmp/txtTEMP$$ echo " waiting.)" >> /tmp/txtTEMP$$ echo >> /tmp/txtTEMP$$ dialog --title "Phone Number" --inputbox "`cat /tmp/txtTEMP$$`" 20 76 2> /tmp/rspTEMP$$ PHONENUM="`head -1 /tmp/rspTEMP$$`" if [ -z "$PHONENUM" ]; then clear echo "PPP configuration cancelled." exit 0 fi done if [ -e "/dev/modem" ]; then echo > /tmp/txtTEMP$$ echo -n "Found your modem...(" >> /tmp/txtTEMP$$ echo -n `ls -l /dev/modem | cut -b56-80` >> /tmp/txtTEMP$$ echo ")" >> /tmp/txtTEMP$$ echo >> /tmp/txtTEMP$$ dialog --title "Modem Found" --msgbox "`cat /tmp/txtTEMP$$`" 10 76 DEVICE="/dev/modem" else while [ -z "$DEVICE" ] do echo > /tmp/txtTEMP$$ echo "Secondly, what is the name of your modem device?" >> /tmp/txtTEMP$$ echo >> /tmp/txtTEMP$$ dialog --title "Modem Device" --menu "`cat /tmp/txtTEMP$$`" 20 76 12 \ cua0 "/dev/cua0 (COM1: under DOS)" \ cua1 "/dev/cua1 (COM2: under DOS)" \ cua2 "/dev/cua2 (COM3: under DOS)" \ cua3 "/dev/cua3 (COM4: under DOS)" \ 2> /tmp/rspTEMP$$ DEVICE="`cat /tmp/rspTEMP$$`" if [ -z $DEVICE ]; then clear echo "PPP configuration cancelled." exit 0 fi DEVICE="/dev/$DEVICE" done fi echo > /tmp/txtTEMP$$ echo "What baud rate is your modem?" >> /tmp/txtTEMP$$ echo >> /tmp/txtTEMP$$ dialog --title "Baud Rate" --menu "`cat /tmp/txtTEMP$$`" 20 76 12 \ 115200 "115KBps - Nirvana! Better Known as 28.8" \ 38400 "38.4KBps - Hangin' ten on the 'net! 28.8" \ 19200 "19.2KBps - Better known as 14.4" \ 9600 "9600bps - Kinda pokey, aren'tcha?" \ 2400 "2400bps - God help you. :>" 2> /tmp/rspTEMP$$ BAUDRATE="`cat /tmp/rspTEMP$$`" if [ -z $BAUDRATE ]; then clear echo "PPP configuration cancelled." exit 0 fi echo > /tmp/txtTEMP$$ echo "What is your Internet provider's domain name?" >> /tmp/txtTEMP$$ echo >> /tmp/txtTEMP$$ echo "(This is usually something like something.edu," >> /tmp/txtTEMP$$ echo " something.net, or something.com.)" >> /tmp/txtTEMP$$ echo >> /tmp/txtTEMP$$ dialog --title "Domain Name" --inputbox "`cat /tmp/txtTEMP$$`" 20 76 2> /tmp/rspTEMP$$ DOMAINNAME="`cat /tmp/rspTEMP$$`" if [ -z $DOMAINNAME ]; then clear echo "PPP configuration cancelled." exit 0 fi echo > /tmp/txtTEMP$$ echo "What is the IP address of your Internet provider's nameserver?" >> /tmp/txtTEMP$$ echo "It's important that these IP numbers be correct." >> /tmp/txtTEMP$$ echo >> /tmp/txtTEMP$$ echo "Note: Your service provider's technical support can provide you" >> /tmp/txtTEMP$$ echo "with this information. For example: 205.94.97.4" >> /tmp/txtTEMP$$ echo >> /tmp/txtTEMP$$ dialog --title "DNS IP" --inputbox "`cat /tmp/txtTEMP$$`" 20 76 2> /tmp/rspTEMP$$ DNSIP="`cat /tmp/rspTEMP$$`" if [ -z $DNSIP ]; then clear echo "PPP configuration cancelled." exit 0 fi if [ -f /etc/resolv.conf ]; then mv /etc/resolv.conf /etc/resolv.conf.old fi echo > /etc/resolv.conf echo "domain $DOMAINNAME" >> /etc/resolv.conf echo "nameserver $DNSIP" >> /etc/resolv.conf OLDDIR=`pwd` cd $HOME echo > /tmp/txtTEMP$$ echo "Now comes the tough part. :) I need to know what your" >> /tmp/txtTEMP$$ echo "dialup system prints to your screen, and I need to" >> /tmp/txtTEMP$$ echo "know what you respond with." >> /tmp/txtTEMP$$ echo >> /tmp/txtTEMP$$ echo "For example..." >> /tmp/txtTEMP$$ echo "What text should I wait for?" >> /tmp/txtTEMP$$ echo "ogin:" >> /tmp/txtTEMP$$ echo "And what text should I send?" >> /tmp/txtTEMP$$ echo "jerry" >> /tmp/txtTEMP$$ echo "What text should I wait for?" >> /tmp/txtTEMP$$ echo "assword:" >> /tmp/txtTEMP$$ echo "And what text should I send?" >> /tmp/txtTEMP$$ echo "secret" >> /tmp/txtTEMP$$ echo "What text should I wait for?" >> /tmp/txtTEMP$$ echo >> /tmp/txtTEMP$$ echo "( End by pressing Cancel or Enter on empty box. )" >> /tmp/txtTEMP$$ echo >> /tmp/txtTEMP$$ echo "ABORT 'BUSY' ABORT 'VOICE' ABORT 'NO CARRIER' ABORT 'NO DIALTONE'" > .pppscript echo "'' ATZ OK AT&FW2 OK ATDT$PHONENUM CONNECT ''" >> .pppscript dialog --title "Chat Script" --msgbox "`cat /tmp/txtTEMP$$`" 22 72 MESSAGE=' ' YOUSAY=' ' while [ ! "$MESSAGE" = "" -a ! "$YOUSAY" = "" ] do dialog --title "Expect" --inputbox "What text should I wait for?" 10 76 2> /tmp/rspTEMP$$ MESSAGE="`cat /tmp/rspTEMP$$`" if [ -z "$MESSAGE" ]; then continue fi dialog --title "Send" --inputbox "And what text should I send?" 10 76 2> /tmp/rspTEMP$$ YOUSAY="`cat /tmp/rspTEMP$$`" if [ -z "$YOUSAY" ]; then continue fi echo "$MESSAGE $YOUSAY" >> .pppscript done rm -f ppp-go echo "#!/bin/sh" > ppp-go echo "rm -f /var/spool/uucp/LCK* /var/lock/LCK*" >> ppp-go echo "/usr/sbin/pppd connect '/usr/sbin/chat -v -f $HOME/.pppscript' lock debug crtscts defaultroute modem $BAUDRATE $DEVICE &" >> ppp-go echo "tail -c 0 -f /var/log/messages &" >> ppp-go echo "read && die -f tail && /usr/sbin/connect && echo && exit" >> ppp-go chmod 755 ppp-go cd $OLDDIR if [ -f /docs/pppsetup2.txt ]; then dialog --title "README" --textbox "/docs/pppsetup2.txt" 24 74 fi rm -f /tmp/txtTEMP$$ rm -f /tmp/rspTEMP$$ echo echo echo "*** These are your ~/ppp-go ~/.pppscript & /etc/resolv.conf files. ***" echo cat /root/ppp-go echo cat /root/.pppscript cat /etc/resolv.conf echo echo "*** Does everything look correct? If not, run pppsetup again. ***" echo exit 0