Home | History | Annotate | Line # | Download | only in sparc
install.md revision 1.10
      1 #	$NetBSD: install.md,v 1.10 1997/06/22 22:26:42 pk 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 # Machine-dependent install sets
     44 MDSETS="xbin xman xinc xcon"
     45 
     46 if [ "$MODE" = upgrade ]; then
     47 	RELOCATED_FILES_13="${RELOCATED_FILES_13} /usr/sbin/installboot /usr/mdec/installboot"
     48 fi
     49 
     50 md_set_term() {
     51 	if [ ! -z "$TERM" ]; then
     52 		return
     53 	fi
     54 	echo -n "Specify terminal type [sun]: "
     55 	getresp "sun"
     56 	TERM="$resp"
     57 	export TERM
     58 }
     59 
     60 md_makerootwritable() {
     61 	# Was: do_mfs_mount "/tmp" "2048"
     62 	# /tmp is the mount point
     63 	# 2048 is the size in DEV_BIZE blocks
     64 
     65 	umount /tmp > /dev/null 2>&1
     66 	if ! mount_mfs -s 2048 swap /tmp ; then
     67 		cat << \__mfs_failed_1
     68 
     69 FATAL ERROR: Can't mount the memory filesystem.
     70 
     71 __mfs_failed_1
     72 		exit
     73 	fi
     74 
     75 	# Bleh.  Give mount_mfs a chance to DTRT.
     76 	sleep 2
     77 }
     78 
     79 md_get_diskdevs() {
     80 	# return available disk devices
     81 	dmesg | egrep "(^sd[0-9] |^x[dy][0-9] )" | cut -d" " -f1 | sort -u
     82 }
     83 
     84 md_get_cddevs() {
     85 	# return available CDROM devices
     86 	dmesg | grep "^cd[0-9] " | cut -d" " -f1 | sort -u
     87 }
     88 
     89 md_get_ifdevs() {
     90 	# return available network devices
     91 	dmesg | egrep "(^le[0-9] |^ie[0-9] )" | cut -d" " -f1 | sort -u
     92 }
     93 
     94 md_get_partition_range() {
     95     # return range of valid partition letters
     96     echo "[a-h]"
     97 }
     98 
     99 md_installboot() {
    100 	echo "Installing boot block..."
    101 	/usr/mdec/binstall ffs /mnt
    102 }
    103 
    104 md_native_fstype() {
    105 }
    106 
    107 md_native_fsopts() {
    108 }
    109 
    110 md_checkfordisklabel() {
    111 	# $1 is the disk to check
    112 	local rval
    113 
    114 	disklabel $1 > /dev/null 2> /tmp/checkfordisklabel
    115 	if grep "no disk label" /tmp/checkfordisklabel; then
    116 		rval=1
    117 	elif grep "disk label corrupted" /tmp/checkfordisklabel; then
    118 		rval=2
    119 	else
    120 		rval=0
    121 	fi
    122 
    123 	rm -f /tmp/checkfordisklabel
    124 	return $rval
    125 }
    126 
    127 md_prep_disklabel()
    128 {
    129 	local _disk
    130 
    131 	_disk=$1
    132 	md_checkfordisklabel $_disk
    133 	case $? in
    134 	0)
    135 		echo -n "Do you wish to edit the disklabel on $_disk? [y]"
    136 		;;
    137 	1)
    138 		echo "WARNING: Disk $_disk has no label"
    139 		echo -n "Do you want to create one with the disklabel editor? [y]"
    140 		;;
    141 	2)
    142 		echo "WARNING: Label on disk $_disk is corrupted"
    143 		echo -n "Do you want to try and repair the damage using the disklabel editor? [y]"
    144 		;;
    145 	esac
    146 
    147 	getresp "y"
    148 	case "$resp" in
    149 	y*|Y*) ;;
    150 	*)	return ;;
    151 	esac
    152 
    153 	# display example
    154 	cat << \__md_prep_disklabel_1
    155 
    156 Here is an example of what the partition information will look like once
    157 you have entered the disklabel editor. Disk partition sizes and offsets
    158 are in sector (most likely 512 bytes) units. Make sure these size/offset
    159 pairs are on cylinder boundaries (the number of sector per cylinder is
    160 given in the `sectors/cylinder' entry, which is not shown here).
    161 
    162 Do not change any parameters except the partition layout and the label name.
    163 It's probably also wisest not to touch the `8 partitions:' line, even
    164 in case you have defined less than eight partitions.
    165 
    166 [Example]
    167 8 partitions:
    168 #        size   offset    fstype   [fsize bsize   cpg]
    169   a:    50176        0    4.2BSD     1024  8192    16   # (Cyl.    0 - 111)
    170   b:    64512    50176      swap                        # (Cyl.  112 - 255)
    171   c:   640192        0   unknown                        # (Cyl.    0 - 1428)
    172   d:   525504   114688    4.2BSD     1024  8192    16   # (Cyl.  256 - 1428)
    173 [End of example]
    174 
    175 __md_prep_disklabel_1
    176 	echo -n "Press [Enter] to continue "
    177 	getresp ""
    178 	disklabel -W ${_disk}
    179 	disklabel -e ${_disk}
    180 }
    181 
    182 md_copy_kernel() {
    183 	echo -n "Copying kernel..."
    184 	cp -p /netbsd /mnt/netbsd
    185 	echo "done."
    186 }
    187 
    188 md_welcome_banner() {
    189 {
    190 	if [ "$MODE" = "install" ]; then
    191 		echo ""
    192 		echo "Welcome to the NetBSD/sparc ${VERSION} installation program."
    193 		cat << \__welcome_banner_1
    194 
    195 This program is designed to help you put NetBSD on your disk,
    196 in a simple and rational way.  You'll be asked several questions,
    197 and it would probably be useful to have your disk's hardware
    198 manual, the installation notes, and a calculator handy.
    199 __welcome_banner_1
    200 
    201 	else
    202 		echo ""
    203 		echo "Welcome to the NetBSD/sparc ${VERSION} upgrade program."
    204 		cat << \__welcome_banner_2
    205 
    206 This program is designed to help you upgrade your NetBSD system in a
    207 simple and rational way.
    208 
    209 As a reminder, installing the `etc' binary set is NOT recommended.
    210 Once the rest of your system has been upgraded, you should manually
    211 merge any changes to files in the `etc' set into those files which
    212 already exist on your system.
    213 __welcome_banner_2
    214 	fi
    215 
    216 cat << \__welcome_banner_3
    217 
    218 As with anything which modifies your disk's contents, this
    219 program can cause SIGNIFICANT data loss, and you are advised
    220 to make sure your data is backed up before beginning the
    221 installation process.
    222 
    223 Default answers are displayed in brackets after the questions.
    224 You can hit Control-C at any time to quit, but if you do so at a
    225 prompt, you may have to hit return.  Also, quitting in the middle of
    226 installation may leave your system in an inconsistent state.
    227 
    228 __welcome_banner_3
    229 } | more
    230 }
    231 
    232 md_not_going_to_install() {
    233 	cat << \__not_going_to_install_1
    234 
    235 OK, then.  Enter `halt' at the prompt to halt the machine.  Once the
    236 machine has halted, power-cycle the system to load new boot code.
    237 
    238 __not_going_to_install_1
    239 }
    240 
    241 md_congrats() {
    242 	local what;
    243 	if [ "$MODE" = "install" ]; then
    244 		what="installed";
    245 	else
    246 		what="upgraded";
    247 	fi
    248 	cat << __congratulations_1
    249 
    250 CONGRATULATIONS!  You have successfully $what NetBSD!
    251 To boot the installed system, enter halt at the command prompt. Once the
    252 system has halted, reset the machine and boot from the disk.
    253 
    254 __congratulations_1
    255 }
    256