summaryrefslogtreecommitdiffstats
path: root/etc/etc.i386/inst2.rc
blob: 0020bcc84642991ac3d3e3d962b39deb0879b9c0 (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
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
#	$Id: inst2.rc,v 1.3 1994/03/18 03:09:51 rgrimes Exp $
#

stty status '^T'
trap : 2
trap : 3
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/distbin; export PATH

echo
echo
if [ -e /fastboot ]
then
	echo Fast boot ... skipping disk checks
else
	echo Automatic reboot in progress...
	fsck -p
	case $? in
	0)
		;;
	2)
		exit 1
		;;
	4)
		echo; echo README README README README README README README
		echo
		echo "NOTE: The above errors are expected if this is the"
		echo "first time you have booted from the hard disk after"
		echo "completing the floppy install"; echo
		echo "Automatic file system check changed the root file system"
		echo "The system must halt for these corrections to take effect"
		echo
		reboot
		echo "reboot failed... help!"
		exit 1
		;;
	8)
		echo "Automatic file system check failed... help!"
		exit 1
		;;
	12)
		echo "Reboot interrupted"
		exit 1
		;;
	130)
		exit 1
		;;
	*)
		echo "Unknown error in reboot"
		exit 1
		;;
	esac
fi

trap 2
trap "echo 'Reboot interrupted'; exit 1" 3
umount -a >/dev/null 2>&1
mount -a -t nonfs
rm -f /fastboot
(cd /var/run && { rm -rf -- *; cp /dev/null utmp; chmod 644 utmp; })

OPSYSTEM=FreeBSD
RELEASE="1.1.5"
echo "${OPSYSTEM} Base System Release ${RELEASE}"
echo ""
echo "Congratulations, you've got ${OPSYSTEM} on the hard disk!"
echo
echo "Press the return key for more installation instructions"
read junkit
echo
echo "To finish installation:"
echo "Pick a temporary directory by running set_tmp_dir.  Make sure it's"
echo "in a place with lots of space, probably under /usr."
echo "Then, load the remaining distribution files into that temporary"
echo "directory by issuing one of the following commands:"
echo
echo "	load_dos	load_fd		load_qic_tape	load_scsi_tape"
echo
echo "or by fetching the files with ftp (see the installation notes for"
echo "information on how to do that)."
echo
echo "Once this is complete, extract the distribution files by issuing the"
echo "command 'extract <distribution>'  where <distribution> is the base name"
echo "of the distribution files, e.g. 'base10'."
echo
echo "Once all of the filesets you wish to install have been extracted,"
echo "enter the command 'configure' to finish setting up the system"
echo " "
echo "If you wish to uninstall ${OPSYSTEM}, delete the partition by using the"
echo "DOS 5 FDISK program. If installed on the entire drive, use the FDISK/MBR"
echo "to remove the ${OPSYSTEM} bootstrap from the drive."
echo 'erase ^?, werase ^H, kill ^U, intr ^C'
stty newcrt werase  intr  kill  erase  9600
umask 0
exit 1

