1 # $NetBSD: install.md,v 1.4 2004/01/17 05:30:02 lukem Exp $
4 # Copyright (c) 1996 The NetBSD Foundation, Inc.
7 # This code is derived from software contributed to The NetBSD Foundation
10 # Redistribution and use in source and binary forms, with or without
11 # modification, are permitted provided that the following conditions
13 # 1. Redistributions of source code must retain the above copyright
14 # notice, this list of conditions and the following disclaimer.
15 # 2. Redistributions in binary form must reproduce the above copyright
16 # notice, this list of conditions and the following disclaimer in the
17 # documentation and/or other materials provided with the distribution.
19 # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 # POSSIBILITY OF SUCH DAMAGE.
33 # machine dependent section of installation/upgrade script.
36 # Machine-dependent install sets
37 MDSETS="kern xbase xcomp xfont xserver"
39 if [ "$MODE" = upgrade ]; then
40 RELOCATED_FILES_13="${RELOCATED_FILES_13} /usr/sbin/installboot /usr/mdec/installboot"
43 # Mount /kern to get at /kern/msgbuf
44 mount -t kernfs none /kern
47 if [ ! -z "$TERM" ]; then
50 echo -n "Specify terminal type [vt100]: "
56 md_makerootwritable() {
57 # Was: do_mfs_mount "/tmp" "2048"
58 # /tmp is the mount point
59 # 2048 is the size in DEV_BIZE blocks
61 umount /tmp > /dev/null 2>&1
62 if ! mount_mfs -s 2048 swap /tmp ; then
63 cat << \__mfs_failed_1
65 FATAL ERROR: Can't mount the memory filesystem.
71 # Bleh. Give mount_mfs a chance to DTRT.
76 # return available disk devices
77 < /kern/msgbuf sed -n -e 's/^\(sd[0-9]\) .*/\1/p' -e 's/^\(ra[0-9]\) .*/\1/p' | sort -u
81 # return available CDROM devices
82 < /kern/msgbuf sed -n -e 's/^\(cd[0-9]\) .*/\1/p' | sort -u
86 # return available network devices
87 < /kern/msgbuf sed -n -e 's/^\([dlqz]e[0-9]\) .*/\1/p' | sort -u
90 md_get_partition_range() {
91 # return range of valid partition letters
96 echo "Installing boot block..."
106 md_checkfordisklabel() {
107 # $1 is the disk to check
111 cfdl=`disklabel $1 2>&1 > /dev/null | \
112 sed -n -e '/no disk label/{s/.*/ndl/p;q;}; \
113 /disk label corrupted/{s/.*/dlc/p;q;}; \
115 if [ x$cfdl = xndl ]; then
117 elif [ x$cfdl = xdlc ]; then
131 md_checkfordisklabel $_disk
134 echo -n "Do you wish to edit the disklabel on $_disk? [y]"
137 echo "WARNING: Disk $_disk has no label"
138 echo -n "Do you want to create one with the disklabel editor? [y]"
141 echo "WARNING: Label on disk $_disk is corrupted"
142 echo -n "Do you want to try and repair the damage using the disklabel editor? [y]"
153 cat << \__md_prep_disklabel_1
155 Here is an example of what the partition information will look like once
156 you have entered the disklabel editor. Disk partition sizes and offsets
157 are in sector (most likely 512 bytes) units. Make sure these size/offset
158 pairs are on cylinder boundaries (the number of sector per cylinder is
159 given in the `sectors/cylinder' entry, which is not shown here).
161 Do not change any parameters except the partition layout and the label name.
162 It's probably also wisest not to touch the `8 partitions:' line, even
163 in case you have defined less than eight partitions.
167 # size offset fstype [fsize bsize cpg]
168 a: 50176 0 4.2BSD 1024 8192 16 # (Cyl. 0 - 111)
169 b: 64512 50176 swap # (Cyl. 112 - 255)
170 c: 640192 0 unknown # (Cyl. 0 - 1428)
171 d: 525504 114688 4.2BSD 1024 8192 16 # (Cyl. 256 - 1428)
174 __md_prep_disklabel_1
175 echo -n "Press [Enter] to continue "
177 disklabel -W ${_disk}
178 if [ -f /usr/bin/vi ]; then
179 disklabel -e ${_disk}
181 disklabel -i ${_disk}
186 if [ -f /mnt/netbsd-GENERIC ]; then
187 echo -n "Linking /netbsd-GENERIC to /netbsd ... "
188 ln /mnt/netbsd-GENERIC /mnt/netbsd
191 echo "WARNING: No /netbsd-GENERIC! Please install /netbsd manually!"
195 md_welcome_banner() {
197 if [ "$MODE" = "install" ]; then
199 echo "Welcome to the NetBSD/vax ${VERSION} installation program."
200 cat << \__welcome_banner_1
202 This program is designed to help you put NetBSD on your disk,
203 in a simple and rational way. You'll be asked several questions,
204 and it would probably be useful to have your disk's hardware
205 manual, the installation notes, and a calculator handy.
210 echo "Welcome to the NetBSD/vax ${VERSION} upgrade program."
211 cat << \__welcome_banner_2
213 This program is designed to help you upgrade your NetBSD system in a
214 simple and rational way.
216 As a reminder, installing the `etc' binary set is NOT recommended.
217 Once the rest of your system has been upgraded, you should manually
218 merge any changes to files in the `etc' set into those files which
219 already exist on your system.
223 cat << \__welcome_banner_3
225 As with anything which modifies your disk's contents, this
226 program can cause SIGNIFICANT data loss, and you are advised
227 to make sure your data is backed up before beginning the
228 installation process.
230 Default answers are displayed in brackets after the questions.
231 You can hit Control-C at any time to quit, but if you do so at a
232 prompt, you may have to hit return. Also, quitting in the middle of
233 installation may leave your system in an inconsistent state.
239 md_not_going_to_install() {
240 cat << \__not_going_to_install_1
242 OK, then. Enter `halt' at the prompt to halt the machine. Once the
243 machine has halted, power-cycle the system to load new boot code.
245 __not_going_to_install_1
250 if [ "$MODE" = "install" ]; then
255 cat << __congratulations_1
257 CONGRATULATIONS! You have successfully $what NetBSD!
258 To boot the installed system, enter halt at the command prompt. Once the
259 system has halted, reset the machine and boot from the disk.