summaryrefslogtreecommitdiffstats
path: root/release/picobsd/dial/lang/dialup.en
blob: ab1491245c02a46951fd345b071fcd6ffec22919 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
#!/bin/sh
# $FreeBSD$
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
	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
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."
	echo ""
	read -p "Choose 1,2,3,4,5 or 6: " 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"
		;;
	5)	chat1="-"
		chat2="CHAP"
		;;
	6)	chat1="-"
		chat2="PAP"
		;;
	*)	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
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=""
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"
		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
	echo "Starting dialup connection. Wait until you see a 'PPP Enabled' message..."
	echo ""
	ppp ${opts}
	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
OpenPOWER on IntegriCloud