install.md revision 1.2 1 1.2 tsutsui # $NetBSD: install.md,v 1.2 2006/06/25 00:35:03 tsutsui Exp $
2 1.1 lukem #
3 1.1 lukem #
4 1.1 lukem # Copyright (c) 1996 The NetBSD Foundation, Inc.
5 1.1 lukem # All rights reserved.
6 1.1 lukem #
7 1.1 lukem # This code is derived from software contributed to The NetBSD Foundation
8 1.1 lukem # by Jason R. Thorpe.
9 1.1 lukem #
10 1.1 lukem # Redistribution and use in source and binary forms, with or without
11 1.1 lukem # modification, are permitted provided that the following conditions
12 1.1 lukem # are met:
13 1.1 lukem # 1. Redistributions of source code must retain the above copyright
14 1.1 lukem # notice, this list of conditions and the following disclaimer.
15 1.1 lukem # 2. Redistributions in binary form must reproduce the above copyright
16 1.1 lukem # notice, this list of conditions and the following disclaimer in the
17 1.1 lukem # documentation and/or other materials provided with the distribution.
18 1.1 lukem # 3. All advertising materials mentioning features or use of this software
19 1.1 lukem # must display the following acknowledgement:
20 1.1 lukem # This product includes software developed by the NetBSD
21 1.1 lukem # Foundation, Inc. and its contributors.
22 1.1 lukem # 4. Neither the name of The NetBSD Foundation nor the names of its
23 1.1 lukem # contributors may be used to endorse or promote products derived
24 1.1 lukem # from this software without specific prior written permission.
25 1.1 lukem #
26 1.1 lukem # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 1.1 lukem # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 1.1 lukem # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 1.1 lukem # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 1.1 lukem # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 1.1 lukem # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 1.1 lukem # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 1.1 lukem # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 1.1 lukem # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 1.1 lukem # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 1.1 lukem # POSSIBILITY OF SUCH DAMAGE.
37 1.1 lukem #
38 1.1 lukem
39 1.1 lukem #
40 1.1 lukem # machine dependent section of installation/upgrade script.
41 1.1 lukem #
42 1.1 lukem
43 1.1 lukem # Machine-dependent install sets
44 1.1 lukem # MDSETS="xbin xman xinc xcon" XXX
45 1.1 lukem MDSETS=""
46 1.1 lukem
47 1.1 lukem md_set_term() {
48 1.1 lukem if [ ! -z "$TERM" ]; then
49 1.1 lukem return
50 1.1 lukem fi
51 1.1 lukem echo -n "Specify terminal type [sun]: "
52 1.1 lukem getresp "sun"
53 1.1 lukem TERM="$resp"
54 1.1 lukem export TERM
55 1.1 lukem }
56 1.1 lukem
57 1.1 lukem __mount_kernfs() {
58 1.1 lukem # Make sure kernfs is mounted.
59 1.1 lukem if [ ! -d /kern -o ! -e /kern/msgbuf ]; then
60 1.1 lukem mkdir /kern > /dev/null 2>&1
61 1.1 lukem /sbin/mount_kernfs /kern /kern
62 1.1 lukem fi
63 1.1 lukem }
64 1.1 lukem
65 1.1 lukem md_makerootwritable() {
66 1.1 lukem # Just remount the root device read-write.
67 1.1 lukem if [ ! -e /tmp/root_writable ]; then
68 1.1 lukem echo "Remounting root read-write..."
69 1.1 lukem __mount_kernfs
70 1.1 lukem mount -u -t ffs /kern/rootdev /
71 1.1 lukem swapctl -a /kern/rootdev
72 1.1 lukem cp /dev/null /tmp/root_writable
73 1.1 lukem fi
74 1.1 lukem }
75 1.1 lukem
76 1.1 lukem md_get_diskdevs() {
77 1.1 lukem # return available disk devices
78 1.1 lukem __mount_kernfs
79 1.1 lukem sed -n -e '/^sd[0-9] /s/ .*//p' \
80 1.1 lukem -e '/^xd[0-9] /s/ .*//p' \
81 1.1 lukem -e '/^xy[0-9] /s/ .*//p' \
82 1.1 lukem < /kern/msgbuf | sort -u
83 1.1 lukem }
84 1.1 lukem
85 1.1 lukem md_get_cddevs() {
86 1.1 lukem # return available CDROM devices
87 1.1 lukem __mount_kernfs
88 1.1 lukem sed -n -e '/^cd[0-9] /s/ .*//p' \
89 1.1 lukem < /kern/msgbuf | sort -u
90 1.1 lukem }
91 1.1 lukem
92 1.1 lukem md_get_ifdevs() {
93 1.1 lukem # return available network devices
94 1.1 lukem __mount_kernfs
95 1.1 lukem sed -n -e '/^ie[0-9] /s/ .*//p' \
96 1.1 lukem -e '/^le[0-9] /s/ .*//p' \
97 1.1 lukem < /kern/msgbuf | sort -u
98 1.1 lukem }
99 1.1 lukem
100 1.1 lukem md_get_partition_range() {
101 1.1 lukem # return an expression describing the valid partition id's
102 1.1 lukem echo '[a-h]'
103 1.1 lukem }
104 1.1 lukem
105 1.1 lukem md_installboot() {
106 1.1 lukem # install the boot block on disk $1
107 1.1 lukem echo "Installing boot block..."
108 1.1 lukem ( cd /usr/mdec ;\
109 1.1 lukem cp -p ./ufsboot /mnt/ufsboot ;\
110 1.1 lukem sync ; sleep 1 ; sync ;\
111 1.1 lukem /usr/sbin/installboot -v /dev/r${1}a bootxx ufsboot )
112 1.1 lukem echo "done."
113 1.1 lukem }
114 1.1 lukem
115 1.1 lukem md_native_fstype() {
116 1.1 lukem }
117 1.1 lukem
118 1.1 lukem md_native_fsopts() {
119 1.1 lukem }
120 1.1 lukem
121 1.1 lukem md_prep_disklabel() {
122 1.1 lukem # $1 is the root disk
123 1.1 lukem echo -n "Do you wish to edit the disklabel on ${1}? [y]"
124 1.1 lukem getresp "y"
125 1.1 lukem case "$resp" in
126 1.1 lukem y*|Y*) ;;
127 1.1 lukem *) return ;;
128 1.1 lukem esac
129 1.1 lukem
130 1.1 lukem # display example
131 1.1 lukem cat << \__md_prep_disklabel_1
132 1.1 lukem Here is an example of what the partition information will look like once
133 1.1 lukem you have entered the disklabel editor. Disk partition sizes and offsets
134 1.1 lukem are in sector (most likely 512 bytes) units. Make sure all partitions
135 1.1 lukem start on a cylinder boundary (c/t/s == XXX/0/0).
136 1.1 lukem
137 1.1 lukem [Example]
138 1.1 lukem partition start (c/t/s) nblks (c/t/s) type
139 1.1 lukem
140 1.1 lukem a (root) 0 (0/00/00) 31392 (109/00/00) 4.2BSD
141 1.1 lukem b (swap) 31392 (109/00/00) 73440 (255/00/00) swap
142 1.1 lukem c (disk) 0 (0/00/00) 1070496 (3717/00/00) unused
143 1.1 lukem d (user) 104832 (364/00/00) 30528 (106/00/00) 4.2BSD
144 1.1 lukem e (user) 135360 (470/00/00) 40896 (142/00/00) 4.2BSD
145 1.1 lukem f (user) 176256 (612/00/00) 92160 (320/00/00) 4.2BSD
146 1.1 lukem g (user) 268416 (932/00/00) 802080 (2785/00/00) 4.2BSD
147 1.1 lukem
148 1.1 lukem [End of example]
149 1.1 lukem
150 1.1 lukem Hit the <return> key when you have read this...
151 1.1 lukem
152 1.1 lukem __md_prep_disklabel_1
153 1.1 lukem getresp ""
154 1.1 lukem edlabel /dev/r${1}c
155 1.1 lukem }
156 1.1 lukem
157 1.1 lukem md_copy_kernel() {
158 1.2 tsutsui if [ ! -f /mnt/netbsd ]; then
159 1.2 tsutsui echo -n "No kernel set extracted. Copying miniroot kernel..."
160 1.2 tsutsui cp -p /netbsd /mnt/netbsd
161 1.2 tsutsui echo "done."
162 1.2 tsutsui fi
163 1.1 lukem ln /mnt/netbsd /mnt/vmunix
164 1.1 lukem }
165 1.1 lukem
166 1.1 lukem md_welcome_banner() {
167 1.1 lukem if [ "$MODE" = "install" ]; then
168 1.1 lukem echo ""
169 1.1 lukem echo "Welcome to the NetBSD/sun2 ${VERSION} installation program."
170 1.1 lukem cat << \__welcome_banner_1
171 1.1 lukem
172 1.1 lukem This program is designed to help you put NetBSD on your disk,
173 1.1 lukem in a simple and rational way. You'll be asked several questions,
174 1.1 lukem and it would probably be useful to have your disk's hardware
175 1.1 lukem manual, the installation notes, and a calculator handy.
176 1.1 lukem __welcome_banner_1
177 1.1 lukem
178 1.1 lukem else
179 1.1 lukem echo ""
180 1.1 lukem echo "Welcome to the NetBSD/sun2 ${VERSION} upgrade program."
181 1.1 lukem cat << \__welcome_banner_2
182 1.1 lukem
183 1.1 lukem This program is designed to help you upgrade your NetBSD system in a
184 1.1 lukem simple and rational way.
185 1.1 lukem
186 1.1 lukem As a reminder, installing the `etc' binary set is NOT recommended.
187 1.1 lukem Once the rest of your system has been upgraded, you should manually
188 1.1 lukem merge any changes to files in the `etc' set into those files which
189 1.1 lukem already exist on your system.
190 1.1 lukem __welcome_banner_2
191 1.1 lukem fi
192 1.1 lukem
193 1.1 lukem cat << \__welcome_banner_3
194 1.1 lukem
195 1.1 lukem As with anything which modifies your disk's contents, this
196 1.1 lukem program can cause SIGNIFICANT data loss, and you are advised
197 1.1 lukem to make sure your data is backed up before beginning the
198 1.1 lukem installation process.
199 1.1 lukem
200 1.1 lukem Default answers are displayed in brackets after the questions.
201 1.1 lukem You can hit Control-C at any time to quit, but if you do so at a
202 1.1 lukem prompt, you may have to hit return. Also, quitting in the middle of
203 1.1 lukem installation may leave your system in an inconsistent state.
204 1.1 lukem
205 1.1 lukem __welcome_banner_3
206 1.1 lukem }
207 1.1 lukem
208 1.1 lukem md_not_going_to_install() {
209 1.1 lukem cat << \__not_going_to_install_1
210 1.1 lukem
211 1.1 lukem OK, then. Enter `halt' at the prompt to halt the machine. Once the
212 1.1 lukem machine has halted, power-cycle the system to load new boot code.
213 1.1 lukem
214 1.1 lukem __not_going_to_install_1
215 1.1 lukem }
216 1.1 lukem
217 1.1 lukem md_congrats() {
218 1.1 lukem local what;
219 1.1 lukem if [ "$MODE" = "install" ]; then
220 1.1 lukem what="installed";
221 1.1 lukem else
222 1.1 lukem what="upgraded";
223 1.1 lukem fi
224 1.1 lukem cat << __congratulations_1
225 1.1 lukem
226 1.1 lukem CONGRATULATIONS! You have successfully $what NetBSD!
227 1.1 lukem To boot the installed system, enter halt at the command prompt. Once the
228 1.1 lukem system has halted, reset the machine and boot from the disk.
229 1.1 lukem
230 1.1 lukem __congratulations_1
231 1.1 lukem }
232