install.md revision 1.1.1.1.34.1 1 # $NetBSD: install.md,v 1.1.1.1.34.1 2008/06/02 13:21:12 mjf Exp $
2 #
3 #
4 # Copyright (c) 1996 The NetBSD Foundation, Inc.
5 # All rights reserved.
6 #
7 # This code is derived from software contributed to The NetBSD Foundation
8 # by Jason R. Thorpe.
9 #
10 # Redistribution and use in source and binary forms, with or without
11 # modification, are permitted provided that the following conditions
12 # are met:
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.
18 #
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.
30 #
31
32 #
33 # machine dependent section of installation/upgrade script.
34 #
35
36 VERSION= # filled in automatically (see list)
37 export VERSION
38
39 md_set_term() {
40 if [ ! -z "$TERM" ]; then
41 return
42 fi
43 echo -n "Specify terminal type [vt220]: "
44 getresp "vt220"
45 TERM="$resp"
46 export TERM
47 }
48
49 __mount_kernfs() {
50 #
51 # Force kern_fs to be mounted
52 #
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
56 fi
57 }
58
59 md_makerootwritable() {
60 # Mount root rw for convenience of the tester ;-)
61 if [ ! -e /tmp/.root_writable ]; then
62 __mount_kernfs
63 mount -t ffs -u /kern/rootdev / > /dev/null 2>&1
64 cp /dev/null /tmp/.root_writable
65 fi
66 }
67
68 md_get_diskdevs() {
69 # return available disk devices
70 __mount_kernfs
71 sed -n -e '/^[sw]d[0-9] /s/ .*//p' \
72 < /kern/msgbuf | sort -u
73 }
74
75 md_prep_disklabel()
76 {
77 # $1 is the root disk
78 # Note that the first part of this function is just a *very* verbose
79 # version of md_label_disk().
80
81 cat << \__md_prep_disklabel_1
82 You now have to prepare your root disk for the installation of NetBSD. This
83 is further referred to as 'labeling' a disk.
84
85 First you get the chance to edit or create an AHDI compatible partitioning on
86 the installation disk. Note that NetBSD can do without AHDI partitions,
87 check the documentation.
88 If you want to use an AHDI compatible partitioning, you have to assign some
89 partitions to NetBSD before NetBSD is able to use the disk. Change the 'id'
90 of all partitions you want to use for NetBSD filesystems to 'NBD'. Change
91 the 'id' of the partition you wish to use for swap to 'SWP'.
92
93 Hit the <return> key when you have read this...
94 __md_prep_disklabel_1
95 getresp ""
96 ahdilabel /dev/r${1}c
97
98 # display example
99 cat << \__md_prep_disklabel_3
100 Here is an example of what the partition information will look like once
101 you have entered the disklabel editor. Disk partition sizes and offsets
102 are in sector (most likely 512 bytes) units.
103
104 [Example]
105 partition start (c/t/s) nblks (c/t/s) type
106
107 a (root) 0 (0/00/00) 31392 (109/00/00) 4.2BSD
108 b (swap) 31392 (109/00/00) 73440 (255/00/00) swap
109 c (disk) 0 (0/00/00) 1070496 (3717/00/00) unused
110 d (user) 104832 (364/00/00) 30528 (106/00/00) 4.2BSD
111 e (user) 135360 (470/00/00) 40896 (142/00/00) 4.2BSD
112 f (user) 176256 (612/00/00) 92160 (320/00/00) 4.2BSD
113 g (user) 268416 (932/00/00) 802080 (2785/00/00) 4.2BSD
114
115 [End of example]
116
117 Hit the <return> key when you have read this...
118
119 __md_prep_disklabel_3
120 getresp ""
121 edlabel /dev/r${1}c
122
123 cat << \__md_prep_disklabel_4
124
125 You will now be given the opportunity to place disklabels on any additional
126 disks on your system.
127 __md_prep_disklabel_4
128
129 _DKDEVS=`rmel ${1} ${_DKDEVS}`
130 resp="X" # force at least one iteration
131 while [ "X$resp" != X"done" ]; do
132 labelmoredisks
133 done
134 }
135
136 md_labeldisk() {
137 edahdi /dev/r${1}c < /dev/null > /dev/null 2>&1
138 [ $? -eq 0 ] && edahdi /dev/r${1}c
139 edlabel /dev/r${1}c
140 }
141
142 md_welcome_banner() {
143 echo ""
144 echo "Welcome to the NetBSD/atari ${VERSION} preparation program."
145 cat << \__welcome_banner_1
146
147 This program is designed to partition your disk in preparation of the
148 NetBSD installation. At this stage, the only thing you _must_ setup
149 is a swap partition. If you wish, the remaining partitioning work might
150 be delayed until the actual installation.
151
152 As with anything which modifies your disk's contents, this
153 program can cause SIGNIFICANT data loss, and you are advised
154 to make sure your data is backed up before beginning the
155 preparation process.
156
157 Default answers are displayed in brackets after the questions.
158 You can hit Control-C at any time to quit, but if you do so at a
159 prompt, you may have to hit return.
160 __welcome_banner_1
161 }
162
163 md_not_going_to_install() {
164 cat << \__not_going_to_install_1
165
166 OK, then. Enter `halt' at the prompt to halt the machine. Once the
167 machine has halted, power-cycle the system to load new boot code.
168
169 Note: If you wish to have another try. Just type '^D' at the prompt. After
170 a moment, the program will restart itself.
171
172 __not_going_to_install_1
173 }
174
175 md_congrats() {
176 cat << __congratulations_1
177
178 CONGRATULATIONS! You have successfully partitioned your disks!
179 Now you can use file2swap.ttp to transfer the install.fs to your
180 swap partition and continue the installation.
181 Enter halt at the command prompt. Once the system has halted, reset the
182 machine and re-boot it.
183
184 Note: If you wish to have another try. Just type '^D' at the prompt. After
185 a moment, the installer will restart itself.
186
187 __congratulations_1
188 }
189