freebsd-dev/release/picobsd/dial/lang/dialup.en
1998-08-27 17:38:45 +00:00

371 lines
9.4 KiB
Bash
Executable File
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/sh
# $Id: dialup.en,v 1.3 1998/08/07 19:29:57 abial Exp $
set_resolv() {
echo ""
echo " Default Domain Name"
echo ""
echo "Here you should enter your default Internet domain. If your"
echo "provider uses something like 'www.big.isp.com', this should"
echo "be most probably 'big.isp.com'."
echo ""
echo "If you simply press enter here, you will have a 'mydomain.edu',"
echo "which is not the best idea, but may suffice for now..."
echo ""
read -p "Please enter the default domain name: " domain
if [ "X${domain}" = "X" ]
then
echo ""
echo "Fine, your domain will be 'mydomain.edu', but be aware"
echo "that it probably doesn't exist."
echo ""
read -p "Press any key to continue." junk
domain="mydomain.edu"
fi
echo ""
echo " DNS Server Address"
echo ""
echo "Here you should enter the numeric address of your domain name"
echo "server. It is needed for resolving human-readable host names"
echo "(such as www.freebsd.org) to machine readable IP numbers. If"
echo "it's not set properly, you will have to use numeric IP addresses"
echo "when connecting to other hosts, which is highly inconvenient."
echo ""
echo "If you simply press Enter here, we'll set it to one of root"
echo "DNS servers. This may not always work."
echo ""
read -p "Please enter the DNS server address in form A.B.C.D: " dns
if [ "X${dns}" = "X" ]
then
echo ""
echo "Fine, your DNS server will be 192.33.4.12, but be aware"
echo "that this may not always work ok."
echo ""
read -p "Press any key to continue." junk
dns="192.33.4.12"
fi
}
set_phone() {
while [ "X${phone}" = "X" ]
do
echo ""
echo " Phone Number"
echo ""
echo "Here you should enter the full phone number you normally"
echo "use to connect to your provider, with all necessary prefixes"
echo "attached, e.g.: 01122334455"
echo ""
read -p "Please enter the phone number: " phone
done
}
set_port() {
while [ "X${dev}" = "X" ]
do
echo ""
echo " Port Number"
echo ""
echo "Here you should enter the port number, to which your modem is"
echo "attached. REMEMBER: COM1 is port 0 in FreeBSD, COM2 - port 1,"
echo "and so on. You should enter only the number, not the full name"
echo "of the device."
echo ""
read -p "Please enter the port number (0,1,2): " dev
done
}
set_speed() {
while [ "X${speed}" = "X" ]
do
echo ""
echo " Port Speed"
echo ""
echo "Here you should choose the serial port speed."
echo ""
echo "NOTICE: port speed is NOT the same as modem speed - these are"
echo "different things. If your modem is capable of V.42 or MNP"
echo "compression, the actual speed of serial port should be set much"
echo "higher. E.g. for 14.4 kbps modem with compression you should"
echo "choose 38400, for 28.8 kbps modem with compression you should"
echo "choose 115200."
echo ""
echo " 1. 9600 bps"
echo " 2. 14400 bps"
echo " 3. 28800 bps"
echo " 4. 38400 bps (14.4 kbps modem with compression)"
echo " 5. 57600 bps"
echo " 6. 115200 bps (28.8 kbps modem with compression)"
echo ""
read -p "Please choose the port speed (1-6): " ans
case ${ans} in
1)
speed=9600
;;
2)
speed=14400
;;
3)
speed=28800
;;
4)
speed=38400
;;
5)
speed=57600
;;
6)
speed=115200
;;
*)
read -p "Bad value! Press enter to continue..." junk
unset speed
;;
esac
done
}
set_timeout() {
while [ "X${timo}" = "X" ]
do
echo ""
echo " Idle Timeout"
echo ""
echo "Here you should enter timeout (in seconds). After this time, if"
echo "the connection is idle, it's disconnected (to save your money :-)"
echo ""
read -p "Please enter the timeout value: " timo
done
}
set_login() {
while [ "X${user}" = "X" ]
do
echo ""
echo " Login Name"
echo ""
echo "Here you should enter your login name that you normally use"
echo "to log in to your provider's terminal server."
echo ""
read -p "Please enter your login name: " user
done
}
set_password() {
while [ "X${pass}" = "X" ]
do
echo ""
echo " Password"
echo ""
echo "Here you enter the password that you use to log in to the"
echo "terminal server."
echo ""
echo "WARNING: your password will be stored in readable form on the"
echo "floppy!!! If you don't like it... well, you must dial in manually."
echo "In that case abort this script (Ctrl-C). Otherwise, continue."
echo ""
read -p "Please enter your password: " pass
done
}
set_chat() {
echo ""
while [ "X${chat}" = "X" ]
do
echo " Type of Login Dialog"
echo ""
echo "What type of login dialog do you expect from the terminal server?"
echo ""
echo "1) ......login: ${user}"
echo " ...password: ********"
echo " (terminal server starts PPP here)"
echo ""
echo "2) ......login: ${user}"
echo " ...password: ********"
echo " ...protocol: ppp"
echo " (terminal server starts PPP here)"
echo ""
echo "3) ......username: ${user}"
echo " ......password: ********"
echo " (terminal server starts PPP here)"
echo ""
echo "4) ......username: ${user}"
echo " ......password: ********"
echo " portX/..xxx...: ppp"
echo " (terminal server starts PPP here)"
echo ""
read -p "Choose 1,2,3 or 4: " chat
case ${chat} in
1)
chat1="TIMEOUT 10 ogin:--ogin: ${user} word: \\\\P"
chat2="login/password"
;;
2)
chat1="TIMEOUT 10 ogin:--ogin: ${user} word: \\\\P otocol: ppp"
chat2="login/password/protocol"
;;
3)
chat1="TIMEOUT 10 ername:--ername: ${user} word: \\\\P"
chat2="username/password"
;;
4)
chat1="TIMEOUT 10 ername:--ername: ${user} word: \\\\P port ppp"
chat2="username/password/port"
;;
*) echo "Bad value! Please choose 1,2,3 or 4."
echo ""
unset chat
unset chat2
;;
esac
done
}
# Main entry of the script
echo ""
echo " Welcome to The Simplest PPP Configurator! :-)"
echo ""
echo " Your PPP is already preconfigured, so that you can dial manually."
echo "However, you probably noticed that it requires chatting with your modem"
echo "and logging in every time you want to connect. It's simple and it works,"
echo "but it's also annoying."
echo ""
echo "This script will try to configure your PPP so that you can run it in"
echo "background (thus freeing the console), and log in automatically."
echo ""
echo "If you want to continue, press Enter, otherwise press Ctrl-C."
echo ""
read junk
# Step through the options.
set_phone
set_port
set_speed
set_timeout
set_login
set_password
set_chat
set_resolv
ans="loop_it"
while [ "X${ans}" != "X" ]
do
echo ""
echo " Ok. You assigned the following values:"
echo ""
echo " 1. Phone number: ${phone}"
echo " 2. Port number: cuaa${dev}"
echo " 3. Port speed: ${speed} baud"
echo " 4. Timeout: ${timo} s"
echo " 5. Login name: ${user}"
echo " 6. Password: ${pass}"
echo " 7. Chat pattern: ${chat} (${chat2})"
echo " 8. Default domain: ${domain}"
echo " DNS Server: ${dns}"
echo ""
echo "If you're satisfied with these values, just press Enter."
read -p "Otherwise, enter the number of the option you want to change (1-8): " ans
a="X${ans}"
case ${a} in
X1)
unset phone
set_phone
;;
X2)
unset dev
set_port
;;
X3)
unset speed
set_speed
;;
X4)
unset timo
set_timeout
;;
X5)
unset user
set_login
;;
X6)
unset pass
set_password
;;
X7)
unset chat
set_chat
;;
X8)
unset dns
unset domain
set_resolv
;;
X) ;;
*)
read -p "Unknown option: ${ans}. Press enter to continue..."
;;
esac
done
echo ""
echo -n "Generating /etc/ppp/ppp.conf file..."
rm -f /etc/ppp/ppp.conf
cp /etc/ppp/ppp.conf.template /etc/ppp/ppp.conf
echo "" >>/etc/ppp/ppp.conf
echo "# This part was generated with $0" >>/etc/ppp/ppp.conf
echo "dialup:" >>/etc/ppp/ppp.conf
echo " set line /dev/cuaa${dev}" >>/etc/ppp/ppp.conf
echo " set speed ${speed}" >>/etc/ppp/ppp.conf
echo " set phone ${phone}" >>/etc/ppp/ppp.conf
echo " set authkey ${pass}" >>/etc/ppp/ppp.conf
echo " set timeout ${timo}" >>/etc/ppp/ppp.conf
echo " set login \"${chat1}\"" >>/etc/ppp/ppp.conf
echo " set ifaddr 10.0.0.1/0 10.0.0.2/0 255.255.255.0 0.0.0.0" >>/etc/ppp/ppp.conf
echo " Done."
echo -n "Generating /etc/resolv.conf..."
echo "# This file was generated with $0">/etc/resolv.conf
echo "domain ${domain}" >>/etc/resolv.conf
echo "nameserver ${dns}">>/etc/resolv.conf
echo "hostname=\"pico.${domain}\"">>/etc/rc.conf
echo " Done."
echo ""
echo "REMEMBER to run /stand/update! Otherwise these changes will be lost!"
echo ""
echo "Please check the contents of /etc/ppp/ppp.conf, and edit it if"
echo "necessary. When you're satisfied with it, run ppp in background:"
echo ""
echo " ppp -background dialup"
echo ""
echo "Now, if you're sure that your /etc/ppp/ppp.conf file is ok (which is"
echo -n "probable :-) would you like to start the dialup connection now? (y/n) "
read ans
while [ "X${ans}" = "Xy" ]
do
echo ""
echo "Starting dialup connection. Wait until you see a 'PPP Enabled' message..."
echo ""
ppp -background dialup
if [ "X$?" != "X0" ]
then
echo ""
echo -n "Hmmm... Command failed. Try again? (y/n) "
read ans
if [ "X${ans}" != "Xy" ]
then
echo ""
echo "Try again later. Check also your config file (/etc/ppp/ppp.conf)"
echo ""
fi
else
echo ""
echo "Congratulations! You're on-line now."
echo ""
exit 0
fi
done