freebsd-dev/release/picobsd/dial/lang/dialup.en

411 lines
10 KiB
Plaintext
Raw Normal View History

1998-08-27 17:38:45 +00:00
#!/bin/sh
1999-08-28 01:35:59 +00:00
# $FreeBSD$
1998-08-27 17:38:45 +00:00
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 ""
stty -echo
1998-08-27 17:38:45 +00:00
read -p "Please enter your password: " pass
echo ""
read -p "Enter again your password: " pass1
stty echo
echo ""
if [ "X${pass}" != "X${pass1}" ]
then
echo "Passwords didn't match! Press Enter to continue..."
read junk
pass=""
set_password
fi
1998-08-27 17:38:45 +00:00
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 "2) ......login: ${user}"
echo " ...password: ********"
echo " ...protocol: ppp"
echo " (terminal server starts PPP here)"
echo "3) ......username: ${user}"
echo " ......password: ********"
echo " (terminal server starts PPP here)"
echo "4) ......username: ${user}"
echo " ......password: ********"
echo " portX/..xxx...: ppp"
echo " (terminal server starts PPP here)"
echo "5) Use CHAP to log in."
echo "6) Use PAP to log in."
1998-08-27 17:38:45 +00:00
echo ""
read -p "Choose 1,2,3,4,5 or 6: " chat
1998-08-27 17:38:45 +00:00
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"
;;
5) chat1="-"
chat2="CHAP"
;;
6) chat1="-"
chat2="PAP"
;;
1998-08-27 17:38:45 +00:00
*) 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
if [ "X${chat1}" = "-" ]
then
echo " set authname ${user}" >>/etc/ppp/ppp.conf
else
echo " set login \"${chat1}\"" >>/etc/ppp/ppp.conf
fi
1998-08-27 17:38:45 +00:00
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
opts=""
1998-08-27 17:38:45 +00:00
while [ "X${ans}" = "Xy" ]
do
echo ""
if [ "X${opts}" = "X" ]
then
echo "We'll use the following arguments to 'ppp':"
echo ""
echo " ppp -background dialup"
1999-06-14 15:45:56 +00:00
echo ""
echo -n "Would you like to change them? (y/n) "
read oo
if [ "X${oo}" = "Xy" ]
then
read -p "Enter ppp arguments here: " opts
else
opts="-background dialup"
fi
echo ""
echo ""
fi
1998-08-27 17:38:45 +00:00
echo "Starting dialup connection. Wait until you see a 'PPP Enabled' message..."
echo ""
ppp ${opts}
1998-08-27 17:38:45 +00:00
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