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