Expand PMF_FN_* macros.
[netbsd-mini2440.git] / distrib / mvme68k / miniroot / install.md
blob7b03e04b1976059cf090e5bf043eb61a84aea295
1 #!/bin/sh
3 # $NetBSD: install.md,v 1.4 2003/03/07 17:00:22 he Exp $
5 # Copyright (c) 1996 The NetBSD Foundation, Inc.
6 # All rights reserved.
8 # This code is derived from software contributed to The NetBSD Foundation
9 # by Jason R. Thorpe.
11 # Redistribution and use in source and binary forms, with or without
12 # modification, are permitted provided that the following conditions
13 # are met:
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
38 MDSETS=""
40 md_set_term() {
41 if [ ! -z "$TERM" ]; then
42 return
44 echo -n "Specify terminal type [vt100]: "
45 getresp "vt100"
46 TERM="$resp"
47 export TERM
48 # XXX call tset?
51 __mount_kernfs() {
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.
61 __mount_kernfs
62 echo "Remounting root read-write..."
63 mount -t ffs -u /kern/rootdev /
66 md_get_diskdevs() {
67 # return available disk devices
68 __mount_kernfs
69 sed -n -e '/^sd[0-9] /s/ .*//p' \
70 < /kern/msgbuf | sort -u
73 md_get_cddevs() {
74 # return available CDROM devices
75 __mount_kernfs
76 sed -n -e '/^cd[0-9] /s/ .*//p' \
77 < /kern/msgbuf | sort -u
80 md_get_ifdevs() {
81 # return available network devices
82 __mount_kernfs
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
90 echo '[a-h]'
93 md_installboot() {
94 # install the boot block on disk $1
95 echo "Installing boot block..."
96 ( cd /usr/mdec ;\
97 cp -p ./bootsd /mnt/.bootsd ;\
98 sync ; sleep 1 ; sync ;\
99 ./installboot -v /mnt/.bootsd bootxx /dev/r${1}a )
100 echo "done."
103 md_native_fstype() {
106 md_native_fsopts() {
109 grep_check () {
110 pattern=$1; shift
111 awk 'BEGIN{ es=1; } /'"$pattern"'/{ print; es=0; } END{ exit es; }' "$@"
114 md_checkfordisklabel() {
115 # $1 is the disk to check
116 local rval
118 disklabel $1 > /dev/null 2> /tmp/checkfordisklabel
119 if grep_check "no disklabel" /tmp/checkfordisklabel; then
120 rval=1
121 elif grep_check "disk label corrupted" /tmp/checkfordisklabel; then
122 rval=2
123 else
124 rval=0
127 rm -f /tmp/checkfordisklabel
128 return $rval
131 md_prep_disklabel()
133 local _disk
135 _disk=$1
136 md_checkfordisklabel $_disk
137 case $? in
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]"
149 esac
151 getresp "y"
152 case "$resp" in
153 y*|Y*) ;;
154 *) return ;;
155 esac
157 # display example
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.
170 [Example]
171 8 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)
177 [End of example]
179 __md_prep_disklabel_1
180 echo -n "Press [Enter] to continue "
181 getresp ""
182 edlabel /dev/r${_disk}c
185 md_copy_kernel() {
186 echo -n "Copying kernel..."
187 cp -p /netbsd /mnt/netbsd
188 echo "done."
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
198 calculator handy.
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
204 before proceeding.
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.
214 __welcome_banner_1
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
226 md_congrats() {
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.
234 __congratulations_1
237 md_native_fstype() {
238 # Nothing to do.
241 md_native_fsopts() {
242 # Nothing to do.