2 # $NetBSD: install.sh,v 1.8 2000/06/14 17:24:11 cgd Exp $
4 # Copyright (c) 1994 Christopher G. Demetriou
7 # Redistribution and use in source and binary forms, with or without
8 # modification, are permitted provided that the following conditions
10 # 1. Redistributions of source code must retain the above copyright
11 # notice, this list of conditions and the following disclaimer.
12 # 2. Redistributions in binary form must reproduce the above copyright
13 # notice, this list of conditions and the following disclaimer in the
14 # documentation and/or other materials provided with the distribution.
15 # 3. All advertising materials mentioning features or use of this software
16 # must display the following acknowledgement:
17 # This product includes software developed for the
18 # NetBSD Project. See http://www.NetBSD.org/ for
19 # information about NetBSD.
20 # 4. The name of the author may not be used to endorse or promote products
21 # derived from this software without specific prior written permission.
23 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
24 # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
25 # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26 # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
27 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
28 # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
32 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 # <<Id: LICENSE,v 1.2 2000/06/14 15:57:33 cgd Exp>>
36 # NetBSD installation script.
37 # In a perfect world, this would be a nice C program, with a reasonable
40 FSTABDIR
=/mnt
/etc
# /mnt/etc
44 FSTAB
=${FSTABDIR}/fstab
48 if [ "X$resp" = "X" ]; then
54 echo $
(eval $
(echo "echo \$$1"))
67 disklabel
$1 2>/dev
/null |
sed -e '/^[ ][ ][ad-p]/!d' |
68 sed -e 's,^[ ]*\([a-p]\):[ ]*[0-9]*[ ]*[0-9]*[ ][ ]*\([a-zA-Z0-9.]*\).*,\1 \2,' |
76 for du
in /dev
/r
${drivetype}?a
; do
77 dd if=$du of
=/dev
/null bs
=1b count
=1 >/dev
/null
2>&1
79 thisunit
=`echo $du | sed -e 's,/dev/r\(...\)a,\1,g'`
80 driveunits
="$driveunits $thisunit"
84 setvar
$thisunit "$(getparts $thisunit)"
91 echo "which drive would you like to prepare next?"
92 echo "choices are: ${driveunits}"
100 echo "Welcome to the NetBSD ${VERSION} installation program."
102 echo "This program is designed to help you put NetBSD on your hard disk,"
103 echo "in a simple and rational way. Its main objective is to format,"
104 echo "mount and create an fstab for your root (/) and user (/usr)"
107 echo "As with anything which modifies your hard drive's contents, this"
108 echo "program can cause SIGNIFICANT data loss, and you are advised"
109 echo "to make sure your hard drive is backed up before beginning the"
110 echo "installation process."
112 echo "Default answers are displayed in brackets after the questions."
113 echo "You can hit Control-C at any time to quit, but if you do so at a"
114 echo "prompt, you may have to hit return. Also, quitting in the middle of"
115 echo "installation may leave your system in an inconsistent state."
117 echo -n "Proceed with installation? [n] "
121 echo "scanning for the root device"
125 echo "OK, then. Enter 'halt' at the prompt to halt the"
126 echo "machine. Once the machine has halted, remove the"
127 echo "floppy and press any key to reboot."
135 # find out what units are possible for that disk, and query the user.
137 for du
in $driveunits; do
139 if [ $# -ge 2 -a "$1" = "a" -a "`echo $2 | sed -e 's,.*BSD.*,BSD,'`" = "BSD" ]; then
145 echo "The following root devices are available on your machine:"
146 echo " "${driveunits}
150 while [ "X${rdev}" = "X" ]; do
151 echo -n "Which device would you like to install on ? [${prefdev}] "
153 otherdrives
=`echo "${driveunits}" | sed -e s,${resp},,`
154 if [ "X${driveunits}" = "X${otherdrives}" ]; then
156 echo "\"${resp}\" is an invalid drive name. Valid choices"
157 echo "are: "${driveunits}
164 echo "The root device you have chosen is on: ${rdev}"
166 # driveunits=`ls /dev/${drivetype}?a | sed -e 's,/dev/\(...\)a,\1,g'`
167 if [ "X${driveunits}" = "X" ]; then
169 echo "No devices for disks of type '${drivetype}'."
170 echo "This is probably a bug in the install disks."
171 echo "Exiting install program."
176 echo "THIS IS YOUR LAST CHANCE!!!"
178 echo "(answering yes will format your root partition on $rdev)"
179 echo -n "Are you SURE you want NetBSD installed on your hard drive? (yes/no) "
181 while [ "$answer" = "" ]; do
190 echo -n "OK, then. enter 'halt' to halt the machine. "
191 echo "Once the machine has halted,"
192 echo -n "remove the floppy, and press any key to "
197 echo -n "I want a yes or no answer... well? "
201 echo "Initializing / (root) filesystem, and mounting..."
202 $DONTDOIT newfs
/dev
/r
${rdev}a
$name
203 $DONTDOIT mount
-v /dev
/${rdev}a
/mnt
205 echo -n "Creating a fstab..."
207 echo "/dev/${rdev}a / ffs rw 1 1" > $FSTAB
209 # get rid of this partition
214 echo "Now lets setup your /usr file system"
215 echo "(Once a valid input for drive and partition is seen"
216 echo "it will be FORMATTED and inserted in the fstab.)"
217 while [ "X$usrpart" = "X" ]; do
220 while [ "X$resp" = "X" ]; do
221 echo "choices: $driveunits"
222 echo "which drive do you want /usr on?"
225 while [ $# -gt 0 ]; do
226 if [ "X$resp" = "X$1" ]; then
233 if [ "X$drivename" != "X" ]; then
239 echo "You have selected $drivename"
240 echo "here is a list of partitions on $drivename"
241 disklabel
$drivename 2>/dev
/null |
sed -e '/^[ ][ ][ad-p]:/p;/^#[ \t]*size/p;d'
242 echo "which partition would you like to format and have"
243 echo -n "mounted as /usr? (supply the letter): "
245 if [ "X$resp" = "X" ]; then
249 list
=$
(getvar
$drivename)
251 while [ $# -gt 0 ]; do
252 if [ "$resp" = "$1" ]; then
253 if [ "`echo $2 | sed -e 's,.*BSD.*,BSD,'`" != "BSD" ]; then
255 echo -n "$drivename$resp is of type $2 which is not"
256 echo " a BSD filesystem type"
259 usrpart
=$drivename$resp
266 if [ "X$usrpart" = "X" ]; then
267 echo "$resp is not a valid input."
273 echo "Initializing /usr filesystem, and mounting..."
274 $DONTDOIT newfs
/dev
/r
${usrpart} $name
275 $DONTDOIT mkdir
-p /mnt
/usr
276 $DONTDOIT mount
-v /dev
/${usrpart} /mnt
/usr
278 echo -n "Adding to fstab..."
279 echo "/dev/${usrpart} /usr ffs rw 1 2" >> $FSTAB
284 echo "OK! The preliminary work of setting up your disk is now complete,"
285 echo "and you can install the actual NetBSD software."
287 echo "Right now, your root is mounted on /mnt and your usr on /mnt/usr."
288 echo "You should consult the installation notes to determine how to load"
289 echo "and install the NetBSD distribution sets, and how to configure your"
290 echo "system when you are done."