Add the DragonFly cvs id and perform general cleanups on cvs/rcs/sccs ids. Most
[dragonfly.git] / release / picobsd / dial / lang / dialup.en
1 #!/bin/sh
2 # $FreeBSD: src/release/picobsd/dial/lang/dialup.en,v 1.5 1999/08/28 01:33:20 peter Exp $
3 # $DragonFly: src/release/picobsd/dial/lang/Attic/dialup.en,v 1.2 2003/06/17 04:27:20 dillon Exp $
4 set_resolv() {
5         echo "\e[H\e[J"
6         echo "\e[1m                       Default Domain Name\e[m"
7         echo ""
8         echo "Here you should enter your default Internet domain. If your"
9         echo "provider uses something like 'www.big.isp.com', this should"
10         echo "be most probably 'big.isp.com'."
11         echo ""
12         echo "If you simply press enter here, you will have a 'mydomain.edu',"
13         echo "which is not the best idea, but may suffice for now..."
14         echo ""
15         read -p "Please enter the default domain name: " domain
16         if [ "X${domain}" = "X" ]
17         then
18                 echo ""
19                 echo "Fine, your domain will be 'mydomain.edu', but be aware"
20                 echo "that it probably doesn't exist."
21                 echo ""
22                 read -p "Press any key to continue." junk
23                 domain="mydomain.edu"
24         fi
25         echo "\e[H\e[J"
26         echo "\e[1m                      DNS Server Address\e[m"
27         echo ""
28         echo "Here you should enter the numeric address of your domain name"
29         echo "server. It is needed for resolving human-readable host names"
30         echo "(such as www.freebsd.org) to machine readable IP numbers. If"
31         echo "it's not set properly, you will have to use numeric IP addresses"
32         echo "when connecting to other hosts, which is highly inconvenient."
33         echo ""
34         echo "If you simply press Enter here, we'll set it to one of root"
35         echo "DNS servers. This may not always work."
36         echo ""
37         read -p "Please enter the DNS server address in form A.B.C.D: " dns
38         if [ "X${dns}" = "X" ]
39         then
40                 echo ""
41                 echo "Fine, your DNS server will be 192.33.4.12, but be aware"
42                 echo "that this may not always work ok."
43                 echo ""
44                 read -p "Press any key to continue." junk
45                 dns="192.33.4.12"
46         fi
47 }
48
49 set_phone() {
50 while [ "X${phone}" = "X" ]
51 do
52         echo "\e[H\e[J"
53         echo "\e[1m                        Phone Number\e[m"
54         echo ""
55         echo "Here you should enter the full phone number you normally"
56         echo "use to connect to your provider, with all necessary prefixes"
57         echo "attached, e.g.: 01122334455"
58         echo ""
59         read -p "Please enter the phone number: " phone
60 done
61 }
62
63 set_port() {
64 while [ "X${dev}" = "X" ]
65 do
66         echo "\e[H\e[J"
67         echo "\e[1m                        Port Number\e[m"
68         echo ""
69         echo "Here you should enter the port number, to which your modem is"
70         echo "attached. REMEMBER: COM1 is port 0 in FreeBSD, COM2 - port 1,"
71         echo "and so on. You should enter only the number, not the full name"
72         echo "of the device."
73         echo ""
74         read -p "Please enter the port number (0,1,2): " dev
75 done
76 }
77
78 set_speed() {
79 while [ "X${speed}" = "X" ]
80 do
81         echo "\e[H\e[J"
82         echo "\e[1m                        Port Speed\e[m"
83         echo ""
84         echo "Here you should choose the serial port speed."
85         echo ""
86         echo "NOTICE: port speed is NOT the same as modem speed - these are"
87         echo "different things. If your modem is capable of V.42 or MNP"
88         echo "compression, the actual speed of serial port should be set much"
89         echo "higher. E.g. for 14.4 kbps modem with compression you should"
90         echo "choose 38400, for 28.8 kbps modem with compression you should"
91         echo "choose 115200."
92         echo ""
93         echo "  1.      9600   bps"
94         echo "  2.      14400  bps"
95         echo "  3.      28800  bps"
96         echo "  4.      38400  bps (14.4 kbps modem with compression)"
97         echo "  5.      57600  bps"
98         echo "  6.      115200 bps (28.8 kbps modem with compression)"
99         echo ""
100         read -p "Please choose the port speed (1-6): " ans
101         case ${ans} in
102         1)
103                 speed=9600
104                 ;;
105         2)
106                 speed=14400
107                 ;;
108         3)
109                 speed=28800
110                 ;;
111         4)
112                 speed=38400
113                 ;;
114         5)
115                 speed=57600
116                 ;;
117         6)
118                 speed=115200
119                 ;;
120         *)
121                 read -p "\aBad value! Press enter to continue..." junk
122                 unset speed
123                 ;;
124         esac
125 done
126 }
127
128 set_timeout() {
129 while [ "X${timo}" = "X" ]
130 do
131         echo "\e[H\e[J"
132         echo "\e[1m                        Idle Timeout\e[m"
133         echo ""
134         echo "Here you should enter timeout (in seconds). After this time, if"
135         echo "the connection is idle, it's disconnected (to save your money :-)"
136         echo ""
137         read -p "Please enter the timeout value: " timo
138 done
139 }
140
141 set_login() {
142 while [ "X${user}" = "X" ]
143 do
144         echo "\e[H\e[J"
145         echo "\e[1m                        Login Name\e[m"
146         echo ""
147         echo "Here you should enter your login name that you normally use"
148         echo "to log in to your provider's terminal server."
149         echo ""
150         read -p "Please enter your login name: " user
151 done
152 }
153
154 set_password() {
155 while [ "X${pass}" = "X" ]
156 do
157         echo "\e[H\e[J"
158         echo "\e[1m                        Password\e[m"
159         echo ""
160         echo "Here you enter the password that you use to log in to the"
161         echo "terminal server."
162         echo ""
163         echo "\e[31mWARNING: your password will be stored in readable form on the"
164         echo "floppy!!! If you don't like it... well, you must dial in manually."
165         echo "In that case abort this script (Ctrl-C). Otherwise, continue.\e[37m"
166         echo ""
167         stty -echo
168         read -p "Please enter your password: " pass
169         echo ""
170         read -p "Enter again your password: " pass1
171         stty echo
172         echo ""
173         if [ "X${pass}" != "X${pass1}" ]
174         then
175                 echo "\aPasswords didn't match! Press Enter to continue..."
176                 read junk
177                 pass=""
178                 set_password
179         fi
180 done
181 }
182
183 set_chat() {
184 echo "\e[H\e[J"
185 while [ "X${chat}" = "X" ]
186 do
187         echo "\e[1m                     Type of Login Dialog\e[m"
188         echo ""
189         echo "What type of login dialog do you expect from the terminal server?"
190         echo ""
191         echo "1)        \e[32m......login:\e[37m ${user}"
192         echo "  \e[32m...password:\e[37m ********"
193         echo "          \e[36m(terminal server starts PPP here)\e[37m"
194         echo "2)        \e[32m......login:\e[37m ${user}"
195         echo "  \e[32m...password:\e[37m ********"
196         echo "  \e[32m...protocol:\e[37m ppp"
197         echo "          \e[36m(terminal server starts PPP here)\e[37m"
198         echo "3)        \e[32m......username:\e[37m ${user}"
199         echo "  \e[32m......password:\e[37m ********"
200         echo "          \e[36m(terminal server starts PPP here)\e[37m"
201         echo "4)        \e[32m......username:\e[37m ${user}"
202         echo "  \e[32m......password:\e[37m ********"
203         echo "  \e[32mportX/..xxx...:\e[37m ppp"
204         echo "          \e[36m(terminal server starts PPP here)\e[37m"
205         echo "5)        \e[32mUse CHAP to log in.\e[37m"
206         echo "6)        \e[32mUse PAP to log in.\e[37m"
207         echo ""
208         read -p "Choose 1,2,3,4,5 or 6: " chat
209         case ${chat} in
210         1)
211                 chat1="TIMEOUT 10 ogin:--ogin: ${user} word: \\\\P"
212                 chat2="login/password"
213                 ;;
214         2)
215                 chat1="TIMEOUT 10 ogin:--ogin: ${user} word: \\\\P otocol: ppp"
216                 chat2="login/password/protocol"
217                 ;;
218         3)
219                 chat1="TIMEOUT 10 ername:--ername: ${user} word: \\\\P"
220                 chat2="username/password"
221                 ;;
222         4)
223                 chat1="TIMEOUT 10 ername:--ername: ${user} word: \\\\P port ppp"
224                 chat2="username/password/port"
225                 ;;
226         5)      chat1="-"
227                 chat2="CHAP"
228                 ;;
229         6)      chat1="-"
230                 chat2="PAP"
231                 ;;
232         *)      echo "\aBad value! Please choose 1,2,3 or 4."
233                 echo ""
234                 unset chat
235                 unset chat2
236                 ;;
237         esac
238 done
239 }
240
241 # Main entry of the script
242
243 echo "\e[H\e[J"
244 echo "\e[1m              Welcome to The Simplest PPP Configurator! :-)\e[m"
245 echo ""
246 echo "    Your PPP is already preconfigured, so that you can dial manually."
247 echo "However, you probably noticed that it requires chatting with your modem"
248 echo "and logging in every time you want to connect. It's simple and it works,"
249 echo "but it's also annoying."
250 echo ""
251 echo "This script will try to configure your PPP so that you can run it in"
252 echo "background (thus freeing the console), and log in automatically."
253 echo ""
254 echo "If you want to continue, press \e[1mEnter\e[m, otherwise press \e[1mCtrl-C\e[m."
255 echo ""
256 read junk
257
258 # Step through the options.
259 set_phone
260 set_port
261 set_speed
262 set_timeout
263 set_login
264 set_password
265 set_chat
266 set_resolv
267
268 ans="loop_it"
269 while [ "X${ans}" != "X" ]
270 do
271
272 echo "\e[H\e[J"
273 echo "\e[1m     Ok. You assigned the following values:\e[m"
274 echo ""
275 echo "  1.      Phone number:   ${phone}"
276 echo "  2.      Port number:    cuaa${dev}"
277 echo "  3.      Port speed:     ${speed} baud"
278 echo "  4.      Timeout:        ${timo} s"
279 echo "  5.      Login name:     ${user}"
280 echo "  6.      Password:       ${pass}"
281 echo "  7.      Chat pattern:   ${chat} (${chat2})"
282 echo "  8.      Default domain: ${domain}"
283 echo "          DNS Server:     ${dns}"
284 echo ""
285 echo "If you're satisfied with these values, just press \e[1mEnter\e[m."
286 read -p "Otherwise, enter the number of the option you want to change (1-8): " ans
287 a="X${ans}"
288 case ${a} in
289 X1)
290         unset phone
291         set_phone
292         ;;
293 X2)
294         unset dev
295         set_port
296         ;;
297 X3)
298         unset speed
299         set_speed
300         ;;
301 X4)
302         unset timo
303         set_timeout
304         ;;
305 X5)
306         unset user
307         set_login
308         ;;
309 X6)
310         unset pass
311         set_password
312         ;;
313 X7)
314         unset chat
315         set_chat
316         ;;
317 X8)
318         unset dns
319         unset domain
320         set_resolv
321         ;;
322 X)      ;;
323 *)
324         read -p "Unknown option: ${ans}. Press enter to continue..."
325         ;;
326 esac
327
328 done
329
330 echo ""
331 echo -n "Generating /etc/ppp/ppp.conf file..."
332 rm -f /etc/ppp/ppp.conf
333 cp /etc/ppp/ppp.conf.template /etc/ppp/ppp.conf
334 echo "" >>/etc/ppp/ppp.conf
335 echo "# This part was generated with $0" >>/etc/ppp/ppp.conf
336 echo "dialup:" >>/etc/ppp/ppp.conf
337 echo " set line /dev/cuaa${dev}" >>/etc/ppp/ppp.conf
338 echo " set speed ${speed}" >>/etc/ppp/ppp.conf
339 echo " set phone ${phone}" >>/etc/ppp/ppp.conf
340 echo " set authkey ${pass}" >>/etc/ppp/ppp.conf
341 echo " set timeout ${timo}" >>/etc/ppp/ppp.conf
342 if [ "X${chat1}" = "-" ]
343 then
344         echo " set authname ${user}" >>/etc/ppp/ppp.conf
345 else
346         echo " set login \"${chat1}\"" >>/etc/ppp/ppp.conf
347 fi
348 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
349
350 echo " Done."
351 echo -n "Generating /etc/resolv.conf..."
352 echo "# This file was generated with $0">/etc/resolv.conf
353 echo "domain ${domain}" >>/etc/resolv.conf
354 echo "nameserver ${dns}">>/etc/resolv.conf
355 echo "hostname=\"pico.${domain}\"">>/etc/rc.conf
356
357 echo " Done."
358
359 echo ""
360 echo "REMEMBER to run /stand/update! Otherwise these changes will be lost!"
361 echo ""
362 echo "Please check the contents of /etc/ppp/ppp.conf, and edit it if"
363 echo "necessary. When you're satisfied with it, run ppp in background:"
364 echo ""
365 echo "  \e[1mppp -background dialup\e[m"
366 echo ""
367 echo "Now, if you're sure that your /etc/ppp/ppp.conf file is ok (which is"
368 echo -n "probable :-) would you like to start the dialup connection now? (y/n) "
369 read ans
370 opts=""
371 while [ "X${ans}" = "Xy" ]
372 do
373         echo "\e[H\e[J"
374         if [ "X${opts}" = "X" ]
375         then
376                 echo "We'll use the following arguments to 'ppp':"
377                 echo ""
378                 echo "          ppp -background dialup"
379                 echo ""
380                 echo -n "Would you like to change them? (y/n) "
381                 read oo
382                 if [ "X${oo}" = "Xy" ]
383                 then
384                         read -p "Enter ppp arguments here: " opts
385                 else
386                         opts="-background dialup"
387                 fi
388                 echo ""
389                 echo ""
390         fi
391         echo "Starting dialup connection. Wait until you see a 'PPP Enabled' message..."
392         echo ""
393         ppp ${opts}
394         if [ "X$?" != "X0" ]
395         then
396                 echo ""
397                 echo -n "Hmmm... Command failed. Try again? (y/n) "
398                 read ans
399                 if [ "X${ans}" != "Xy" ]
400                 then
401                         echo ""
402                         echo "Try again later. Check also your config file (/etc/ppp/ppp.conf)"
403                         echo ""
404                 fi
405         else
406                 echo ""
407                 echo "Congratulations! You're on-line now."
408                 echo ""
409                 exit 0
410         fi
411 done