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
36VERSION=				# filled in automatically (see list)
37export VERSION
38
39md_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
59md_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
68md_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
75md_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
82You now have to prepare your root disk for the installation of NetBSD. This
83is further referred to as 'labeling' a disk.
84
85First you get the chance to edit or create an AHDI compatible partitioning on
86the installation disk. Note that NetBSD can do without AHDI partitions,
87check the documentation.
88If you want to use an AHDI compatible partitioning, you have to assign some
89partitions to NetBSD before NetBSD is able to use the disk. Change the 'id'
90of all partitions you want to use for NetBSD filesystems to 'NBD'. Change
91the 'id' of the partition you wish to use for swap to 'SWP'.
92
93Hit 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
100Here is an example of what the partition information will look like once
101you have entered the disklabel editor. Disk partition sizes and offsets
102are in sector (most likely 512 bytes) units.
103
104[Example]
105partition      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
117Hit 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
125You will now be given the opportunity to place disklabels on any additional
126disks 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
136md_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
142md_welcome_banner() {
143	echo ""
144	echo "Welcome to the NetBSD/atari ${VERSION} preparation program."
145		cat << \__welcome_banner_1
146
147This program is designed to partition your disk in preparation of the
148NetBSD installation. At this stage, the only thing you _must_ setup
149is a swap partition. If you wish, the remaining partitioning work might
150be delayed until the actual installation.
151
152As with anything which modifies your disk's contents, this
153program can cause SIGNIFICANT data loss, and you are advised
154to make sure your data is backed up before beginning the
155preparation process.
156
157Default answers are displayed in brackets after the questions.
158You can hit Control-C at any time to quit, but if you do so at a
159prompt, you may have to hit return.
160__welcome_banner_1
161}
162
163md_not_going_to_install() {
164	cat << \__not_going_to_install_1
165
166OK, then.  Enter `halt' at the prompt to halt the machine.  Once the
167machine has halted, power-cycle the system to load new boot code.
168
169Note: 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
175md_congrats() {
176	cat << __congratulations_1
177
178CONGRATULATIONS!  You have successfully partitioned your disks!
179Now you can use file2swap.ttp to transfer the install.fs to your
180swap partition and continue the installation.
181Enter halt at the command prompt. Once the system has halted, reset the
182machine and re-boot it.
183
184Note: 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