Commit | Line | Data |
---|---|---|
f078e99d | 1 | #!/bin/sh |
362925ff | 2 | # install1.fs disk 'install' |
f078e99d | 3 | # |
362925ff AM |
4 | # Currently, no method for checking to see if the designated disk type is |
5 | # already in /etc/disktab. You can edit it out of the file after installation. | |
f078e99d | 6 | # |
d39e7451 | 7 | PATH=/sbin:/bin:/usr/bin:/usr/sbin:. |
56164db9 | 8 | export PATH |
d39e7451 | 9 | |
c5bc0e81 | 10 | OPSYSTEM=FreeBSD |
362925ff AM |
11 | OPSYSID=165 |
12 | ROOTMIN=7 | |
13 | SWAPMIN=8 | |
4c569b4c | 14 | USRMIN=7 |
362925ff | 15 | DISKMIN=`expr $ROOTMIN + $SWAPMIN + 1` |
0d255f16 | 16 | DEFBLOCKING=2 |
8231ed99 RG |
17 | DEFSECT=17 |
18 | DEFHEAD=12 | |
19 | DEFCYLN=1024 | |
362925ff | 20 | RUN_FDISK="" |
f078e99d | 21 | |
4c569b4c AM |
22 | DOS1_ID=1 |
23 | DOS2_ID=4 | |
24 | DOS3_ID=6 | |
25 | ||
362925ff AM |
26 | set_arbitrary_defaults() { |
27 | cyls_per_disk=$DEFCYLN | |
28 | tracks_per_cyl=$DEFHEAD | |
29 | sects_per_track=$DEFSECT | |
30 | unused_last_part=3 | |
31 | part_cnt=4 | |
32 | } | |
33 | ||
34 | ||
35 | get_fdisk_data() { | |
36 | cyls_per_disk= | |
37 | part_id= | |
38 | got_sysid= | |
39 | part_cnt=0 | |
40 | sysid_cnt=0 | |
41 | have_opsys_part= | |
4c569b4c | 42 | have_dos_part= |
362925ff AM |
43 | unused_last_part= |
44 | extent_max=0 | |
45 | extent_max_part= | |
46 | ||
47 | fdisk /dev/r${drivename}d >fdisk.out 2>fdisk.err | |
48 | if [ $? -gt 0 ]; then | |
49 | echo "Can't open /dev/r${drivename}d for reading!" | |
50 | set_arbitrary_defaults | |
51 | >fdisk.out | |
52 | >fdisk.err | |
53 | return 2 | |
54 | elif [ -s fdisk.err ]; then | |
55 | echo "Disk doesn't appear to be initialized..." | |
56 | no_part_table=1 | |
21a421ff | 57 | fi |
362925ff AM |
58 | while read data; do |
59 | if [ ! "$cyls_per_disk" ]; then | |
60 | cyls_per_disk=`expr "$data" : '[^=]*=\([0-9]*\)'` | |
61 | tracks_per_cyl=`expr "$data" : '[^=]*=[^=]*=\([0-9]*\)'` | |
62 | sects_per_track=`expr "$data" : '[^=]*=[^=]*=[^=]*=\([0-9]*\)'` | |
63 | continue | |
64 | fi | |
65 | if [ "$got_sysid" ]; then | |
66 | start_part=`expr "$data" : '[^0-9]*\([0-9]*\)'` | |
67 | size_part=`expr "$data" : '[^0-9]*[0-9]*[^0-9]*\([0-9]*\)'` | |
68 | extent_part=`expr $start_part + $size_part` | |
69 | if [ $extent_part -gt $extent_max ]; then | |
70 | extent_max=$extent_part | |
71 | extent_max_part=$part_id | |
72 | fi | |
73 | eval start${part_id}=$start_part | |
74 | eval size${part_id}=$size_part | |
75 | sysid_cnt=`expr $sysid_cnt + 1` | |
76 | got_sysid= | |
77 | part_id= | |
78 | elif [ "$part_id" ]; then | |
79 | sysid=`expr "$data" : 'sysid \([0-9]*\)'` | |
e7f1e154 | 80 | sysname=`expr "$data" : 'sysid[^(]*(\([^)]*\)'` |
362925ff AM |
81 | if [ "$no_part_table" -o "$sysid" = "0" -o \ |
82 | "$(expr "$data" : '\(<UNUSED>\)')" = "<UNUSED>" ]; then | |
83 | unused_last_part=$part_id | |
84 | part_id= | |
85 | continue | |
86 | fi | |
4c569b4c AM |
87 | if [ "$sysid" = "$OPSYSID" ]; then |
88 | have_opsys_part=$part_id | |
89 | elif [ ! "$have_dos_part" -a \( "$sysid" = "$DOS1_ID" -o \ | |
90 | "$sysid" = "$DOS2_ID" -o "$sysid" = "$DOS3_ID" \) ]; then | |
91 | have_dos_part=$part_id | |
92 | fi | |
362925ff | 93 | eval sysid${part_id}=$sysid |
691e6212 | 94 | eval sysname${part_id}=\"$sysname\" |
362925ff AM |
95 | got_sysid=1 |
96 | else | |
97 | part_id=`expr "$data" : 'The data[^0-9]*\([0-9]*\)'` | |
98 | beg_cyl=`expr "$data" : '[ ]*beg[^0-9]*\([0-9]*\)'` | |
99 | end_cyl=`expr "$data" : '[ ]*end[^0-9]*\([0-9]*\)'` | |
100 | if [ "$part_id" ]; then | |
101 | part_cnt=`expr $part_cnt + 1` | |
d39e7451 AM |
102 | elif [ "${beg_cyl}" -gt "${cyls_per_disk}" -o \ |
103 | "${end_cyl}" -gt "${cyls_per_disk}" ]; then | |
104 | no_part_table=1 | |
105 | sysid_cnt=0 | |
106 | have_opsys_part=0 | |
107 | unused_last_part=`expr $part_cnt - 1` | |
362925ff AM |
108 | fi |
109 | fi | |
110 | done <fdisk.out | |
111 | if [ ! "$cyls_per_disk" ]; then | |
112 | set_arbitrary_defaults | |
113 | return 2 | |
114 | fi | |
115 | >fdisk.out | |
116 | >fdisk.err | |
117 | return 0 | |
118 | } | |
119 | ||
691e6212 AM |
120 | set_existing_part() { |
121 | # Set existing partiton values as default (adjusting to cylinder boundaries) | |
122 | eval opsys_size=\$size${opsys_part} | |
123 | eval opsys_start=\$start${opsys_part} | |
124 | [ $opsys_size -eq 50000 ] && opsys_size=$disksize | |
125 | opsys_off=`expr $opsys_start / $cylindersize` | |
126 | opsys_adjusted=`expr $opsys_off \* $cylindersize` | |
127 | if [ $opsys_adjusted -lt $opsys_start -o $opsys_off -eq 0 ]; then | |
128 | opsys_off=`expr $opsys_off + 1` | |
129 | opsys_adjusted=`expr $opsys_off \* $cylindersize` | |
130 | opsys_size=`expr $opsys_size - $opsys_adjusted + $opsys_start` | |
131 | fi | |
132 | cyls_per_opsys=`expr $opsys_size / $cylindersize` | |
133 | RUN_FDISK="fdisk -u" | |
134 | } | |
135 | ||
136 | ||
137 | set_overwrite_part() { | |
138 | while :; do | |
139 | echo | |
140 | echo -n "Please specify partition to overwrite: [3] " | |
141 | read resp junk | |
142 | opsys_part=${resp:-3} | |
143 | if [ "$opsys_part" -ge 0 -a "$opsys_part" -le 3 ]; then | |
144 | break | |
145 | else | |
146 | echo | |
147 | echo "Partition must be in the range [0-3]" | |
148 | fi | |
149 | done | |
150 | set_existing_part | |
151 | } | |
152 | ||
362925ff | 153 | analyze_fdisk_data() { |
691e6212 AM |
154 | if [ "$part_cnt" -gt 0 ]; then |
155 | echo | |
156 | echo "Partition Offset* Size* Name" | |
157 | echo "--------- ------ ---- ----" | |
158 | i=0 | |
159 | while [ $i -lt $part_cnt ]; do | |
160 | pcyls= | |
161 | poff= | |
162 | eval psize=\$size${i} | |
163 | eval pstart=\$start${i} | |
164 | eval pname=\$sysname${i} | |
165 | [ "$psize" -eq 50000 ] && psize=$disksize | |
166 | if [ "$psize" ]; then | |
167 | poff=`expr $pstart / $cylindersize` | |
168 | padjusted=`expr $poff \* $cylindersize` | |
169 | if [ "$padjusted" -lt "$pstart" ]; then | |
170 | poff=`expr $poff + 1` | |
171 | padjusted=`expr $poff \* $cylindersize` | |
172 | psize=`expr $psize - $padjusted + $pstart` | |
173 | fi | |
174 | pcyls=`expr $psize / $cylindersize` | |
175 | fi | |
176 | echo -n "${i}" | |
177 | echo -n " ${poff:-0}" | |
178 | echo -n " ${pcyls:-0}" | |
179 | echo " ${pname:-(Unused)}" | |
180 | i=`expr $i + 1` | |
181 | done | |
182 | echo "* Sizes and offsets are in units of cylinders." | |
183 | fi | |
362925ff AM |
184 | # Case I: >1024 cylinders |
185 | force_offset= | |
186 | if [ $cyls_per_disk -gt 1024 ]; then | |
187 | echo | |
1f49206c AM |
188 | echo " WARNING: >1024 cylinders. On some hardware, this prevents" |
189 | echo " ${OPSYSTEM} from sharing the disk with other operating systems." | |
691e6212 | 190 | echo -n "Install ${OPSYSTEM} on entire disk, overwriting existing partitions? [n] " |
362925ff | 191 | read resp junk |
362925ff | 192 | case "$resp" in |
f078e99d | 193 | y*|Y*) |
730f2c4e | 194 | RUN_FDISK="" |
362925ff | 195 | force_offset=1 |
730f2c4e AM |
196 | opsys_off=0 |
197 | cyls_per_opsys=${cyls_per_disk} | |
198 | opsys_part=${unused_last_part:-3} | |
199 | return 0 | |
362925ff AM |
200 | ;; |
201 | *) | |
21a421ff | 202 | echo |
730f2c4e | 203 | echo "If the number of disk cylinders does not exceed 1024, then ${OPSYSTEM}" |
362925ff | 204 | echo "can be installed alongside other operating systems on a single disk." |
730f2c4e AM |
205 | echo "Otherwise, it is system-dependent whether this will work or not." |
206 | echo "In the worst case, ${OPSYSTEM} MUST be installed at the beginning of" | |
207 | echo "the disk, and existing partitions will be lost." | |
208 | echo | |
209 | echo "For now, we will assume that >1024 cylinders creates no problems..." | |
210 | # FALL THROUGH | |
362925ff AM |
211 | ;; |
212 | esac | |
730f2c4e | 213 | fi |
362925ff | 214 | # Case II: no partitions used |
730f2c4e | 215 | if [ $sysid_cnt -eq 0 ]; then |
362925ff | 216 | echo |
1f49206c AM |
217 | echo " WARNING: partition table is either missing or corrupt." |
218 | echo " Existing partitions will be lost." | |
362925ff AM |
219 | part_cnt=${part_cnt:-4} |
220 | RUN_FDISK="overwrite" | |
221 | opsys_off=1 | |
222 | cyls_per_opsys=`expr ${cyls_per_disk} - 1` | |
223 | opsys_part=${unused_last_part:-3} | |
224 | return 0 | |
225 | # Case IIIa: overwrite an existing 386BSD/NetBSD/FreeBSD partition | |
226 | elif [ "$have_opsys_part" ]; then | |
227 | echo | |
228 | echo "386/Net/FreeBSD partition already exists!" | |
f1002c06 AM |
229 | echo "${OPSYSTEM} cannot be installed alongside an existing BSD partition." |
230 | echo -n "Overwrite existing partition? [y] " | |
362925ff | 231 | read resp junk |
f1002c06 | 232 | case "${resp:-y}" in |
362925ff | 233 | y*|Y*) |
362925ff | 234 | opsys_part=${have_opsys_part} |
691e6212 | 235 | set_existing_part |
362925ff AM |
236 | return 0 |
237 | ;; | |
238 | *) | |
f1002c06 AM |
239 | echo |
240 | echo "Installation aborted. Enter \`halt' to halt the machine." | |
241 | echo "Once the machine has halted, remove the floppy," | |
242 | echo "and press any key to reboot." | |
243 | exit | |
362925ff AM |
244 | ;; |
245 | esac | |
246 | fi | |
247 | ||
248 | # Case IIIb: no partitions available | |
249 | if [ $sysid_cnt -eq $part_cnt -a ! "$have_opsys_part" ]; then | |
250 | echo | |
251 | echo "No unused partitions." | |
362925ff AM |
252 | echo -n "Install $OPSYSTEM and overwrite the entire disk? [n] " |
253 | read resp junk | |
254 | case "$resp" in | |
255 | y*|Y*) | |
256 | # don't use first cylinder! | |
257 | opsys_off=1 | |
258 | cyls_per_opsys=`expr $cyls_per_disk - 1` | |
259 | opsys_part=${unused_last_part} | |
260 | RUN_FDISK="overwrite" | |
362925ff AM |
261 | ;; |
262 | *) | |
691e6212 | 263 | set_overwrite_part |
362925ff AM |
264 | ;; |
265 | esac | |
691e6212 | 266 | return 0 |
362925ff AM |
267 | fi |
268 | ||
269 | ||
270 | # *** CAVEAT *** | |
271 | # $OPSYSTEM installs at the end of the disk. If the | |
272 | # beginning of the disk is free but not the end, install fails! | |
273 | ||
274 | # Assume `fdisk -u' to add $OPSYSTEM in last unused partition for remaining cases | |
275 | opsys_part=${unused_last_part} | |
276 | RUN_FDISK="fdisk -u" | |
277 | mb_sect=`expr 1024 \* 1024 / $bytes_per_sect` | |
278 | disk_minimum=`expr $DISKMIN \* $mb_sect` | |
279 | ||
280 | # Case IV: No room (at end of disk) for mininal install | |
691e6212 | 281 | [ $extent_max -eq 50000 ] && extent_max=$disksize |
362925ff AM |
282 | disk_remaining=`expr $disksize - $extent_max` |
283 | if [ $disk_remaining -lt $disk_minimum ]; then | |
284 | echo | |
285 | echo "Not enough space ($DISKMIN Mb) at end of disk to install $OPSYSTEM." | |
286 | echo -n "Install FreeBSD and overwrite the entire disk? [n] " | |
287 | read resp junk | |
288 | case "$resp" in | |
289 | y*|Y*) | |
290 | # don't use first cylinder! | |
291 | opsys_off=1 | |
292 | cyls_per_opsys=`expr $cyls_per_disk - 1` | |
293 | opsys_part=${unused_last_part} | |
294 | RUN_FDISK="overwrite" | |
f078e99d RG |
295 | ;; |
296 | *) | |
362925ff | 297 | echo |
691e6212 AM |
298 | echo -n "Overwrite an existing partition? [n] " |
299 | read resp junk | |
300 | case "$resp" in | |
301 | y*|Y*) | |
302 | set_overwrite_part | |
303 | ;; | |
304 | *) | |
305 | echo | |
306 | echo " WARNING: To install ${OPSYSTEM}, you're on your own in figuring" | |
307 | echo " out where on the disk it will fit without overwriting another" | |
308 | echo " partition..." | |
309 | # Set defaults assuming there is only one partition at end of disk | |
310 | eval start=\$start${extent_max_part} | |
311 | # don't use first cylinder! | |
312 | opsys_off=1 | |
313 | cyls_per_opsys=`expr $start / $cylindersize - 1` | |
314 | [ $cyls_per_opsys -lt 0 ] && cyls_per_opsys=0 | |
315 | ;; | |
316 | esac | |
f078e99d | 317 | ;; |
362925ff AM |
318 | esac |
319 | return 0 | |
320 | fi | |
321 | ||
322 | # Case V: Room for $OPSYSTEM and partition data okay | |
323 | opsys_off=`expr $extent_max / $cylindersize` | |
324 | opsys_extent=`expr $opsys_off \* $cylindersize` | |
325 | [ $opsys_extent -lt $extent_max ] && opsys_off=`expr $opsys_off + 1` | |
326 | cyls_per_opsys=`expr $cyls_per_disk - $opsys_off` | |
327 | return 0 | |
328 | } | |
329 | ||
330 | put_fdisk_data() { | |
331 | start=$root_offset | |
332 | size=$partition | |
333 | ||
334 | if [ "$RUN_FDISK" = "overwrite" ]; then | |
335 | # How do you overwrite without explicitly editing each entry? | |
336 | ( | |
337 | echo y | |
338 | echo $cyls_per_disk | |
339 | echo $tracks_per_cyl | |
340 | echo $sects_per_track | |
341 | echo y | |
342 | ) >fdisk.script | |
343 | i=0 | |
344 | n=`expr ${part_cnt:-4} - 1` | |
345 | while [ $i -lt $n ]; do | |
346 | echo y | |
347 | echo 0 | |
348 | echo 0 | |
349 | echo 0 | |
350 | echo n | |
351 | echo y | |
352 | i=`expr $i + 1` | |
353 | done >>fdisk.script | |
354 | ( echo y | |
355 | echo ${OPSYSID} | |
356 | echo ${start} | |
357 | echo ${size} | |
358 | echo n | |
359 | echo y | |
360 | echo y | |
361 | echo ${n} | |
362 | echo y | |
363 | echo y | |
364 | ) >>fdisk.script | |
a631d31f | 365 | fdisk -u /dev/r${drivename}d <fdisk.script >/dev/null 2>&1 |
362925ff | 366 | elif [ "$RUN_FDISK" ]; then |
a631d31f | 367 | $RUN_FDISK -${opsys_part:-${unused_last_part:-3}} /dev/r${drivename}d <<-EOF >/dev/null 2>&1 |
362925ff AM |
368 | y |
369 | $cyls_per_disk | |
370 | $tracks_per_cyl | |
371 | $sects_per_track | |
372 | y | |
373 | y | |
374 | ${OPSYSID} | |
375 | ${start} | |
376 | ${size} | |
377 | n | |
378 | y | |
379 | y | |
380 | ${opsys_part:-${unused_last_part:-3}} | |
381 | y | |
382 | y | |
383 | EOF | |
384 | fi | |
385 | ||
386 | } | |
387 | ||
635dcafb RG |
388 | echo |
389 | echo | |
43a91bf9 | 390 | echo "Welcome to ${OPSYSTEM}." |
362925ff | 391 | echo |
43a91bf9 | 392 | echo "This program is designed to help put ${OPSYSTEM} on a hard disk with" |
362925ff AM |
393 | echo "at least $DISKMIN Megabytes of free space." |
394 | echo | |
e72bf634 AM |
395 | echo "Before starting, it is important to know your hard disk's geometry" |
396 | echo "(i.e., number of cylinders, heads and sectors/track). If installing" | |
397 | echo "${OPSYSTEM} on the same disk as another operating system, then the" | |
398 | echo "two systems should use the same geometry. In particular, ${OPSYSTEM}'s" | |
399 | echo "default geometry is inappropriate for MS-DOS. So in this case, the" | |
400 | echo "DOS geometry should be used instead." | |
362925ff | 401 | echo |
e72bf634 AM |
402 | echo "As with anything which modifies a hard drive's contents, this program" |
403 | echo "can cause SIGNIFICANT data loss. We strongly recommend making sure" | |
404 | echo "that the hard drive is backed up before going further with the" | |
405 | echo "installation process." | |
362925ff AM |
406 | echo |
407 | echo -n "Proceed with installation? [y] " | |
408 | read resp junk | |
409 | resp=${resp:-y} | |
410 | case "$resp" in | |
411 | y*|Y*) | |
412 | echo | |
43a91bf9 | 413 | echo "Cool! Let's get to it..." |
362925ff AM |
414 | echo |
415 | echo "If a mistake is made along the way, don't bail out." | |
e72bf634 | 416 | echo "At the end, you have the option of redoing the configuration." |
362925ff AM |
417 | echo "If you really must quit at some point, type <CTRL>+C and" |
418 | echo "enter \`halt' at the command prompt, \`#'." | |
419 | ;; | |
420 | *) | |
421 | echo | |
f1002c06 | 422 | echo "Installation aborted. Enter \`halt' to halt the machine." |
43a91bf9 RG |
423 | echo "Once the machine has halted, remove the floppy," |
424 | echo "and press any key to reboot." | |
362925ff AM |
425 | exit |
426 | ;; | |
f078e99d | 427 | esac |
c5bc0e81 | 428 | |
c29d28fa RG |
429 | mount -u /dev/fd0 / || { |
430 | if mount -u /dev/fd1 / ; then | |
2010ccbf CR |
431 | echo "[Please ignore the above error message, that's normal.]" |
432 | else | |
433 | echo "Oh boy, we're in trouble here: Could not mount floppy read-write." | |
434 | exit 1 | |
435 | fi | |
436 | } | |
362925ff | 437 | sync |
ede9f473 | 438 | verified_install="" |
362925ff | 439 | while [ ! "$verified_install" ]; do # Begin of Big Loop |
ede9f473 | 440 | |
c5bc0e81 RG |
441 | rotdelay="" |
442 | drivename=wd0 | |
443 | drivetype=wd | |
444 | sect_fwd="" | |
362925ff | 445 | echo |
43a91bf9 | 446 | echo "First, we need to know the drive type. This can be can be one of" |
21a421ff | 447 | echo "ESDI, SCSI, ST506, or IDE." |
362925ff AM |
448 | echo -n "Drive type? [${type:-IDE}] " |
449 | read resp junk | |
450 | type=${resp:-${type:-IDE}} | |
f078e99d | 451 | case "$type" in |
362925ff AM |
452 | e*|E*|st*|ST*) |
453 | echo -n "Does it support AUTOMATIC sector remapping? [y] " | |
454 | read remap junk | |
455 | case "$remap" in | |
456 | n*|N*) | |
457 | sect_fwd="sf:" | |
f078e99d | 458 | ;; |
362925ff AM |
459 | esac |
460 | case "$type" in | |
461 | e*|E*) | |
462 | DEFSECT=36 | |
21a421ff | 463 | ;; |
362925ff AM |
464 | esac |
465 | ;; | |
466 | i*|I*) | |
467 | type=ST506 | |
468 | rotdelay="-d 0" | |
469 | ;; | |
470 | sc*|SC*) | |
471 | drivename=sd0 | |
472 | drivetype=sd | |
473 | type=SCSI | |
474 | rotdelay="-d 0" | |
475 | DEFSECT=32 | |
476 | DEFHEAD=64 | |
477 | ;; | |
478 | *) | |
479 | echo "Unknown type. Assuming ST506 with automatic sectoring..." | |
480 | type=ST506 | |
481 | ;; | |
f078e99d | 482 | esac |
362925ff | 483 | echo |
43a91bf9 | 484 | echo "Disk is of device type $drivetype." |
362925ff AM |
485 | if [ ! "$partition" ]; then |
486 | echo | |
635dcafb | 487 | echo "Examining device /dev/r${drivename}d..." |
362925ff AM |
488 | get_fdisk_data |
489 | if [ $? -gt 1 ]; then | |
490 | echo "Hm - we can't seem to read that drive." | |
491 | echo | |
492 | echo -n "Are you sure that $type is the correct type? [n] " | |
493 | read resp | |
494 | case "$resp" in | |
495 | y*|Y*) | |
10b607dd | 496 | echo |
362925ff AM |
497 | echo "Well, since we can't even open it, there isn't much" |
498 | echo "hope for writing a label on it. But you're free" | |
499 | echo "to give it a try. You need to specify the geometry." | |
500 | ;; | |
501 | *) | |
10b607dd | 502 | echo |
f1002c06 | 503 | echo "Oops. Let's start again from the top." |
362925ff AM |
504 | continue |
505 | ;; | |
506 | esac | |
507 | fi | |
508 | fi | |
509 | echo | |
21a421ff AM |
510 | echo "Now we want to build a data base entry in /etc/disktab describing" |
511 | echo "the geometry of the /dev/$drivename disk. The name of the entry" | |
512 | echo "should be descriptive of the disk's type and model. For example," | |
513 | echo "a Maxtor IDE, model 7080 disk might be named \`maxtor7080'." | |
362925ff AM |
514 | echo -n "Disk label name (one word, please)? [${name:-mfr_model}] " |
515 | read resp junk | |
516 | name=${resp:-${name:-mfr_model}} | |
517 | echo | |
e72bf634 AM |
518 | echo "${OPSYSTEM} should use the same hard disk geometry as used by other" |
519 | echo "operating systems on the hard disk." | |
1f49206c AM |
520 | echo -n "Number of bytes per disk sector? [${bytes_per_sect:-512}] " |
521 | read resp junk | |
522 | bytes_per_sect=${resp:-${bytes_per_sect:-512}} | |
523 | echo | |
362925ff AM |
524 | echo -n "Total number of disk cylinders? [${cyls_per_disk:-${DEFCYLN}}] " |
525 | read resp junk | |
526 | cyls_per_disk=${resp:-${cyls_per_disk:-${DEFCYLN}}} | |
527 | echo | |
528 | echo -n "Number of disk heads (i.e., tracks/cylinder)? [${tracks_per_cyl:-${DEFHEAD}}] " | |
529 | read resp junk | |
530 | tracks_per_cyl=${resp:-${tracks_per_cyl:-${DEFHEAD}}} | |
531 | echo | |
532 | echo -n "Number of disk sectors (i.e., sectors/track)? [${sects_per_track:-${DEFSECT}}] " | |
533 | read resp junk | |
534 | sects_per_track=${resp:-${sects_per_track:-${DEFSECT}}} | |
f078e99d RG |
535 | cylindersize=`expr $sects_per_track \* $tracks_per_cyl` |
536 | disksize=`expr $cylindersize \* $cyls_per_disk` | |
21a421ff AM |
537 | mb_sect=`expr 1024 \* 1024 / $bytes_per_sect` |
538 | mb_per_disk=`expr $disksize / $mb_sect` | |
362925ff AM |
539 | opsys_cyls_min=`expr $DISKMIN \* $mb_sect / $cylindersize` |
540 | analyze_fdisk_data | |
541 | if [ $? -eq 0 ]; then | |
542 | partition=`expr $cyls_per_opsys \* $cylindersize` | |
543 | part_offset=`expr $opsys_off \* $cylindersize` | |
21a421ff | 544 | fi |
362925ff AM |
545 | echo |
546 | echo "Disk has a total of $mb_per_disk Mb." | |
547 | echo "The size of the ${OPSYSTEM} portion of the disk must be at least" | |
548 | echo "${opsys_cyls_min} cylinders, and should not exceed $(expr $cyls_per_disk - 1) cylinders." | |
549 | echo "The offset of ${OPSYSTEM} from the beginning of the disk should be at" | |
550 | echo "least 1 cylinder." | |
551 | echo | |
552 | echo "For efficiency, partitions begin and end on cylinder boundaries." | |
553 | echo "If you know the size NN in Megabytes (Mb) of a partition you want, then" | |
554 | echo "use the following formula to determine the number NC of cylinders to use:" | |
555 | echo " NC = integer { ( NN * $mb_sect ) / $cylindersize }" | |
556 | while :; do | |
557 | echo -n "Total size of the ${OPSYSTEM} portion of the disk (in cylinders)? [${cyls_per_opsys:-`expr ${cyls_per_disk} - 1`}] " | |
558 | read resp junk | |
559 | cyls_per_opsys=${resp:-${cyls_per_opsys:-`expr ${cyls_per_disk} - 1`}} | |
560 | partition=`expr $cyls_per_opsys \* $cylindersize` | |
561 | if [ $cyls_per_opsys -lt $cyls_per_disk -a ! "$force_offset" ]; then | |
562 | echo | |
563 | echo -n "Offset of ${OPSYSTEM} from beginning of disk (in cylinders)? [${opsys_off:-1}] " | |
564 | read resp junk | |
565 | opsys_off=${resp:-${opsys_off:-1}} | |
566 | else | |
567 | echo | |
1f49206c AM |
568 | echo " WARNING: Existing partitions will be lost. In addition," |
569 | echo " installing at cylinder 0 may cause problems for some disk" | |
570 | echo " controllers. If the filesystem is corrupted or install" | |
571 | echo " fails, install at cylinder 1." | |
362925ff AM |
572 | RUN_FDISK="" |
573 | cyls_per_opsys=$cyls_per_disk | |
574 | partition=$disksize | |
575 | opsys_off=0 | |
21a421ff | 576 | fi |
362925ff AM |
577 | part_offset=`expr $opsys_off \* $cylindersize` |
578 | opsys_extent=`expr $opsys_off + $cyls_per_opsys` | |
579 | if [ ${opsys_extent} -gt ${cyls_per_disk} ]; then | |
580 | echo | |
581 | echo "${OPSYSTEM} Size + Offset cannot exceed ${cyls_per_disk} cylinders." | |
582 | elif [ ${cyls_per_opsys} -lt ${opsys_cyls_min} ]; then | |
583 | echo | |
584 | echo "${OPSYSTEM} requires at least ${opsys_cyls_min} cylinders to install." | |
585 | else break | |
586 | fi | |
587 | done | |
f078e99d RG |
588 | badspacesec=0 |
589 | if [ "$sect_fwd" = "sf:" ]; then | |
590 | badspacecyl=`expr $sects_per_track + 126` | |
591 | badspacecyl=`expr $badspacecyl + $cylindersize - 1` | |
592 | badspacecyl=`expr $badspacecyl / $cylindersize` | |
593 | badspacesec=`expr $badspacecyl \* $cylindersize` | |
362925ff | 594 | echo |
f078e99d RG |
595 | echo -n "Using $badspacesec sectors ($badspacecyl cylinders) for the " |
596 | echo "bad144 bad block table" | |
597 | fi | |
598 | whats_left=`expr $partition - $badspacesec` | |
599 | cyl_left=`expr $whats_left / $cylindersize` | |
21a421ff | 600 | mb_left=`expr $whats_left / $mb_sect` |
362925ff AM |
601 | swap_cyls_min=`expr $SWAPMIN \* $mb_sect / $cylindersize` |
602 | root_cyls_max=`expr ${cyl_left} - ${swap_cyls_min}` | |
603 | root_cyls_min=`expr $ROOTMIN \* $mb_sect / $cylindersize` | |
604 | echo | |
605 | echo "There are $mb_left Mb ($cyl_left cylinders) to allocate." | |
606 | echo | |
607 | echo "The $OPSYSTEM portion of the disk must itself be divided into at least" | |
608 | echo "two partitions: one for the root filesystem and one for swap. It is a" | |
609 | echo "good idea to have at least a third (large) $OPSYSTEM partition for the /usr" | |
610 | echo "filesystem." | |
611 | echo | |
612 | echo "The root partition cannot exceed ${root_cyls_max} cylinders. It is usually" | |
613 | echo "no larger than about 15 Mb ($(expr 15 \* $mb_sect / $cylindersize) cylinders), and sometimes" | |
614 | echo "as small as $ROOTMIN Mb ($root_cyls_min cylinders)." | |
615 | if [ ! "$cyls_per_root" ]; then | |
616 | # set default root partition to 15MB | |
617 | cyls_per_root=`expr \( 15 \* $mb_sect \) / $cylindersize` | |
4c569b4c AM |
618 | usr_cyls_max=`expr ${root_cyls_max} - ${cyls_per_root}` |
619 | mb_usr=`expr ${usr_cyls_max} \* $cylindersize / $mb_sect` | |
620 | [ $cyls_per_root -gt $root_cyls_max -o $mb_usr -lt $USRMIN ] && | |
621 | cyls_per_root=$root_cyls_max | |
21a421ff | 622 | fi |
362925ff AM |
623 | while :; do |
624 | echo -n "Root partition size (in cylinders)? [${cyls_per_root}] " | |
625 | read resp junk | |
626 | cyls_per_root=${resp:-${cyls_per_root}} | |
627 | root=`expr $cyls_per_root \* $cylindersize` | |
628 | if [ ${cyls_per_root} -gt ${root_cyls_max} ]; then | |
629 | echo | |
630 | echo "The root partition size cannot exceed $root_cyls_max cylinders." | |
631 | elif [ ${cyls_per_root} -lt ${root_cyls_min} ]; then | |
632 | echo | |
633 | echo "The root partition size must be at least $root_cyls_min cylinders." | |
634 | else | |
635 | part_used=`expr $root + $badspacesec` | |
636 | break | |
21a421ff | 637 | fi |
f078e99d RG |
638 | done |
639 | root_offset=$part_offset | |
640 | whats_left=`expr $partition - $part_used` | |
21a421ff AM |
641 | cyl_left=`expr $whats_left / $cylindersize` |
642 | mb_left=`expr $whats_left / $mb_sect` | |
362925ff | 643 | echo |
0d255f16 RG |
644 | # DO NOT USE DIFFERENT BLOCKING FACTORS FOR EACH PARITION.. IT TRASHES THE |
645 | # VM SYSTEM! When that gets fixed this can go back the way it was... | |
646 | # | |
647 | echo "We can build the filesystems with block/fragment sizes of either" | |
21a421ff AM |
648 | echo " 1) 4k/512, to save disk space at the expense of speed, or" |
649 | echo " 2) 8k/1k for speed at the expense of disk space." | |
0d255f16 | 650 | echo -n "Which blocking factor should we use for the filesystems? " |
362925ff AM |
651 | echo -n "[${blocking_factor:-${DEFBLOCKING}}] " |
652 | read resp junk | |
653 | blocking_factor=${resp:-${blocking_factor:-${DEFBLOCKING}}} | |
21a421ff AM |
654 | fragsize=`expr $bytes_per_sect \* $blocking_factor` |
655 | blocksize=`expr $bytes_per_sect \* $blocking_factor \* 8` | |
362925ff | 656 | echo |
43a91bf9 | 657 | echo "$mb_left Mb ($cyl_left cylinders) remaining in ${OPSYSTEM} portion of disk." |
362925ff AM |
658 | echo |
659 | echo "Minimum swap space is ${swap_cyls_min} cylinders." | |
660 | echo "For running X, if your RAM size is NR Mb, then the recomended swap" | |
661 | echo "size NS (in cylinders) is:" | |
662 | echo " NS = integer { ( NR x `expr 21 \* $mb_sect / 10` ) / ${cylindersize} }" | |
663 | if [ ! "$swap_cyl" ]; then | |
21a421ff AM |
664 | # guess memory size |
665 | mb_ram=16 | |
362925ff AM |
666 | swap_cyl=`expr \( 21 \* $mb_ram \* $mb_sect \) / 10` |
667 | swap_cyl=`expr $swap_cyl / ${cylindersize}` | |
21a421ff AM |
668 | |
669 | # but not swap size more than 10% of disk size... | |
670 | swap_quot=`expr $mb_left / $mb_ram` | |
671 | if [ $swap_quot -lt 10 ]; then | |
362925ff | 672 | swap_cyl=$swap_cyls_min |
21a421ff | 673 | fi |
362925ff AM |
674 | fi |
675 | while :; do | |
676 | echo -n "Swap partition size (in cylinders)? [${swap_cyl}] " | |
677 | read resp junk | |
678 | swap_cyl=${resp:-${swap_cyl}} | |
679 | swap=`expr $swap_cyl \* $cylindersize` | |
680 | if [ ${swap_cyl} -gt ${cyl_left} ]; then | |
681 | echo | |
682 | echo "Swap size cannot exceed $cyl_left cylinders." | |
683 | elif [ ${swap_cyl} -lt ${swap_cyls_min} ]; then | |
684 | echo | |
685 | echo "Swap size must be at least ${swap_cyls_min} cylinders." | |
686 | else | |
687 | break | |
21a421ff | 688 | fi |
f078e99d | 689 | done |
f078e99d RG |
690 | swap_offset=`expr $root_offset + $root` |
691 | part_used=`expr $part_used + $swap` | |
43a91bf9 RG |
692 | echo "" >/etc/disktab |
693 | echo "$name|${OPSYSTEM} installation generated:\\" >>/etc/disktab | |
694 | echo " :dt=${type}:ty=winchester:\\" >>/etc/disktab | |
f078e99d | 695 | echo -n " :nc#${cyls_per_disk}:ns#${sects_per_track}" >>/etc/disktab |
43a91bf9 RG |
696 | echo ":nt#${tracks_per_cyl}:\\" >>/etc/disktab |
697 | echo " :se#${bytes_per_sect}:${sect_fwd}\\" >>/etc/disktab | |
f078e99d | 698 | echo -n " :pa#${root}:oa#${root_offset}" >>/etc/disktab |
43a91bf9 RG |
699 | echo ":ta=4.2BSD:ba#${blocksize}:fa#${fragsize}:\\" >>/etc/disktab |
700 | echo " :pb#${swap}:ob#${swap_offset}:tb=swap:\\" >>/etc/disktab | |
701 | echo " :pc#${partition}:oc#${part_offset}:\\" >>/etc/disktab | |
f078e99d | 702 | ename="";fname="";gname="";hname="" |
362925ff AM |
703 | if [ $part_used -lt $partition ]; then |
704 | echo | |
705 | echo "Now we enter information about any other partitions and filesystems" | |
706 | echo "to be created in the ${OPSYSTEM} portion of the disk. This process" | |
707 | echo "is complete when we've filled up all remaining space in the ${OPSYSTEM}" | |
708 | echo "portion of the disk." | |
709 | fi | |
f078e99d RG |
710 | while [ $part_used -lt $partition ]; do |
711 | part_size=0 | |
712 | whats_left=`expr $partition - $part_used` | |
21a421ff AM |
713 | cyl_left=`expr $whats_left / $cylindersize` |
714 | mb_left=`expr $whats_left / $mb_sect` | |
362925ff | 715 | echo |
43a91bf9 | 716 | echo "$mb_left Mb ($cyl_left cylinders) remaining in ${OPSYSTEM} portion of disk." |
362925ff AM |
717 | echo |
718 | while :; do | |
21a421ff | 719 | echo -n "Next partition size (in cylinders)? [${cyl_left}] " |
362925ff AM |
720 | read resp junk |
721 | part_size=${resp:-${cyl_left}} | |
722 | part_size=`expr $part_size \* $cylindersize` | |
723 | total=`expr $part_used + $part_size` | |
724 | if [ $total -gt $partition ]; then | |
725 | echo | |
726 | echo "Partition size cannot exceed ${cyl_left} cylinders." | |
727 | else | |
728 | part_used=$total | |
729 | part_name="" | |
730 | while [ "$part_name" = "" ]; do | |
731 | echo | |
732 | echo -n "On which directory should this filesystem be mounted? [usr] " | |
733 | read resp junk | |
734 | part_name=${resp:-usr} | |
52617f4e | 735 | part_name=`expr X"$part_name" : 'X/*\(.*\)'` |
362925ff AM |
736 | done |
737 | break | |
21a421ff | 738 | fi |
f078e99d | 739 | done |
362925ff | 740 | if [ ! "$ename" ]; then |
f078e99d RG |
741 | ename=$part_name |
742 | offset=`expr $part_offset + $root + $swap` | |
743 | echo -n " :pe#${part_size}:oe#${offset}" >>/etc/disktab | |
744 | echo ":te=4.2BSD:be#${blocksize}:fe#${fragsize}:\\" >>/etc/disktab | |
745 | offset=`expr $offset + $part_size` | |
362925ff | 746 | elif [ ! "$fname" ]; then |
f078e99d RG |
747 | fname=$part_name |
748 | echo -n " :pf#${part_size}:of#${offset}" >>/etc/disktab | |
749 | echo ":tf=4.2BSD:bf#${blocksize}:ff#${fragsize}:\\" >>/etc/disktab | |
750 | offset=`expr $offset + $part_size` | |
362925ff | 751 | elif [ ! "$gname" ]; then |
f078e99d RG |
752 | gname=$part_name |
753 | echo -n " :pg#${part_size}:og#${offset}" >>/etc/disktab | |
754 | echo ":tg=4.2BSD:bg#${blocksize}:fg#${fragsize}:\\" >>/etc/disktab | |
755 | offset=`expr $offset + $part_size` | |
362925ff | 756 | elif [ ! "$hname" ]; then |
f078e99d RG |
757 | hname=$part_name |
758 | echo -n " :ph#${part_size}:oh#${offset}" >>/etc/disktab | |
759 | echo ":th=4.2BSD:bh#${blocksize}:fh#${fragsize}:\\" >>/etc/disktab | |
760 | part_used=partition | |
761 | fi | |
762 | done | |
5cb436ef AM |
763 | if [ "$have_dos_part" -a "$have_dos_part" != "$opsys_part" -a \ |
764 | "$RUN_FDISK" != "overwrite" -a ! "$hname" ]; then | |
52617f4e AM |
765 | echo |
766 | echo "There appears to be a MS-DOS filesystem on the hard disk." | |
767 | echo -n "Make this be accessible from ${OPSYSTEM}? [y] " | |
768 | read resp junk | |
769 | case "${resp:-y}" in | |
770 | y*|Y*) | |
771 | part_name="" | |
772 | while [ "$part_name" = "" ]; do | |
773 | echo | |
774 | echo -n "On which directory should this filesystem be mounted? [dos] " | |
775 | read resp junk | |
776 | part_name=${resp:-dos} | |
777 | part_name=`expr X"$part_name" : 'X/*\(.*\)'` | |
778 | done | |
779 | hname=$part_name | |
780 | eval offset=\$start${have_dos_part} | |
781 | eval part_size=\$size${have_dos_part} | |
782 | echo -n " :ph#${part_size}:oh#${offset}" >>/etc/disktab | |
783 | echo ":th=MSDOS:\\" >>/etc/disktab | |
784 | part_used=partition | |
785 | ;; | |
786 | *) | |
787 | have_dos_part="" | |
788 | ;; | |
789 | esac | |
4c569b4c AM |
790 | else |
791 | have_dos_part="" | |
792 | fi | |
43a91bf9 | 793 | echo " :pd#${disksize}:od#0:" >>/etc/disktab |
f078e99d RG |
794 | sync |
795 | ||
362925ff AM |
796 | # cat /etc/disktab |
797 | OIFS=$IFS | |
798 | IFS=' | |
799 | ' | |
800 | while read data; do | |
801 | echo $data | |
802 | done < /etc/disktab | |
803 | IFS=$OIFS | |
804 | ||
805 | echo | |
8231ed99 RG |
806 | echo -n "Verbose installation? [n] " |
807 | read resp | |
808 | ||
809 | case $resp in | |
362925ff AM |
810 | y*) |
811 | cpioverbose=v | |
812 | ;; | |
813 | *) | |
814 | cpioverbose= | |
815 | ;; | |
8231ed99 RG |
816 | esac |
817 | ||
362925ff AM |
818 | |
819 | echo | |
f1002c06 | 820 | echo "THIS IS THE LAST CHANCE!!! Data on the hard disk will be lost!" |
21a421ff | 821 | echo -n "Are you sure you want to install on the hard drive? (yes/no) " |
362925ff AM |
822 | resp="" |
823 | while [ ! "$resp" ]; do | |
824 | read resp junk | |
825 | case "$resp" in | |
826 | Yes|yes|YES) | |
827 | verified_install=1 | |
828 | echo | |
f1002c06 | 829 | echo "Here we go..." |
362925ff AM |
830 | ;; |
831 | No|no|NO) | |
832 | echo | |
833 | echo -n "Would you like to change the configuration? [y] " | |
834 | read resp junk | |
835 | resp=${resp:-y} | |
836 | case "$resp" in | |
837 | y*|Y*) | |
f078e99d RG |
838 | ;; |
839 | *) | |
362925ff | 840 | echo |
f1002c06 | 841 | echo "Installation aborted. Enter 'halt' to halt the machine." |
43a91bf9 RG |
842 | echo "Once the machine has halted, remove the floppy," |
843 | echo "and press any key to reboot." | |
362925ff | 844 | exit |
f078e99d | 845 | ;; |
362925ff AM |
846 | esac |
847 | ;; | |
848 | *) | |
849 | echo "Please spell out either of \`yes' or \`no'..." | |
850 | echo -n "Install on the hard disk? (yes/no) " | |
851 | resp= | |
852 | ;; | |
f078e99d RG |
853 | esac |
854 | done | |
ede9f473 AM |
855 | done # End of Big Loop |
856 | ||
362925ff AM |
857 | put_fdisk_data |
858 | ||
859 | echo | |
f078e99d | 860 | echo -n "Labelling disk..." |
362925ff AM |
861 | echo y | |
862 | /sbin/disklabel -w -r ${drivename} $name /usr/mdec/${drivetype}boot /usr/mdec/boot${drivetype} >/dev/null 2>&1 | |
43a91bf9 | 863 | echo " done." |
f078e99d | 864 | |
00bf7f83 | 865 | # XXX - Do it again, incase we disklabeled sector 0! |
635dcafb | 866 | # XXX - this is not working for some reason, need to look at it closer! |
00bf7f83 RG |
867 | put_fdisk_data |
868 | ||
f078e99d RG |
869 | if [ "$sect_fwd" = "sf:" ]; then |
870 | echo -n "Initializing bad144 badblock table..." | |
871 | bad144 $drivename 0 | |
872 | echo " done." | |
362925ff AM |
873 | echo "Updating badblock table..." |
874 | # `2>&1 >/dev/null' filters stdout and leaves only stderr... | |
1f49206c | 875 | badlist=$(bad144 -s $drivename 2>&1 >/dev/null | |
362925ff | 876 | while read data; do |
1f49206c AM |
877 | bad_seek=$(expr "$data" : '[^(]*(seek)[^0-9]*\([0-9]*\)') |
878 | bad_read=$(expr "$data" : '[^(]*(read)[^0-9]*\([0-9]*\)') | |
362925ff | 879 | [ "$bad_seek" -o "$bad_read" ] && echo -n "$bad_seek $bad_read " |
1f49206c AM |
880 | done) |
881 | [ "$badlist" ] && bad144 -a -c $drivename "$badlist" | |
362925ff | 882 | echo " done." |
f078e99d RG |
883 | fi |
884 | ||
43a91bf9 | 885 | echo "Initializing root filesystem, and mounting..." |
c5bc0e81 | 886 | newfs ${rotdelay} /dev/r${drivename}a $name |
f078e99d RG |
887 | mount -v /dev/${drivename}a /mnt |
888 | if [ "$ename" != "" ]; then | |
362925ff | 889 | echo |
43a91bf9 | 890 | echo "Initializing $ename filesystem, and mounting..." |
c5bc0e81 | 891 | newfs ${rotdelay} /dev/r${drivename}e $name |
f078e99d RG |
892 | mkdir -p /mnt/$ename |
893 | mount -v /dev/${drivename}e /mnt/$ename | |
894 | fi | |
895 | if [ "$fname" != "" ]; then | |
362925ff | 896 | echo |
43a91bf9 | 897 | echo "Initializing $fname filesystem, and mounting..." |
c5bc0e81 | 898 | newfs ${rotdelay} /dev/r${drivename}f $name |
f078e99d RG |
899 | mkdir -p /mnt/$fname |
900 | mount -v /dev/${drivename}f /mnt/$fname | |
901 | fi | |
902 | if [ "$gname" != "" ]; then | |
362925ff | 903 | echo |
43a91bf9 | 904 | echo "Initializing $gname filesystem, and mounting..." |
c5bc0e81 | 905 | newfs ${rotdelay} /dev/r${drivename}g $name |
f078e99d RG |
906 | mkdir -p /mnt/$gname |
907 | mount -v /dev/${drivename}g /mnt/$gname | |
908 | fi | |
909 | if [ "$hname" != "" ]; then | |
362925ff | 910 | echo |
4c569b4c AM |
911 | if [ ! "$have_dos_part" ]; then |
912 | echo "Initializing $hname filesystem, and mounting..." | |
913 | newfs ${rotdelay} /dev/r${drivename}h $name | |
914 | else | |
915 | echo "Initializing $hname filesystem..." | |
916 | fi | |
f078e99d | 917 | mkdir -p /mnt/$hname |
4c569b4c | 918 | [ ! "$have_dos_part" ] && |
f078e99d RG |
919 | mount -v /dev/${drivename}h /mnt/$hname |
920 | fi | |
921 | ||
8231ed99 | 922 | echo |
635dcafb | 923 | echo -n "Copying to disk... " |
f078e99d | 924 | cd / |
635dcafb RG |
925 | cpio -pdamu${cpioverbose} /mnt <filelist |
926 | echo -n "Copying more to disk... " | |
f078e99d | 927 | cd /mnt |
635dcafb RG |
928 | gzcat < /inst1.cpio.gz | cpio -idmu |
929 | ||
930 | echo -n "Building /etc/fstab... " | |
931 | echo "proc /proc procfs rw 0 0" >etc/fstab | |
2847e70e RG |
932 | echo "/dev/${drivename}b none swap sw 0 0" >>etc/fstab |
933 | echo "/dev/${drivename}a / ufs rw 1 1" >>etc/fstab | |
f078e99d | 934 | if [ "$ename" != "" ]; then |
c5bc0e81 | 935 | echo "/dev/${drivename}e /$ename ufs rw 1 2" >>etc/fstab |
f078e99d RG |
936 | fi |
937 | if [ "$fname" != "" ]; then | |
c5bc0e81 | 938 | echo "/dev/${drivename}f /$fname ufs rw 1 3" >>etc/fstab |
f078e99d RG |
939 | fi |
940 | if [ "$gname" != "" ]; then | |
c5bc0e81 | 941 | echo "/dev/${drivename}g /$gname ufs rw 1 4" >>etc/fstab |
f078e99d RG |
942 | fi |
943 | if [ "$hname" != "" ]; then | |
4c569b4c AM |
944 | if [ ! "$have_dos_part" ]; then |
945 | echo "/dev/${drivename}h /$hname ufs rw 1 5" >>etc/fstab | |
946 | else | |
635dcafb | 947 | echo "/dev/${drivename}h /$hname pcfs ro 0 0" >>etc/fstab |
4c569b4c | 948 | fi |
f078e99d RG |
949 | fi |
950 | ||
362925ff AM |
951 | # cat /etc/disktab >etc/disktab.install |
952 | OIFS=$IFS | |
953 | IFS=' | |
954 | ' | |
955 | while read data; do | |
956 | echo $data | |
957 | done </etc/disktab >etc/disktab.install | |
958 | IFS=$OIFS | |
635dcafb | 959 | echo "done." |
0d255f16 | 960 | |
635dcafb | 961 | echo -n "Building /etc/rc... " |
362925ff | 962 | ( |
635dcafb | 963 | echo "PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin:/usr/distbin:" |
362925ff AM |
964 | echo "export PATH" |
965 | echo "HOME=/root" | |
966 | echo "export HOME" | |
967 | echo "TERM=pc3" | |
968 | echo "export TERM" | |
969 | echo "mount -at ufs" | |
970 | echo "echo" | |
635dcafb | 971 | echo "echo" |
a8a6c1e9 | 972 | echo "echo \"Insert cpio installation floppy in drive and\"" |
52617f4e | 973 | echo "echo -n \"enter that drive's number (0 or 1): [0] \"" |
362925ff AM |
974 | echo "read resp junk" |
975 | echo "driveno=\${resp:-0}" | |
00bf7f83 | 976 | echo "mount -o ro /dev/fd\${driveno} /mnt" |
362925ff AM |
977 | echo "cd /mnt" |
978 | echo "install" | |
730f2c4e AM |
979 | echo "cd /" |
980 | echo "umount /mnt >/dev/null 2>&1" | |
981 | echo "echo" | |
83dff685 | 982 | echo "echo -n \"Install optional dos floppy? [n] \"" |
730f2c4e | 983 | echo "read resp junk" |
83dff685 | 984 | echo "case \"\$resp\" in" |
53c2fade | 985 | echo "y*|Y*)" |
83dff685 | 986 | echo " echo" |
52617f4e AM |
987 | echo " echo \"Remove cpio floppy from drive, insert dos floppy, and\"" |
988 | echo " echo -n \"enter that drive's number (0 or 1): [0] \"" | |
83dff685 AM |
989 | echo " read resp junk" |
990 | echo " driveno=\${resp:-0}" | |
00bf7f83 | 991 | echo " mount -t pcfs -o ro /dev/fd\${driveno} /mnt" |
83dff685 | 992 | echo " mkdir -p /usr/distbin" |
5ae4c83e | 993 | echo " cp /mnt/* /usr/distbin/ >/dev/null 2>&1" |
83dff685 AM |
994 | echo " sync" |
995 | echo " umount /mnt >/dev/null 2>&1" | |
996 | echo " ;;" | |
997 | echo "esac" | |
730f2c4e | 998 | echo "echo" |
43a91bf9 | 999 | echo "echo \"OK. All of the base files are installed.\"" |
730f2c4e | 1000 | echo "echo" |
39087e97 AM |
1001 | echo "echo \"The next step: reboot from the hard disk. Further\"" |
1002 | echo "echo \"instructions are presented upon rebooting.\"" | |
730f2c4e | 1003 | echo "echo" |
39087e97 AM |
1004 | echo "echo \"Enter 'halt' now at the prompt to halt the machine.\"" |
1005 | echo "echo \"After the machine has halted, remove the floppy from the disk\"" | |
730f2c4e | 1006 | echo "echo \"drive, and hit any key to reboot from the hard disk.\"" |
635dcafb RG |
1007 | echo "exit 1" |
1008 | ) >etc/rc | |
1009 | echo "done." | |
f078e99d RG |
1010 | |
1011 | sync | |
1012 | ||
362925ff | 1013 | echo |
43a91bf9 RG |
1014 | echo "The next step: reboot from the kernel-copy disk, copy a kernel" |
1015 | echo "to the hard disk, and finally reboot from the hard disk." | |
362925ff | 1016 | echo |
39087e97 | 1017 | echo "To do this, enter \`halt' now to halt the machine. After it" |
21a421ff AM |
1018 | echo "announces that it has halted, remove the floppy from the drive" |
1019 | echo "and insert the kernel-copy disk that was booted before." | |
730f2c4e AM |
1020 | echo "Press any key to reboot. When prompted to insert the filesystem" |
1021 | echo "floppy this time, just hit RETURN without changing floppies." | |
362925ff AM |
1022 | echo |
1023 | echo "If all goes well, you can enter the command \`copy' at the prompt to" | |
1024 | echo "copy the kernel to the hard disk. When asked for which partition to" | |
635dcafb | 1025 | echo "copy to, enter \`${drivename}a' (without the quotes)." |
362925ff | 1026 | echo |
21a421ff | 1027 | echo "Okay, that's all for now. I'm waiting for you to enter \`halt'..." |
635dcafb RG |
1028 | |
1029 | sync;sync;sync;sync | |
1030 |