Metropoli BBS
VIEWER: dipset MODE: TEXT (ASCII)
#!/bin/sh
# This script creates a dip script for connecting to a internet service 
# provider...

clear
echo
echo "This script will ask questions relating to your system and ISP."
echo 
echo "You will also need to have the pppd and dip packages already"
echo "installed on your system"
echo
echo
echo "Continue (Y/n)"
read CONT
if [ "$CONT" = "n" ]
  then exit
elif [ "$CONT" = "N" ]
  then exit
fi
echo
GATEIP=""
while [ "$GATEIP" = "" ]
  do
  echo "What is your internet service providers IP address?"
  echo "For example: 255.116.98.75   <-It will be a series of"
  echo "numbers like this, it's important that this be correct,"
  echo "if you don't know, ask your service provider..."
  echo "The IP address will be put in the /etc/resolv.conf file."
  read GATEIP
  done
echo
MODEM_PATH=""
while [ "$MODEM_PATH" = "" ]
  do
  echo "What is the full path to your modem?"
  echo "For example: /dev/modem /dev/cua0 /dev/cua1 etc..."
  read MODEM_PATH
  if [ ! -a "$MODEM_PATH" ]
    then MODEM_PATH=""
    echo "$MODEM_PATH file not found..."
  fi
  done
echo
ISPLOGIN=""
while [ "$ISPLOGIN" = "" ]
  do
  echo "What name do you use as your username: or login: to your ISP?"
  read ISPLOGIN
  done
echo
ISPPASS=""
while [ "$ISPPASS" = "" ]
  do
  echo "What password do you use for $ISPLOGIN?"
  read ISPPASS
  done
echo
ISPPHONE=""
while [ "$ISPPHONE" = "" ]
  do
  echo "What is the phone number for your ISP?"
  read ISPPHONE
  done
echo
PPPNAME="dip-go"
  echo "What would you like to have your startup script called?"
  echo "The default is 'dip-go' just hit [Enter] for that..."
  read REPLY
  if [ "$REPLY" != "" ]
  then 
     PPPNAME=$REPLY
  fi
echo  
MODE="slip" 
  echo "What protocol? SLIP SLIP6 CSLIP CSLIP6 PPP (default is: SLIP)"
  read PROTOCOL
  if [ "$PROTOCOL" != "" ]
  then
   MODE=$PROTOCOL
  fi
echo
echo
echo "  Gateway:         $GATEIP"
echo "  Modem path:      $MODEM_PATH"
echo "  Login:           $ISPLOGIN"
echo "  Password:        $ISPPASS"
echo "  Phone number:    $ISPPHONE"
echo "  Dip startup:	   $PPPNAME"
echo "  Modem init:      AT&FW2"
echo "  Modem speed:     115200"
echo "  Protocol:        $MODE"
echo
echo "Does this look correct? (Y/n)"
echo "Anything that can't be changed here, can be changed in" 
echo "the /root/.dip.script file...(i.e. Modem init & speed...)"
read CONT
if [ "$CONT" = "n" ] 
then exit
elif [ "$CONT" = "N" ] 
then exit
fi

echo "rm -f /var/lock/LCK* /var/spool/uucp/LCK* /var/run/dip.pid" > /usr/sbin/$PPPNAME 
echo "dip /root/.dip.script" >> /usr/sbin/$PPPNAME

if [ -f /etc/resolv.conf ]; then
mv /etc/resolv.conf /etc/resolv.conf.old
echo "nameserver $GATEIP" > /etc/resolv.conf
fi
    
cat /usr/sbin/dipset.script | sed s/GATEWAY_ADDRESS/"$GATEIP"/g | 
sed s-PORT-"$MODEM_PATH"-g | 
sed s/PHONE_NUMBER/"$ISPPHONE"/g | 
sed s/LOGIN/"$ISPLOGIN"/g | 
sed s/PASS/"$ISPPASS"/g |
sed s-PROTOCOL-"$MODE"-g > /root/.dip.script  
   
echo "Adding /root/.dip.script & /usr/sbin/$PPPNAME"
chown root.root /root/.dip.script
chmod 0600 /root/.dip.script

chown root.root /usr/sbin/$PPPNAME
chmod 751 /usr/sbin/$PPPNAME

echo "DONE..."
echo 
echo "***NOTE: If your ISP account doesn't automatically start SLIP/PPP"
echo "         right away (ie after you give your password you must type"
echo "         'slip' 'ppp' or something) or requires another step (ie"
echo "         'annex:' number) edit the /root/.dip.script file, there" 
echo "         are comments that tell you what to do."
echo
echo "         To connect to your service provider do this:  ~# $PPPNAME"
echo "         To kill dip and the slip/cslip/ppp connection: # dip -k" 
echo         
[ RETURN TO DIRECTORY ]