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