install.md revision 1.1.1.1.18.1 1 # $NetBSD: install.md,v 1.1.1.1.18.1 2009/01/15 22:22:07 bouyer 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 # 3. All advertising materials mentioning features or use of this software
19 # must display the following acknowledgement:
20 # This product includes software developed by the NetBSD
21 # Foundation, Inc. and its contributors.
22 # 4. Neither the name of The NetBSD Foundation nor the names of its
23 # contributors may be used to endorse or promote products derived
24 # from this software without specific prior written permission.
25 #
26 # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 # POSSIBILITY OF SUCH DAMAGE.
37 #
38
39 #
40 # machine dependent section of installation/upgrade script.
41 #
42
43 VERSION= # filled in automatically (see list)
44 export VERSION
45
46 md_set_term() {
47 if [ ! -z "$TERM" ]; then
48 return
49 fi
50 echo -n "Specify terminal type [vt220]: "
51 getresp "vt220"
52 TERM="$resp"
53 export TERM
54 }
55
56 md_makerootwritable() {
57 # Mount root rw for convenience of the tester ;-)
58 if [ ! -e /tmp/.root_writable ]; then
59 rootdev=/dev/$(sysctl -n kern.root_device)$(sysctl -n kern.root_partition | sed y/0123456789/abcdefghij/)
60 mount -t ffs -u $rootdev / > /dev/null 2>&1
61 cp /dev/null /tmp/.root_writable
62 fi
63 }
64
65 md_get_diskdevs() {
66 # return available disk devices
67 sysctl -n hw.disknames | sed 'y/ /\n/' | sed -n '/^[sw]d[0-9]/p' \
68 | sort -u
69 }
70
71 md_prep_disklabel()
72 {
73 # $1 is the root disk
74 # Note that the first part of this function is just a *very* verbose
75 # version of md_label_disk().
76
77 cat << \__md_prep_disklabel_1
78 You now have to prepare your root disk for the installation of NetBSD. This
79 is further referred to as 'labeling' a disk.
80
81 First you get the chance to edit or create an AHDI compatible partitioning on
82 the installation disk. Note that NetBSD can do without AHDI partitions,
83 check the documentation.
84 If you want to use an AHDI compatible partitioning, you have to assign some
85 partitions to NetBSD before NetBSD is able to use the disk. Change the 'id'
86 of all partitions you want to use for NetBSD filesystems to 'NBD'. Change
87 the 'id' of the partition you wish to use for swap to 'SWP'.
88
89 Hit the <return> key when you have read this...
90 __md_prep_disklabel_1
91 getresp ""
92 ahdilabel /dev/r${1}c
93
94 # display example
95 cat << \__md_prep_disklabel_3
96 Here is an example of what the partition information will look like once
97 you have entered the disklabel editor. Disk partition sizes and offsets
98 are in sector (most likely 512 bytes) units.
99
100 [Example]
101 partition start (c/t/s) nblks (c/t/s) type
102
103 a (root) 0 (0/00/00) 31392 (109/00/00) 4.2BSD
104 b (swap) 31392 (109/00/00) 73440 (255/00/00) swap
105 c (disk) 0 (0/00/00) 1070496 (3717/00/00) unused
106 d (user) 104832 (364/00/00) 30528 (106/00/00) 4.2BSD
107 e (user) 135360 (470/00/00) 40896 (142/00/00) 4.2BSD
108 f (user) 176256 (612/00/00) 92160 (320/00/00) 4.2BSD
109 g (user) 268416 (932/00/00) 802080 (2785/00/00) 4.2BSD
110
111 [End of example]
112
113 Hit the <return> key when you have read this...
114
115 __md_prep_disklabel_3
116 getresp ""
117 edlabel /dev/r${1}c
118
119 cat << \__md_prep_disklabel_4
120
121 You will now be given the opportunity to place disklabels on any additional
122 disks on your system.
123 __md_prep_disklabel_4
124
125 _DKDEVS=`rmel ${1} ${_DKDEVS}`
126 resp="X" # force at least one iteration
127 while [ "X$resp" != X"done" ]; do
128 labelmoredisks
129 done
130 }
131
132 md_labeldisk() {
133 edahdi /dev/r${1}c < /dev/null > /dev/null 2>&1
134 [ $? -eq 0 ] && edahdi /dev/r${1}c
135 edlabel /dev/r${1}c
136 }
137
138 md_welcome_banner() {
139 echo ""
140 echo "Welcome to the NetBSD/atari ${VERSION} preparation program."
141 cat << \__welcome_banner_1
142
143 This program is designed to partition your disk in preparation of the
144 NetBSD installation. At this stage, the only thing you _must_ setup
145 is a swap partition. If you wish, the remaining partitioning work might
146 be delayed until the actual installation.
147
148 As with anything which modifies your disk's contents, this
149 program can cause SIGNIFICANT data loss, and you are advised
150 to make sure your data is backed up before beginning the
151 preparation process.
152
153 Default answers are displayed in brackets after the questions.
154 You can hit Control-C at any time to quit, but if you do so at a
155 prompt, you may have to hit return.
156 __welcome_banner_1
157 }
158
159 md_not_going_to_install() {
160 cat << \__not_going_to_install_1
161
162 OK, then. Enter `halt' at the prompt to halt the machine. Once the
163 machine has halted, power-cycle the system to load new boot code.
164
165 Note: If you wish to have another try. Just type '^D' at the prompt. After
166 a moment, the program will restart itself.
167
168 __not_going_to_install_1
169 }
170
171 md_congrats() {
172 cat << __congratulations_1
173
174 CONGRATULATIONS! You have successfully partitioned your disks!
175 Now you can use file2swap.ttp to transfer the install.fs to your
176 swap partition and continue the installation.
177 Enter halt at the command prompt. Once the system has halted, reset the
178 machine and re-boot it.
179
180 Note: If you wish to have another try. Just type '^D' at the prompt. After
181 a moment, the installer will restart itself.
182
183 __congratulations_1
184 }
185