3 # $NetBSD: install.md,v 1.4 2003/03/07 17:00:22 he Exp $
5 # Copyright (c) 1996 The NetBSD Foundation, Inc.
8 # This code is derived from software contributed to The NetBSD Foundation
11 # Redistribution and use in source and binary forms, with or without
12 # modification, are permitted provided that the following conditions
14 # 1. Redistributions of source code must retain the above copyright
15 # notice, this list of conditions and the following disclaimer.
16 # 2. Redistributions in binary form must reproduce the above copyright
17 # notice, this list of conditions and the following disclaimer in the
18 # documentation and/or other materials provided with the distribution.
20 # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
21 # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
24 # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 # POSSIBILITY OF SUCH DAMAGE.
34 # machine dependent section of installation/upgrade script
37 # Machine-dependent install sets
41 if [ ! -z "$TERM" ]; then
44 echo -n "Specify terminal type [vt100]: "
52 # Make sure kernfs is mounted.
53 if [ ! -d /kern
-o ! -e /kern
/msgbuf
]; then
54 mkdir
/kern
> /dev
/null
2>&1
55 /sbin
/mount_kernfs
/kern
/kern
>/dev
/null
2>&1
59 md_makerootwritable
() {
60 # Just remount the root device read-write.
62 echo "Remounting root read-write..."
63 mount
-t ffs
-u /kern
/rootdev
/
67 # return available disk devices
69 sed -n -e '/^sd[0-9] /s/ .*//p' \
70 < /kern
/msgbuf |
sort -u
74 # return available CDROM devices
76 sed -n -e '/^cd[0-9] /s/ .*//p' \
77 < /kern
/msgbuf |
sort -u
81 # return available network devices
83 sed -n -e '/^le[0-9] /s/ .*//p' \
84 -e '/^ie[0-9] /s/ .*//p' \
85 < /kern
/msgbuf |
sort -u
88 md_get_partition_range
() {
89 # return an expression describing the valid partition id's
94 # install the boot block on disk $1
95 echo "Installing boot block..."
97 cp -p .
/bootsd
/mnt
/.bootsd
;\
98 sync
; sleep 1 ; sync
;\
99 .
/installboot
-v /mnt
/.bootsd bootxx
/dev
/r
${1}a
)
111 awk 'BEGIN{ es=1; } /'"$pattern"'/{ print; es=0; } END{ exit es; }' "$@"
114 md_checkfordisklabel
() {
115 # $1 is the disk to check
118 disklabel
$1 > /dev
/null
2> /tmp
/checkfordisklabel
119 if grep_check
"no disklabel" /tmp
/checkfordisklabel
; then
121 elif grep_check
"disk label corrupted" /tmp
/checkfordisklabel
; then
127 rm -f /tmp
/checkfordisklabel
136 md_checkfordisklabel
$_disk
139 echo -n "Do you wish to edit the disklabel on $_disk? [y]"
142 echo "WARNING: Disk $_disk has no label"
143 echo -n "Do you want to create one with the disklabel editor? [y]"
146 echo "WARNING: Label on disk $_disk is corrupted"
147 echo -n "Do you want to try and repair the damage using the disklabel editor? [y]"
158 cat << \__md_prep_disklabel_1
160 Here is an example of what the partition information will
look like once
161 you have entered the disklabel editor. Disk partition sizes and offsets
162 are
in sector
(most likely
512 bytes
) units. Make sure these size
/offset
163 pairs are on cylinder boundaries
(the number of sector per cylinder is
164 given
in the
`sectors/cylinder' entry, which is not shown here).
166 Do not change any parameters except the partition layout and the label name.
167 It's probably also wisest not to touch the `8 partitions
:' line, even
168 in case you have defined less than eight partitions.
172 # size offset fstype [fsize bsize cpg]
173 a: 50176 0 4.2BSD 1024 8192 16 # (Cyl. 0 - 111)
174 b: 64512 50176 swap # (Cyl. 112 - 255)
175 c: 640192 0 unknown # (Cyl. 0 - 1428)
176 d: 525504 114688 4.2BSD 1024 8192 16 # (Cyl. 256 - 1428)
179 __md_prep_disklabel_1
180 echo -n "Press [Enter] to continue "
182 edlabel /dev/r${_disk}c
186 echo -n "Copying kernel..."
187 cp -p /netbsd /mnt/netbsd
191 md_welcome_banner() {
192 echo "Welcome to the NetBSD/mvme68k ${VERSION} installation program."
193 cat << \__welcome_banner_1
195 This program is designed to help you install NetBSD on your system in a simple
196 and rational way. You'll be asked several questions
, and it would probably be
197 useful to have your disk
's hardware manual, the installation notes, and a
200 In particular, you will need to know some reasonably detailed information
201 about your disk's geometry. The kernel will attempt to display geometry
202 information
for SCSI disks during boot
, if possible. If you did not
make it
203 note of it before
, you may wish to reboot and
jot down your disk
's geometry
206 As with anything which modifies your hard disk's contents
, this program can
207 cause SIGNIFICANT data loss
, and you are advised to
make sure your hard drive
208 is backed up before beginning the installation process.
210 Default answers are displyed
in brackets after the questions. You can hit
211 Control-C
at any
time to quit
, but
if you
do so
at a prompt
, you may have to
212 hit
return. Also
, quitting
in the middle of installation may leave your
213 system
in an inconsistent state.
217 md_not_going_to_install
() {
218 cat << \__not_going_to_install_1
220 OK
, then. Enter
'halt' at the prompt to halt the machine. Once the
221 machine has halted
, power-cycle the system to load new boot code.
223 __not_going_to_install_1
227 cat << \__congratulations_1
229 CONGRATULATIONS
! You have successfully installed NetBSD
! To boot the
230 installed system
, enter halt
at the
command prompt. Once the system has
231 halted
, power-cycle the machine
in order to load new boot code. Make sure
232 you boot from the root disk.