install.md revision 1.2 1 # $NetBSD: install.md,v 1.2 1996/02/28 00:50:28 thorpej 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 REGENTS OR CONTRIBUTORS BE
30 # 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 md_set_term() {
44 if [ ! -z "$TERM" ]; then
45 return
46 fi
47 echo -n "Specify terminal type [sun]: "
48 getresp "sun"
49 TERM="$resp"
50 export TERM
51 }
52
53 md_get_diskdevs() {
54 # return available disk devices
55 dmesg | egrep "(^sd[0-9] |^x[dy][0-9] )" | cut -d" " -f1 | sort -u
56 }
57
58 md_get_cddevs() {
59 # return available CDROM devices
60 dmesg | grep "^cd[0-9] " | cut -d" " -f1 | sort -u
61 }
62
63 md_get_ifdevs() {
64 # return available network devices
65 dmesg | egrep "(^le[0-9] |^ie[0-9] )" | cut -d" " -f1 | sort -u
66 }
67
68 md_installboot() {
69 echo "Installing boot block..."
70 /usr/mdec/binstall -v ffs /mnt
71 }
72
73 md_checkfordisklabel() {
74 # $1 is the disk to check
75
76 disklabel $1 > /dev/null 2> /tmp/checkfordisklabel
77 if grep "no disk label" /tmp/checkfordisklabel; then
78 rval="1"
79 elif grep "disk label corrupted" /tmp/checkfordisklabel; then
80 rval="2"
81 else
82 rval="0"
83 fi
84
85 rm -f /tmp/checkfordisklabel
86 }
87
88 md_prep_disklabel()
89 {
90 # display example
91 cat << \__md_prep_disklabel_1
92 Here is an example of what the partition information will look like once
93 you have entered the disklabel editor. Disk partition sizes and offsets
94 are in sector (most likely 512 bytes) units. Make sure these size/offset
95 pairs are on cylinder boundaries (the number of sector per cylinder is
96 given in the `sectors/cylinder' entry, which is not shown here).
97
98 Do not change any parameters except the partition layout and the label name.
99 It's probably also wisest not to touch the `8 partitions:' line, even
100 in case you have defined less than eight partitions.
101
102 [Example]
103 8 partitions:
104 # size offset fstype [fsize bsize cpg]
105 a: 50176 0 4.2BSD 1024 8192 16 # (Cyl. 0 - 111)
106 b: 64512 50176 swap # (Cyl. 112 - 255)
107 c: 640192 0 unknown # (Cyl. 0 - 1428)
108 d: 525504 114688 4.2BSD 1024 8192 16 # (Cyl. 256 - 1428)
109 [End of example]
110
111 __md_prep_disklabel_1
112 }
113
114 md_welcome_banner() {
115 {
116 if [ "$MODE" = "install" ]; then
117 echo ""
118 echo "Welcome to the NetBSD/sparc ${VERSION} installation program."
119 cat << \__welcome_banner_1
120
121 This program is designed to help you put NetBSD on your disk,
122 in a simple and rational way. You'll be asked several questions,
123 and it would probably be useful to have your disk's hardware
124 manual, the installation notes, and a calculator handy.
125 __welcome_banner_1
126
127 else
128 echo ""
129 echo "Welcome to the NetBSD/sparc ${VERSION} upgrade program."
130 cat << \__welcome_banner_2
131
132 This program is designed to help you upgrade your NetBSD system in a
133 simple and rational way.
134
135 As a reminder, installing the `etc' binary set is NOT recommended.
136 Once the rest of your system has been upgraded, you should manually
137 merge any changes to files in the `etc' set into those files which
138 already exist on your system.
139 __welcome_banner_2
140 fi
141
142 cat << \__welcome_banner_3
143
144 As with anything which modifies your disk's contents, this
145 program can cause SIGNIFICANT data loss, and you are advised
146 to make sure your data is backed up before beginning the
147 installation process.
148
149 Default answers are displyed in brackets after the questions.
150 You can hit Control-C at any time to quit, but if you do so at a
151 prompt, you may have to hit return. Also, quitting in the middle of
152 installation may leave your system in an inconsistent state.
153
154 __welcome_banner_3
155 } | more
156 }
157
158 md_not_going_to_install() {
159 cat << \__not_going_to_install_1
160
161 OK, then. Enter `halt' at the prompt to halt the machine. Once the
162 machine has halted, power-cycle the system to load new boot code.
163
164 __not_going_to_install_1
165 }
166
167 md_congrats() {
168 local what;
169 if [ "$MODE" = "install" ]; then
170 what="installed";
171 else
172 what="upgraded";
173 fi
174 cat << __congratulations_1
175
176 CONGRATULATIONS! You have successfully $what NetBSD!
177 To boot the installed system, enter halt at the command prompt. Once the
178 system has halted, reset the machine and boot from the disk.
179
180 __congratulations_1
181 }
182