set_tmp_dir()
{
	def_tmp_dir=`pwd`
	[ "$def_tmp_dir" = "/" ] && def_tmp_dir=/usr/distrib
	echo -n "Copy files to which directory? [${def_tmp_dir}] "
	read tmp_dir
	[ ! "$tmp_dir" ] && tmp_dir=$def_tmp_dir
	if [ ! -d "$tmp_dir" ]; then
		/bin/rm -rf $tmp_dir
		mkdir -p $tmp_dir
	fi
	echo
}
tmp_dir()
{
	if [ "$tmp_dir" = "" ]; then
		set_tmp_dir
	fi
	cd $tmp_dir
}
load_fd()
{
	tmp_dir
	drive=
	altdrive=
	subdir=
	while [ -z "$drive" ]; do
		echo -n "Read from which drive (or ? for help)? [c] "
		read answer junk
		case "${answer:-c}" in
		a*b|A*B)	
			drive=A; altdrive=B
			;;
		b*a|B*A)	
			drive=B; altdrive=A
			;;
		a*|A*)	
			drive=A; altdrive=A
			;;
		b*|B*)	
			drive=B; altdrive=B
			;;
		c*|C*)
			while read data; do
				msdos_device=`expr X"$data" : 'X[ 	]*\([^ 	]*\)[^M]*pcfs'`
				msdos_dir=`expr X"$data" : 'X[ 	]*[^ 	]*[ 	]*\([^ 	]*\)'`
				[ "${msdos_device}" ] && break
			done </etc/fstab
			if [ ! "$msdos_device" ]; then
				echo
				echo	"Cannot find MS-DOS in filesystem table"
				continue
			fi
			drive=C; altdrive=C
			while :; do
				echo
				echo -n "Read from which MS-DOS drive C: directory? [/] "
				read resp junk
				newdir=$(echo "${resp:-/}" | \
				awk '{ sub(/^[Cc]*:*/, ""); gsub(/\\/, "/"); gsub(/^\/*/, ""); gsub(/\/*$/, ""); print $0 }')
				if [ -d ${msdos_dir}/${newdir} ]; then
					subdir=$newdir
					break
				else
					echo "C:/${newdir}: No such directory"
				fi
			done
			;;
		q*|Q*)	
			drive=q
			;;
		\?*)	
			echo
			echo "Enter:		To:"
			echo "------		---"
			echo "  a		Read from floppy drive A:"
			echo "  b		Read from floppy drive B:"
			echo "  c		Read from MS-DOS hard drive C:"
			echo "  ab		Alternate between A: and B:, starting with A:"
			echo "  ba		Alternate between A: and B:, starting with B:"
			echo "  q		Quit"
			echo
			;;
		esac
	done
	verbose=-v
	interactive=-i
	if [ "$drive" = "C" ]; then
		dir=${msdos_dir}
	elif [ "$drive" != "q" ]; then
		dir=/tmp/floppy
		[ -d $dir ] && umount $dir >/dev/null 2>&1
		[ -f $dir ] && rm -f $dir
		mkdir -p $dir
	fi
	while [ "$drive" != "q" ]
	do
		device=/dev/fd0
		[ "$drive" = "B" ] && device=/dev/fd1
		[ "$drive" = "C" ] && device=${msdos_device}
		echo; 
		if [ "$drive" != "C" ]; then
			echo	"Insert floppy in drive $drive:, then press RETURN to copy files,"
			echo -n "or enter option (? for help): "
		else
			echo -n "Press RETURN to copy files, or enter option (? for help): "
		fi
		read answer junk
		case "${answer:-g}" in
		c*|C*)
			if [ "$drive" != "C" ]; then
				echo "Cannot change directory: not reading from MS-DOS drive C:"
			else
				echo
				echo -n "Read from which MS-DOS drive C: directory? [/${subdir}] "
				read resp junk
				[ ! "$resp" ] && resp="/$subdir"
				absolute=`expr X"$resp" : 'X[Cc]*:*\([/\]\)'`
				subsub=$(echo "${resp}" | \
				awk '{ sub(/^[Cc]*:*/, ""); gsub(/\\/, "/"); gsub(/^\/*/, ""); gsub(/\/*$/, ""); print $0 }')
				if [ "$absolute" -o ! "$subdir" ]; then
					newsub=$subsub
				else
					newsub=$subdir/$subsub
				fi
				if [ -d ${dir}/${newsub} ]; then
					subdir=$newsub
				else
					echo "C:/${newsub}: No such directory"
				fi
			fi
			;;
		g*|G*)	
			sync
			if [ "$drive" = "C" ]; then
				[ "$verbose" ] &&
				{ echo; echo "Copying files from MS-DOS C:/${subdir}"; }
				cp ${msdos_dir}/${subdir}/* .
				sync
			elif mount -t pcfs $verbose $device $dir; then 
				[ "$verbose" ] && 
				{ echo; echo "Copying files to disk..."; }
				cp $interactive $dir/* .
				sync
				umount $dir
				tmp=$drive; drive=$altdrive; altdrive=$tmp
			fi
			;;
		i*|I*)	
			tmp=$interactive; interactive=; [ -z "$tmp" ] && interactive=-i
			tmp=on; [ -z "$interactive" ] && tmp=off
			echo "interactive mode is $tmp"
			;;
		l*|L*)
			sync
			[ "$verbose" ] && echo "Directory of ${drive}:/${subdir}"
			if [ "$drive" = "C" ]; then
				ls -l $dir/${subdir}
			else
				umount $dir >/dev/null 2>&1
				if mount -t pcfs $device $dir; then 
					ls -l $dir/${subdir}
					umount $dir
				fi
			fi
			;;
		o*|O*)	
			tmp=$drive; drive=$altdrive; altdrive=$tmp
			;;
		q*|Q*)	
			drive=q
			;;
		s*|S*)	
			echo; echo -n "tmp_dir is set to $tmp_dir"
			[ "$tmp_dir" != "`pwd`" ] && echo -n " (physically `pwd`)"
			echo; echo "Free space in tmp_dir:"
			df -k .
			echo -n "Reading from drive $drive:"
			[ "$drive" != "$altdrive" ] && echo -n " and drive $altdrive:"
			echo
			tmp=on; [ -z "$verbose" ] && tmp=off
			echo "Verbose mode is $tmp"
			tmp=on; [ -z "$interactive" ] && tmp=off
			echo "Interactive mode is $tmp"
			;;
		v*|V*)	
			tmp=$verbose; verbose=; [ -z "$tmp" ] && verbose=-v
			tmp=on; [ -z "$verbose" ] && tmp=off
			echo "verbose mode is $tmp"
			;;
		\?)	
			echo
			echo "Enter:		To:"
			echo "-----		---"
			echo "(just RETURN)	Copy files from ${drive}:/${subdir} to $tmp_dir"
			echo "  c		Change directory of MS-DOS drive C:"
			echo "  i		Toggle interactive mode (cp -i)"
			echo "  l		List directory of current drive"
			echo "  o		Read from alternate floppy drive"
			echo "  q		Quit"
			echo "  s		Show status"
			echo "  v		Toggle verbose mode"
			echo 
			;;
		esac
	done
	echo "Working directory: `pwd`"
	unset verbose answer drive altdrive device dir subdir tmp interactive
}
load_dos
{
	load_fd
}
load_qic_tape()
{
	tmp_dir
	echo -n "Insert tape into QIC tape drive and hit return to continue: "
	read foo
	tar xvf /dev/rwt0
}
load_scsi_tape()
{
	tmp_dir
	echo -n "Insert tape into SCSI tape drive and hit return to continue: "
	read foo
	tar xvf /dev/nrst0
}
extract()
{
	tmp_dir
	echo -n "Would you like to be verbose about this? [n] "
	read verbose
	case $verbose in
	y*|Y*)
		tarverbose=--verbose
		;;
	*)
		tarverbose=
		;;
	esac
	#XXX ugly hack to eliminate busy files, copy them to /tmp and use them
	#from there...
	cp -p /bin/cat /usr/bin/gunzip /usr/bin/tar /tmp
	
	for i in $*; do
		/tmp/cat "$i"* | 
		/tmp/gunzip |
		(cd / ; /tmp/tar --extract --file - --preserve-permissions ${tarverbose} )
	done
	rm -f /tmp/cat /tmp/gunzip /tmp/tar
	sync
}
configure()
{
	echo	"You will now be prompted for information about this"
	echo	"machine.  If you hit return, the default answer (in"
	echo	"brackets) will be used."

	echo
	echo -n "What is this machine's hostname? [unknown.host.domain] "
	read hname

	if [ "$hname" = "" ]; then
		hname=unknown.host.domain
	fi
	echo $hname > /etc/myname
	proto_domain=`echo $hname | sed -e 's/[^.]*\.//'`
	
	echo
	echo	"What domain is this machine in (this is NOT its YP"
	echo -n "domain name)? [$proto_domain] "
	read dname

	if [ "$dname" = "" ]; then
		dname=$proto_domain
	fi

	echo
	echo -n "Does this machine have an ethernet interface? [y] "
	read resp
	case "$resp" in
	n*)
		;;
	*)
		intf=
		while [ "$intf" = "" ]; do
			echo -n "What is the primary interface name (i.e. ed0, etc.)? "
			read intf
		done
		echo -n "What is the hostname for this interface? [$hname] "
		read ifname
		if [ "$ifname" = "" ]; then
			ifname=$hname
		fi
		ifaddr=
		while [ "$ifaddr" = "" ]; do
			echo -n "What is the IP address associated with this interface? "
			read ifaddr
		done
		echo "$ifaddr    $ifname `echo $ifname | sed -e s/\.$dname//`" \
			>> /etc/hosts

		echo -n "Does this interface have a special netmask? [n] "
		read resp
		case "$resp" in
		y*)
			echo -n "What is the netmask? [0xffffff00] "
			read ifnetmask
			if [ "$ifnetmask" = "" ]; then
				ifnetmask=0xffffff00
			fi
			;;
		*)
			ifnetmask=
			;;
		esac
		
		echo -n "Does this interface need additional flags? [n] "
		read resp
		case "$resp" in
		y*)
			echo -n "What flags? [llc0] "
			read ifflags
			if [ "$ifflags" = "" ]; then
				ifflags=llc0
			fi
			;;
		*)
			ifflags=
			;;
		esac
		
		echo "inet $ifname netmask $ifnetmask $ifflags" > /etc/hostname.$intf

		echo	""
		echo	"WARNING: if you have any more ethernet interfaces, you"
		echo	"will have to configure them by hand.  Read the comments"
		echo	"in /etc/netstart to learn how to do this"
		;;
	esac

	sync

	echo
	echo	"OK.  You should be completely set up now."
	echo	"You should now reboot your machine by issuing the 'reboot' command"
	echo	"after removing anything that happens to be in your floppy drive."
}
OpenPOWER on IntegriCloud