install.md revision 1.1 1 # $NetBSD: install.md,v 1.1 1996/01/06 22:42:13 pk Exp $
2 #
3 # Copyright (c) 1995 Jason R. Thorpe.
4 # All rights reserved.
5 #
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions
8 # are met:
9 # 1. Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer.
11 # 2. Redistributions in binary form must reproduce the above copyright
12 # notice, this list of conditions and the following disclaimer in the
13 # documentation and/or other materials provided with the distribution.
14 # 3. All advertising materials mentioning features or use of this software
15 # must display the following acknowledgement:
16 # This product includes software developed for the NetBSD Project
17 # by Jason R. Thorpe.
18 # 4. The name of the author may not be used to endorse or promote products
19 # derived from this software without specific prior written permission
20 #
21 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 #
32
33 #
34 # machine dependent section of installation/upgrade script.
35 #
36
37 md_set_term() {
38 if [ ! -z "$TERM" ]; then
39 return
40 fi
41 echo -n "Specify terminal type [sun]: "
42 getresp "sun"
43 TERM="$resp"
44 export TERM
45 }
46
47 md_get_diskdevs() {
48 # return available disk devices
49 dmesg | egrep "(^sd[0-9] |^x[dy][0-9] )" | cut -d" " -f1 | sort -u
50 }
51
52 md_get_cddevs() {
53 # return available CDROM devices
54 dmesg | grep "^cd[0-9] " | cut -d" " -f1 | sort -u
55 }
56
57 md_get_ifdevs() {
58 # return available network devices
59 dmesg | egrep "(^le[0-9] |^ie[0-9] )" | cut -d" " -f1 | sort -u
60 }
61
62 md_installboot() {
63 echo "Installing boot block..."
64 /usr/mdec/binstall -v ffs /mnt
65 }
66
67 md_checkfordisklabel() {
68 # $1 is the disk to check
69
70 disklabel $1 > /dev/null 2> /tmp/checkfordisklabel
71 if grep "no disk label" /tmp/checkfordisklabel; then
72 rval="1"
73 elif grep "disk label corrupted" /tmp/checkfordisklabel; then
74 rval="2"
75 else
76 rval="0"
77 fi
78
79 rm -f /tmp/checkfordisklabel
80 }
81
82 md_prep_disklabel()
83 {
84 # display example
85 cat << \__md_prep_disklabel_1
86 Here is an example of what the partition information will look like once
87 you have entered the disklabel editor. Disk partition sizes and offsets
88 are in sector (most likely 512 bytes) units. Make sure these size/offset
89 pairs are on cylinder boundaries (the number of sector per cylinder is
90 given in the `sectors/cylinder' entry, which is not shown here).
91
92 Do not change any parameters except the partition layout and the label name.
93 It's probably also wisest not to touch the `8 partitions:' line, even
94 in case you have defined less than eight partitions.
95
96 [Example]
97 8 partitions:
98 # size offset fstype [fsize bsize cpg]
99 a: 50176 0 4.2BSD 1024 8192 16 # (Cyl. 0 - 111)
100 b: 64512 50176 swap # (Cyl. 112 - 255)
101 c: 640192 0 unknown # (Cyl. 0 - 1428)
102 d: 525504 114688 4.2BSD 1024 8192 16 # (Cyl. 256 - 1428)
103 [End of example]
104
105 __md_prep_disklabel_1
106 }
107
108 md_welcome_banner() {
109 {
110 if [ "$MODE" = "install" ]; then
111 echo ""
112 echo "Welcome to the NetBSD/sparc ${VERSION} installation program."
113 cat << \__welcome_banner_1
114
115 This program is designed to help you put NetBSD on your disk,
116 in a simple and rational way. You'll be asked several questions,
117 and it would probably be useful to have your disk's hardware
118 manual, the installation notes, and a calculator handy.
119 __welcome_banner_1
120
121 else
122 echo ""
123 echo "Welcome to the NetBSD/sparc ${VERSION} upgrade program."
124 cat << \__welcome_banner_2
125
126 This program is designed to help you upgrade your NetBSD system in a
127 simple and rational way.
128
129 As a reminder, installing the `etc' binary set is NOT recommended.
130 Once the rest of your system has been upgraded, you should manually
131 merge any changes to files in the `etc' set into those files which
132 already exist on your system.
133 __welcome_banner_2
134 fi
135
136 cat << \__welcome_banner_3
137
138 As with anything which modifies your disk's contents, this
139 program can cause SIGNIFICANT data loss, and you are advised
140 to make sure your data is backed up before beginning the
141 installation process.
142
143 Default answers are displyed in brackets after the questions.
144 You can hit Control-C at any time to quit, but if you do so at a
145 prompt, you may have to hit return. Also, quitting in the middle of
146 installation may leave your system in an inconsistent state.
147
148 __welcome_banner_3
149 } | more
150 }
151
152 md_not_going_to_install() {
153 cat << \__not_going_to_install_1
154
155 OK, then. Enter `halt' at the prompt to halt the machine. Once the
156 machine has halted, power-cycle the system to load new boot code.
157
158 __not_going_to_install_1
159 }
160
161 md_congrats() {
162 local what;
163 if [ "$MODE" = "install" ]; then
164 what="installed";
165 else
166 what="upgraded";
167 fi
168 cat << __congratulations_1
169
170 CONGRATULATIONS! You have successfully $what NetBSD!
171 To boot the installed system, enter halt at the command prompt. Once the
172 system has halted, reset the machine and boot from the disk.
173
174 __congratulations_1
175 }
176