install.sh revision 1.5 1 1.1 lukem #!/bin/sh
2 1.5 abs # $NetBSD: install.sh,v 1.5 2009/09/16 10:40:02 abs Exp $
3 1.1 lukem #
4 1.1 lukem # Copyright (c) 1997 Perry E. Metzger
5 1.1 lukem # Copyright (c) 1994 Christopher G. Demetriou
6 1.1 lukem # All rights reserved.
7 1.1 lukem #
8 1.1 lukem # Redistribution and use in source and binary forms, with or without
9 1.1 lukem # modification, are permitted provided that the following conditions
10 1.1 lukem # are met:
11 1.1 lukem # 1. Redistributions of source code must retain the above copyright
12 1.1 lukem # notice, this list of conditions and the following disclaimer.
13 1.1 lukem # 2. Redistributions in binary form must reproduce the above copyright
14 1.1 lukem # notice, this list of conditions and the following disclaimer in the
15 1.1 lukem # documentation and/or other materials provided with the distribution.
16 1.1 lukem # 3. All advertising materials mentioning features or use of this software
17 1.1 lukem # must display the following acknowledgement:
18 1.1 lukem # This product includes software developed for the
19 1.3 salo # NetBSD Project. See http://www.NetBSD.org/ for
20 1.1 lukem # information about NetBSD.
21 1.1 lukem # 4. The name of the author may not be used to endorse or promote products
22 1.1 lukem # derived from this software without specific prior written permission.
23 1.1 lukem #
24 1.1 lukem # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
25 1.1 lukem # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
26 1.1 lukem # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
27 1.1 lukem # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
28 1.1 lukem # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
29 1.1 lukem # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30 1.1 lukem # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31 1.1 lukem # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 1.1 lukem # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
33 1.1 lukem # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 1.1 lukem #
35 1.1 lukem # <<Id: LICENSE,v 1.2 2000/06/14 15:57:33 cgd Exp>>
36 1.1 lukem
37 1.1 lukem # NetBSD installation script.
38 1.1 lukem # In a perfect world, this would be a nice C program, with a reasonable
39 1.1 lukem # user interface.
40 1.1 lukem
41 1.1 lukem DT=/etc/disktab # /etc/disktab
42 1.1 lukem FSTABDIR=/mnt/etc # /mnt/etc
43 1.1 lukem #DONTDOIT=echo
44 1.1 lukem ASYNC="-o async"
45 1.1 lukem
46 1.1 lukem FSTAB=${FSTABDIR}/fstab
47 1.1 lukem
48 1.1 lukem getresp() {
49 1.1 lukem read resp
50 1.1 lukem if [ "X$resp" = "X" ]; then
51 1.1 lukem resp=$1
52 1.1 lukem fi
53 1.1 lukem }
54 1.1 lukem
55 1.1 lukem echo "Welcome to the original NetBSD/alpha installation program."
56 1.1 lukem echo ""
57 1.1 lukem echo "This version of the program has been largely replaced by the new
58 1.1 lukem echo "sysinst utility. Both programs are on this installation media set.
59 1.1 lukem echo -n "Type the return key to continue..."
60 1.1 lukem getresp
61 1.1 lukem echo "This program is designed to help you put NetBSD on your hard disk,"
62 1.1 lukem echo "in a simple and rational way. You'll be asked several questions,"
63 1.1 lukem echo "and it would probably be useful to have your disk's hardware"
64 1.1 lukem echo "manual, the installation notes, and a calculator handy."
65 1.1 lukem echo ""
66 1.1 lukem echo "In particular, you will need to know some reasonably detailed"
67 1.1 lukem echo "information about your disk's geometry, because there is currently"
68 1.4 simonb echo "no way this program can figure that information out."
69 1.1 lukem echo ""
70 1.1 lukem echo "As with anything which modifies your hard drive's contents, this"
71 1.1 lukem echo "program can cause SIGNIFICANT data loss, and you are advised"
72 1.1 lukem echo "to make sure your hard drive is backed up before beginning the"
73 1.1 lukem echo "installation process."
74 1.1 lukem echo ""
75 1.1 lukem echo "Default answers are displyed in brackets after the questions."
76 1.1 lukem echo "You can hit Control-C at any time to quit, but if you do so at a"
77 1.1 lukem echo "prompt, you may have to hit return. Also, quitting in the middle of"
78 1.1 lukem echo "installation may leave your system in an inconsistent state."
79 1.1 lukem echo ""
80 1.1 lukem echo -n "Proceed with installation? [n] "
81 1.1 lukem getresp "n"
82 1.1 lukem case "$resp" in
83 1.1 lukem y*|Y*)
84 1.1 lukem echo "Cool! Let's get to it..."
85 1.1 lukem ;;
86 1.1 lukem *)
87 1.1 lukem echo ""
88 1.1 lukem echo "OK, then. Enter 'halt' at the prompt to halt the"
89 1.1 lukem echo "machine. Once the machine has halted, remove the"
90 1.1 lukem echo "floppy and press any key to reboot."
91 1.1 lukem exit
92 1.1 lukem ;;
93 1.1 lukem esac
94 1.1 lukem
95 1.1 lukem echo ""
96 1.1 lukem echo "To do the installation, you'll need to provide some information about"
97 1.1 lukem echo "your disk."
98 1.1 lukem echo ""
99 1.1 lukem echo "NetBSD can be installed on ST506, ESDI, IDE, or SCSI disks."
100 1.1 lukem echo -n "What kind of disk will you be installing on? [SCSI] "
101 1.1 lukem getresp "SCSI"
102 1.1 lukem case "$resp" in
103 1.1 lukem esdi|ESDI|st506|ST506)
104 1.1 lukem drivetype=wd
105 1.1 lukem echo -n "Does it support _automatic_ sector remapping? [y] "
106 1.1 lukem getresp "y"
107 1.1 lukem case "$resp" in
108 1.1 lukem n*|N*)
109 1.1 lukem sect_fwd="sf:"
110 1.1 lukem ;;
111 1.1 lukem *)
112 1.1 lukem sect_fwd=""
113 1.1 lukem ;;
114 1.1 lukem esac
115 1.1 lukem ;;
116 1.1 lukem ide|IDE)
117 1.1 lukem drivetype=wd
118 1.1 lukem sect_fwd=""
119 1.1 lukem type=ST506
120 1.1 lukem ;;
121 1.1 lukem scsi|SCSI)
122 1.1 lukem drivetype=sd
123 1.1 lukem sect_fwd=""
124 1.1 lukem type=SCSI
125 1.1 lukem ;;
126 1.1 lukem esac
127 1.1 lukem
128 1.1 lukem # find out what units are possible for that disk, and query the user.
129 1.1 lukem driveunits=`echo /dev/${drivetype}?a | sed -e 's,/dev/\(...\)a,\1,g'`
130 1.1 lukem if [ "X${driveunits}" = "X" ]; then
131 1.1 lukem echo "FATAL ERROR:"
132 1.1 lukem echo "No devices for disks of type '${drivetype}'."
133 1.1 lukem echo "This is probably a bug in the install disks."
134 1.1 lukem echo "Exiting install program."
135 1.1 lukem exit
136 1.1 lukem fi
137 1.1 lukem prefdrive=${drivetype}0
138 1.1 lukem
139 1.1 lukem echo ""
140 1.1 lukem echo "The following ${drivetype}-type disks are supported by this"
141 1.1 lukem echo "installation procedure:"
142 1.1 lukem echo " "${driveunits}
143 1.1 lukem echo "Note that they may not exist in _your_ machine; the list of"
144 1.1 lukem echo "disks in your machine was printed when the system was booting."
145 1.1 lukem echo ""
146 1.1 lukem while [ "X${drivename}" = "X" ]; do
147 1.1 lukem echo -n "Which disk would like to install on? [${prefdrive}] "
148 1.1 lukem getresp ${prefdrive}
149 1.1 lukem otherdrives=`echo "${driveunits}" | sed -e s,${resp},,`
150 1.1 lukem if [ "X${driveunits}" = "X${otherdrives}" ]; then
151 1.1 lukem echo ""
152 1.1 lukem echo "\"${resp}\" is an invalid drive name. Valid choices"
153 1.1 lukem echo "are: "${driveunits}
154 1.1 lukem echo ""
155 1.1 lukem else
156 1.1 lukem drivename=${resp}
157 1.1 lukem fi
158 1.1 lukem done
159 1.1 lukem
160 1.1 lukem echo ""
161 1.1 lukem echo "Using disk ${drivename}."
162 1.1 lukem echo ""
163 1.1 lukem echo -n "What kind of disk is it? (one word please) [my${drivetype}] "
164 1.1 lukem getresp "my${drivetype}"
165 1.1 lukem labelname=$resp
166 1.1 lukem
167 1.1 lukem echo ""
168 1.1 lukem echo "You will now need to provide some information about your disk's"
169 1.1 lukem echo "geometry. This should either be in the User's Manual for your disk,"
170 1.1 lukem echo "or you should have written down what NetBSD printed when booting."
171 1.1 lukem echo "(Note that he geometry that's printed at boot time is preferred.)"
172 1.1 lukem echo ""
173 1.1 lukem echo "You may choose to view the initial boot messages for your system"
174 1.1 lukem echo "again right now if you like."
175 1.1 lukem echo -n "View the boot messages again? [n] "
176 1.1 lukem getresp "n"
177 1.1 lukem case "$resp" in
178 1.1 lukem y*|Y*)
179 1.5 abs dmesg | more
180 1.1 lukem ;;
181 1.1 lukem *)
182 1.1 lukem echo ""
183 1.1 lukem ;;
184 1.1 lukem esac
185 1.1 lukem
186 1.1 lukem echo ""
187 1.1 lukem echo "You will now enter the disk geometry information"
188 1.1 lukem echo ""
189 1.1 lukem
190 1.1 lukem echo -n "Number of bytes per disk sector? [512] "
191 1.1 lukem getresp 512
192 1.1 lukem bytes_per_sect="$resp"
193 1.1 lukem
194 1.1 lukem echo -n "Number of disk cylinders? "
195 1.1 lukem getresp
196 1.1 lukem cyls_per_disk="$resp"
197 1.1 lukem
198 1.1 lukem echo -n "Number of disk tracks (heads) per disk cylinder? "
199 1.1 lukem getresp
200 1.1 lukem tracks_per_cyl="$resp"
201 1.1 lukem
202 1.1 lukem echo -n "Number of disk sectors per disk track? "
203 1.1 lukem getresp
204 1.1 lukem sects_per_track="$resp"
205 1.1 lukem
206 1.1 lukem cylindersize=$(( $sects_per_track * $tracks_per_cyl ))
207 1.1 lukem cylbytes=$(( $cylindersize * $bytes_per_sect ))
208 1.1 lukem disksize=$(( $cylindersize * $cyls_per_disk ))
209 1.1 lukem
210 1.1 lukem echo ""
211 1.1 lukem echo "Your disk has a total of $disksize $bytes_per_sect byte sectors,"
212 1.1 lukem echo "arranged as $cyls_per_disk cylinders which contain $cylindersize "
213 1.1 lukem echo "sectors ($cylbytes bytes) each."
214 1.1 lukem echo ""
215 1.1 lukem echo "You can specify partition sizes in cylinders ('c') or sectors ('s')."
216 1.1 lukem while [ "X${sizemult}" = "X" ]; do
217 1.1 lukem echo -n "What units would you like to use? [cylinders] "
218 1.1 lukem getresp cylinders
219 1.1 lukem case "$resp" in
220 1.1 lukem c*|C*)
221 1.1 lukem sizemult=$cylindersize
222 1.1 lukem sizeunit="cylinders"
223 1.1 lukem ;;
224 1.1 lukem s*|S*)
225 1.1 lukem sizemult=1
226 1.1 lukem sizeunit="sectors"
227 1.1 lukem ;;
228 1.1 lukem *)
229 1.1 lukem echo ""
230 1.1 lukem echo "Enter cylinders ('c') or sectors ('s')."
231 1.1 lukem ;;
232 1.1 lukem esac
233 1.1 lukem done
234 1.1 lukem
235 1.1 lukem if [ $sizeunit = "sectors" ]; then
236 1.1 lukem echo ""
237 1.1 lukem echo "For best disk performance, partitions should begin and end on"
238 1.1 lukem echo "cylinder boundaries. Wherever possible, pick sizes that are"
239 1.1 lukem echo "multiples of the cylinder size ($cylindersize sectors)."
240 1.1 lukem fi
241 1.1 lukem
242 1.1 lukem partition_sects=$disksize
243 1.1 lukem partition=$(( $disksize / $sizemult ))
244 1.1 lukem part_offset=0
245 1.1 lukem
246 1.1 lukem badspacesec=0
247 1.1 lukem if [ "$sect_fwd" = "sf:" ]; then
248 1.1 lukem badspacecyl=$(( $sects_per_track + 126 ))
249 1.1 lukem badspacecyl=$(( $badspacecyl + $cylindersize - 1 ))
250 1.1 lukem badspacecyl=$(( $badspacecyl / $cylindersize ))
251 1.1 lukem badspacesec=$(( $badspacecyl * $cylindersize ))
252 1.1 lukem echo ""
253 1.1 lukem echo -n "Using $badspacesec sectors ($badspacecyl cylinders) for the "
254 1.1 lukem echo "bad144 bad block table"
255 1.1 lukem fi
256 1.1 lukem
257 1.1 lukem sects_left=$(( $partition_sects - $badspacesec ))
258 1.1 lukem units_left=$(( $sects_left / $sizemult ))
259 1.1 lukem echo ""
260 1.1 lukem echo "There are $units_left $sizeunit left to allocate."
261 1.1 lukem echo ""
262 1.1 lukem root=0
263 1.1 lukem while [ $root -eq 0 ]; do
264 1.1 lukem echo -n "Root partition size (in $sizeunit)? "
265 1.1 lukem getresp
266 1.1 lukem case $resp in
267 1.1 lukem [1-9]*)
268 1.1 lukem total=$resp
269 1.1 lukem if [ $total -gt $units_left ]; then
270 1.1 lukem echo -n "Root size is greater than remaining "
271 1.1 lukem echo "free space on disk."
272 1.1 lukem else
273 1.1 lukem root=$resp
274 1.1 lukem fi
275 1.1 lukem ;;
276 1.1 lukem esac
277 1.1 lukem done
278 1.1 lukem root_offset=$part_offset
279 1.1 lukem part_used=$(( $root + $badspacesec / $sizemult ))
280 1.1 lukem units_left=$(( $partition - $part_used ))
281 1.1 lukem echo ""
282 1.1 lukem
283 1.1 lukem swap=0
284 1.1 lukem while [ $swap -eq 0 ]; do
285 1.1 lukem echo "$units_left $sizeunit remaining in NetBSD portion of disk."
286 1.1 lukem echo -n "Swap partition size (in $sizeunit)? "
287 1.1 lukem getresp
288 1.1 lukem case $resp in
289 1.1 lukem [1-9]*)
290 1.1 lukem if [ $swap -gt $units_left ]; then
291 1.1 lukem echo -n "Swap size is greater than remaining "
292 1.1 lukem echo "free space on disk."
293 1.1 lukem else
294 1.1 lukem swap=$resp
295 1.1 lukem fi
296 1.1 lukem ;;
297 1.1 lukem esac
298 1.1 lukem done
299 1.1 lukem swap_offset=$(( $root_offset + $root ))
300 1.1 lukem part_used=$(( $part_used + $swap ))
301 1.1 lukem echo ""
302 1.1 lukem
303 1.1 lukem fragsize=1024
304 1.1 lukem blocksize=8192
305 1.1 lukem
306 1.1 lukem cat /etc/disktab.preinstall > $DT
307 1.1 lukem echo "" >> $DT
308 1.1 lukem echo "$labelname|NetBSD installation generated:\\" >> $DT
309 1.1 lukem echo " :dt=${type}:ty=winchester:\\" >> $DT
310 1.1 lukem echo -n " :nc#${cyls_per_disk}:ns#${sects_per_track}" >> $DT
311 1.1 lukem echo ":nt#${tracks_per_cyl}:\\" >> $DT
312 1.1 lukem echo " :se#${bytes_per_sect}:${sect_fwd}\\" >> $DT
313 1.1 lukem _size=$(( $root * $sizemult ))
314 1.1 lukem _offset=$(( $root_offset * $sizemult ))
315 1.1 lukem echo -n " :pa#${_size}:oa#${_offset}" >> $DT
316 1.1 lukem echo ":ta=4.2BSD:ba#${blocksize}:fa#${fragsize}:\\" >> $DT
317 1.1 lukem _size=$(( $swap * $sizemult ))
318 1.1 lukem _offset=$(( $swap_offset * $sizemult ))
319 1.1 lukem echo " :pb#${_size}:ob#${_offset}:tb=swap:\\" >> $DT
320 1.1 lukem _size=$(( $partition * $sizemult ))
321 1.1 lukem _offset=$(( $part_offset * $sizemult ))
322 1.1 lukem echo " :pc#${_size}:oc#${_offset}:\\" >> $DT
323 1.1 lukem
324 1.1 lukem echo "You will now have to enter information about any other partitions"
325 1.1 lukem echo "to be created in the NetBSD portion of the disk. This process will"
326 1.1 lukem echo "be complete when you've filled up all remaining space in the NetBSD"
327 1.1 lukem echo "portion of the disk."
328 1.1 lukem
329 1.1 lukem while [ $part_used -lt $partition ]; do
330 1.1 lukem part_size=0
331 1.1 lukem units_left=$(( $partition - $part_used ))
332 1.1 lukem while [ $part_size -eq 0 ]; do
333 1.1 lukem echo ""
334 1.1 lukem echo -n "$units_left $sizeunit remaining in NetBSD portion of "
335 1.1 lukem echo "the disk"
336 1.1 lukem echo -n "Next partition size (in $sizeunit)? "
337 1.1 lukem getresp
338 1.1 lukem case $resp in
339 1.1 lukem [1-9]*)
340 1.1 lukem total=$(( $part_used + $resp ))
341 1.1 lukem if [ $total -gt $partition ]; then
342 1.1 lukem echo -n "That would make the parition"
343 1.1 lukem echo "too large to fit!"
344 1.1 lukem else
345 1.1 lukem part_size=$resp
346 1.1 lukem part_used=$total
347 1.1 lukem part_name=""
348 1.1 lukem while [ "$part_name" = "" ]; do
349 1.1 lukem echo -n "Mount point? "
350 1.1 lukem getresp
351 1.1 lukem part_name=$resp
352 1.1 lukem done
353 1.1 lukem fi
354 1.1 lukem ;;
355 1.1 lukem esac
356 1.1 lukem done
357 1.1 lukem if [ "$dname" = "" ]; then
358 1.1 lukem dname=$part_name
359 1.1 lukem offset=$(( $part_offset + $root + $swap ))
360 1.1 lukem _size=$(( $part_size * $sizemult ))
361 1.1 lukem _offset=$(( $offset * $sizemult ))
362 1.1 lukem echo -n " :pd#${_size}:od#${_offset}" >> $DT
363 1.1 lukem echo ":td=4.2BSD:bd#${blocksize}:fd#${fragsize}:\\" >> $DT
364 1.1 lukem offset=$(( $offset + $part_size ))
365 1.1 lukem elif [ "$ename" = "" ]; then
366 1.1 lukem ename=$part_name
367 1.1 lukem _size=$(( $part_size * $sizemult ))
368 1.1 lukem _offset=$(( $offset * $sizemult ))
369 1.1 lukem echo -n " :pe#${_size}:oe#${_offset}" >> $DT
370 1.1 lukem echo ":te=4.2BSD:be#${blocksize}:fe#${fragsize}:\\" >> $DT
371 1.1 lukem offset=$(( $offset + $part_size ))
372 1.1 lukem elif [ "$fname" = "" ]; then
373 1.1 lukem fname=$part_name
374 1.1 lukem _size=$(( $part_size * $sizemult ))
375 1.1 lukem _offset=$(( $offset * $sizemult ))
376 1.1 lukem echo -n " :pf#${_size}:of#${_offset}" >> $DT
377 1.1 lukem echo ":tf=4.2BSD:bf#${blocksize}:ff#${fragsize}:\\" >> $DT
378 1.1 lukem offset=$(( $offset + $part_size ))
379 1.1 lukem elif [ "$gname" = "" ]; then
380 1.1 lukem gname=$part_name
381 1.1 lukem _size=$(( $part_size * $sizemult ))
382 1.1 lukem _offset=$(( $offset * $sizemult ))
383 1.1 lukem echo -n " :pg#${_size}:og#${_offset}" >> $DT
384 1.1 lukem echo ":tg=4.2BSD:bg#${blocksize}:fg#${fragsize}:\\" >> $DT
385 1.1 lukem offset=$(( $offset + $part_size ))
386 1.1 lukem elif [ "$hname" = "" ]; then
387 1.1 lukem hname=$part_name
388 1.1 lukem _size=$(( $part_size * $sizemult ))
389 1.1 lukem _offset=$(( $offset * $sizemult ))
390 1.1 lukem echo -n " :ph#${_size}:oh#${_offset}" >> $DT
391 1.1 lukem echo ":th=4.2BSD:bh#${blocksize}:fh#${fragsize}:\\" >> $DT
392 1.1 lukem part_used=$partition
393 1.1 lukem fi
394 1.1 lukem done
395 1.1 lukem echo >> $DT
396 1.1 lukem sync
397 1.1 lukem
398 1.1 lukem echo ""
399 1.1 lukem echo "THIS IS YOUR LAST CHANCE!!!"
400 1.1 lukem echo ""
401 1.1 lukem echo -n "Are you SURE you want NetBSD installed on your hard drive? (yes/no) "
402 1.1 lukem answer=""
403 1.1 lukem while [ "$answer" = "" ]; do
404 1.1 lukem getresp
405 1.1 lukem case $resp in
406 1.1 lukem yes|YES)
407 1.1 lukem echo ""
408 1.1 lukem echo "Here we go..."
409 1.1 lukem answer=yes
410 1.1 lukem ;;
411 1.1 lukem no|NO)
412 1.1 lukem echo ""
413 1.1 lukem echo -n "OK, then. enter 'halt' to halt the machine. "
414 1.1 lukem echo "Once the machine has halted,"
415 1.1 lukem echo -n "remove the floppy, and press any key to "
416 1.1 lukem echo "reboot."
417 1.1 lukem exit
418 1.1 lukem ;;
419 1.1 lukem *)
420 1.1 lukem echo -n "I want a yes or no answer... well? "
421 1.1 lukem ;;
422 1.1 lukem esac
423 1.1 lukem done
424 1.1 lukem
425 1.1 lukem echo ""
426 1.1 lukem echo -n "Labeling disk $drivename..."
427 1.1 lukem $DONTDOIT disklabel -w -r $drivename $labelname
428 1.1 lukem echo " done."
429 1.1 lukem
430 1.1 lukem if [ "$sect_fwd" = "sf:" ]; then
431 1.1 lukem echo -n "Initializing bad144 badblock table..."
432 1.1 lukem $DONTDOIT bad144 $drivename 0
433 1.1 lukem echo " done."
434 1.1 lukem fi
435 1.1 lukem
436 1.1 lukem echo "Initializing root filesystem, and mounting..."
437 1.1 lukem $DONTDOIT newfs /dev/r${drivename}a $name
438 1.1 lukem $DONTDOIT mount -v $ASYNC /dev/${drivename}a /mnt
439 1.1 lukem if [ "$dname" != "" ]; then
440 1.1 lukem echo ""
441 1.1 lukem echo "Initializing $dname filesystem, and mounting..."
442 1.1 lukem $DONTDOIT newfs /dev/r${drivename}d $name
443 1.1 lukem $DONTDOIT mkdir -p /mnt/$dname
444 1.1 lukem $DONTDOIT mount -v $ASYNC /dev/${drivename}d /mnt/$dname
445 1.1 lukem fi
446 1.1 lukem if [ "$ename" != "" ]; then
447 1.1 lukem echo ""
448 1.1 lukem echo "Initializing $ename filesystem, and mounting..."
449 1.1 lukem $DONTDOIT newfs /dev/r${drivename}e $name
450 1.1 lukem $DONTDOIT mkdir -p /mnt/$ename
451 1.1 lukem $DONTDOIT mount -v $ASYNC /dev/${drivename}e /mnt/$ename
452 1.1 lukem fi
453 1.1 lukem if [ "$fname" != "" ]; then
454 1.1 lukem echo ""
455 1.1 lukem echo "Initializing $fname filesystem, and mounting..."
456 1.1 lukem $DONTDOIT newfs /dev/r${drivename}f $name
457 1.1 lukem $DONTDOIT mkdir -p /mnt/$fname
458 1.1 lukem $DONTDOIT mount -v $ASYNC /dev/${drivename}f /mnt/$fname
459 1.1 lukem fi
460 1.1 lukem if [ "$gname" != "" ]; then
461 1.1 lukem echo ""
462 1.1 lukem echo "Initializing $gname filesystem, and mounting..."
463 1.1 lukem $DONTDOIT newfs /dev/r${drivename}g $name
464 1.1 lukem $DONTDOIT mkdir -p /mnt/$gname
465 1.1 lukem $DONTDOIT mount -v $ASYNC /dev/${drivename}g /mnt/$gname
466 1.1 lukem fi
467 1.1 lukem if [ "$hname" != "" ]; then
468 1.1 lukem echo ""
469 1.1 lukem echo "Initializing $hname filesystem, and mounting..."
470 1.1 lukem $DONTDOIT newfs /dev/r${drivename}h $name
471 1.1 lukem $DONTDOIT mkdir -p /mnt/$hname
472 1.1 lukem $DONTDOIT mount -v $ASYNC /dev/${drivename}h /mnt/$hname
473 1.1 lukem fi
474 1.1 lukem
475 1.1 lukem echo ""
476 1.1 lukem echo "Populating filesystems with bootstrapping binaries and config files"
477 1.1 lukem $DONTDOIT pax -Xrwpe . /mnt
478 1.1 lukem $DONTDOIT cp /tmp/.hdprofile /mnt/.profile
479 1.1 lukem
480 1.1 lukem echo ""
481 1.1 lukem echo -n "Creating an fstab..."
482 1.1 lukem echo /dev/${drivename}a / ffs rw 1 1 | sed -e s,//,/, > $FSTAB
483 1.1 lukem echo /dev/${drivename}b none swap sw 0 0 | sed -e s,//,/, >> $FSTAB
484 1.1 lukem if [ "$dname" != "" ]; then
485 1.1 lukem echo /dev/${drivename}d /$dname ffs rw 1 2 | sed -e s,//,/, >> $FSTAB
486 1.1 lukem fi
487 1.1 lukem if [ "$ename" != "" ]; then
488 1.1 lukem echo /dev/${drivename}e /$ename ffs rw 1 2 | sed -e s,//,/, >> $FSTAB
489 1.1 lukem fi
490 1.1 lukem if [ "$fname" != "" ]; then
491 1.1 lukem echo /dev/${drivename}f /$fname ffs rw 1 3 | sed -e s,//,/, >> $FSTAB
492 1.1 lukem fi
493 1.1 lukem if [ "$gname" != "" ]; then
494 1.1 lukem echo /dev/${drivename}g /$gname ffs rw 1 4 | sed -e s,//,/, >> $FSTAB
495 1.1 lukem fi
496 1.1 lukem if [ "$hname" != "" ]; then
497 1.1 lukem echo /dev/${drivename}h /$hname ffs rw 1 5 | sed -e s,//,/, >> $FSTAB
498 1.1 lukem fi
499 1.1 lukem sync
500 1.1 lukem echo " done."
501 1.1 lukem
502 1.1 lukem echo ""
503 1.1 lukem echo -n "Installing boot blocks on $drivename..."
504 1.1 lukem $DONTDOIT rm -f /mnt/boot
505 1.1 lukem $DONTDOIT cp /usr/mdec/boot /mnt/boot
506 1.2 lukem $DONTDOIT /usr/sbin/installboot /dev/r${drivename}c /usr/mdec/bootxx_ffs
507 1.1 lukem echo " done."
508 1.1 lukem
509 1.1 lukem
510 1.1 lukem echo ""
511 1.1 lukem echo ""
512 1.1 lukem echo "OK! The preliminary work of setting up your disk is now complete."
513 1.1 lukem echo ""
514 1.1 lukem echo "The remaining tasks are:"
515 1.1 lukem echo ""
516 1.1 lukem echo "To load and install the NetBSD distribution sets."
517 1.1 lukem echo "Currently the hard drive's root filesystem is mounted on /mnt"
518 1.1 lukem echo ""
519 1.1 lukem echo "To copy a NetBSD kernel to the hard drive's root filesystem."
520 1.1 lukem echo "Once accomplished, you can boot off the hard drive."
521 1.1 lukem echo ""
522 1.1 lukem echo "Consult the installation notes which will describe how to"
523 1.1 lukem echo "install the distribution sets and kernel. Post-installation"
524 1.1 lukem echo "configuration is also discussed therein."
525 1.1 lukem echo ""
526 1.1 lukem echo "GOOD LUCK!"
527 1.1 lukem echo ""
528