#!/bin/sh
# usage: ./connect.sh ISP
# synopsis: this script creates the ppp device node,
#	    backs up /etc/resolv.conf, 
#           copies /etc/resolv.conf.ISP to /etc/resolv.conf, 
#           then connects to the internet with wvdial ISP

if [ -n "$1" ]; # if the arguement is not null
  then 
  echo "creating ppp device node"
  mknod /dev/ppp c 108 0
  echo "backing up /etc/resolv.conf as /etc/resolv.conf.bak"
  cp /etc/resolv.conf /etc/resolv.conf.bak
  echo "moving /etc/resolv.conf.$1 to /etc/resolv.conf"
  cp /etc/resolv.conf.$1 /etc/resolv.conf
  echo "running wvdial $1"
  wvdial $1
else
  echo "usage: ./connect.sh ISP"
  echo "synopsis: this script creates the ppp device node, "
  echo "	  backs up /etc/resolv.conf, "
  echo "          copies /etc/resolv.conf.ISP to /etc/resolv.conf, "
  echo "          then connects to the internet with wvdial ISP"
fi
