Home | History | Annotate | Line # | Download | only in miniroot
install.md revision 1.12
      1   1.1   thorpej #!/bin/sh
      2   1.1   thorpej #
      3  1.12   tsutsui #	$NetBSD: install.md,v 1.12 2006/07/29 10:40:51 tsutsui Exp $
      4   1.1   thorpej #
      5   1.1   thorpej # Copyright (c) 1996 The NetBSD Foundation, Inc.
      6   1.1   thorpej # All rights reserved.
      7   1.1   thorpej #
      8   1.1   thorpej # This code is derived from software contributed to The NetBSD Foundation
      9   1.1   thorpej # by Jason R. Thorpe.
     10   1.1   thorpej #
     11   1.1   thorpej # Redistribution and use in source and binary forms, with or without
     12   1.1   thorpej # modification, are permitted provided that the following conditions
     13   1.1   thorpej # are met:
     14   1.1   thorpej # 1. Redistributions of source code must retain the above copyright
     15   1.1   thorpej #    notice, this list of conditions and the following disclaimer.
     16   1.1   thorpej # 2. Redistributions in binary form must reproduce the above copyright
     17   1.1   thorpej #    notice, this list of conditions and the following disclaimer in the
     18   1.1   thorpej #    documentation and/or other materials provided with the distribution.
     19   1.1   thorpej # 3. All advertising materials mentioning features or use of this software
     20   1.1   thorpej #    must display the following acknowledgement:
     21   1.1   thorpej #        This product includes software developed by the NetBSD
     22   1.1   thorpej #        Foundation, Inc. and its contributors.
     23   1.1   thorpej # 4. Neither the name of The NetBSD Foundation nor the names of its
     24   1.1   thorpej #    contributors may be used to endorse or promote products derived
     25   1.1   thorpej #    from this software without specific prior written permission.
     26   1.1   thorpej #
     27   1.1   thorpej # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     28   1.1   thorpej # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     29   1.1   thorpej # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     30   1.6       jtc # PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     31   1.6       jtc # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     32   1.1   thorpej # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     33   1.1   thorpej # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     34   1.1   thorpej # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     35   1.1   thorpej # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     36   1.1   thorpej # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     37   1.1   thorpej # POSSIBILITY OF SUCH DAMAGE.
     38   1.1   thorpej #
     39   1.1   thorpej 
     40   1.1   thorpej #
     41   1.1   thorpej # machine dependent section of installation/upgrade script
     42   1.1   thorpej #
     43   1.1   thorpej 
     44   1.4   thorpej # Machine-dependent install sets
     45   1.4   thorpej MDSETS=""
     46   1.4   thorpej 
     47   1.1   thorpej md_set_term() {
     48   1.1   thorpej 	if [ ! -z "$TERM" ]; then
     49   1.1   thorpej 		return
     50   1.1   thorpej 	fi
     51   1.1   thorpej 	echo -n "Specify terminal type [hp300h]: "
     52   1.1   thorpej 	getresp "hp300h"
     53   1.1   thorpej 	TERM="$resp"
     54   1.1   thorpej 	export TERM
     55   1.1   thorpej 	# XXX call tset?
     56   1.5   thorpej }
     57   1.5   thorpej 
     58   1.5   thorpej md_makerootwritable() {
     59   1.5   thorpej 	# Was: do_mfs_mount "/tmp" "2048"
     60   1.5   thorpej 	# /tmp is the mount point
     61   1.5   thorpej 	# 2048 is the size in DEV_BIZE blocks
     62   1.5   thorpej 
     63   1.5   thorpej 	umount /tmp > /dev/null 2>&1
     64   1.5   thorpej 	if ! mount_mfs -s 2048 swap /tmp ; then
     65   1.5   thorpej 		cat << \__mfs_failed_1
     66   1.5   thorpej 
     67   1.5   thorpej FATAL ERROR: Can't mount the memory filesystem.
     68   1.5   thorpej 
     69   1.5   thorpej __mfs_failed_1
     70   1.5   thorpej 		exit
     71   1.5   thorpej 	fi
     72   1.5   thorpej 
     73   1.5   thorpej 	# Bleh.  Give mount_mfs a chance to DTRT.
     74   1.5   thorpej 	sleep 2
     75   1.1   thorpej }
     76   1.1   thorpej 
     77   1.1   thorpej md_get_diskdevs() {
     78   1.1   thorpej 	# return available disk devices
     79   1.8        he 	dmesg | awk -F : '/^rd[0-9]*:./ { print $1; }' | sort -u
     80   1.9   tsutsui 	dmesg | awk -F : '/^sd[0-9]*:.*sectors/ { print $1; }' | sort -u
     81   1.1   thorpej }
     82   1.1   thorpej 
     83   1.1   thorpej md_get_cddevs() {
     84   1.1   thorpej 	# return available CD-ROM devices
     85  1.10   tsutsui 	dmesg | awk -F : '/^cd[0-9]*:.*cdrom/ { print $1; }' | sort -u
     86   1.1   thorpej }
     87   1.1   thorpej 
     88   1.1   thorpej md_get_ifdevs() {
     89   1.1   thorpej 	# return available network interfaces
     90   1.8        he 	dmesg | awk -F : '/^le[0-9]*:/ { print $1; }' | sort -u
     91   1.1   thorpej }
     92   1.1   thorpej 
     93   1.1   thorpej md_installboot() {
     94   1.1   thorpej 	# $1 is the root disk
     95   1.1   thorpej 
     96   1.1   thorpej 	echo -n "Installing boot block..."
     97  1.11   tsutsui 	/usr/sbin/installboot -v /dev/r${1}c  /usr/mdec/uboot.lif
     98   1.1   thorpej 	echo "done."
     99   1.1   thorpej }
    100   1.1   thorpej 
    101   1.8        he grep_check_q () {
    102   1.8        he 	pattern=$1; shift
    103   1.8        he 	awk 'BEGIN{ es=1; } /'"$pattern"'/{ es=0; } END{ exit es; }' "$@"
    104   1.8        he }
    105   1.8        he 
    106   1.8        he plain_grep () {
    107   1.8        he 	pattern=$1; shift
    108   1.8        he 	awk "/$pattern/"'{ print; }' "$@"
    109   1.8        he }
    110   1.8        he 
    111   1.1   thorpej md_checkfordisklabel() {
    112   1.1   thorpej 	# $1 is the disk to check
    113   1.1   thorpej 
    114   1.1   thorpej 	disklabel -r $1 > /dev/null 2> /tmp/checkfordisklabel
    115   1.8        he 	if grep_check_q "no disk label" /tmp/checkfordisklabel; then
    116   1.1   thorpej 		rval="1"
    117   1.8        he 	elif grep_check_q "disk label corrupted" /tmp/checkfordisklabel; then
    118   1.1   thorpej 		rval="2"
    119   1.1   thorpej 	else
    120   1.1   thorpej 		rval="0"
    121   1.1   thorpej 	fi
    122   1.1   thorpej 
    123   1.1   thorpej 	rm -f /tmp/checkfordisklabel
    124   1.1   thorpej }
    125   1.1   thorpej 
    126   1.1   thorpej hp300_init_label_scsi_disk() {
    127   1.1   thorpej 	# $1 is the disk to label
    128   1.1   thorpej 
    129   1.1   thorpej 	# Name the disks we install in the temporary fstab.
    130   1.1   thorpej 	if [ "X${_disk_instance}" = "X" ]; then
    131   1.1   thorpej 		_disk_instance="0"
    132   1.1   thorpej 	else
    133   1.1   thorpej 		_disk_instance=`expr $_disk_instance + 1`
    134   1.1   thorpej 	fi
    135   1.1   thorpej 	_cur_disk_name="install-disk-${_disk_instance}"
    136   1.1   thorpej 
    137   1.1   thorpej 	# Get geometry information from the user.
    138   1.1   thorpej 	more << \__scsi_label_1
    139   1.1   thorpej 
    140   1.1   thorpej You will need to provide some information about your disk's geometry.
    141   1.1   thorpej Geometry info for SCSI disks was printed at boot time.  If that information
    142   1.1   thorpej is not available, use the information provided in your disk's manual.
    143   1.1   thorpej Please note that the geometry printed at boot time is preferred.
    144   1.1   thorpej 
    145   1.1   thorpej IMPORTANT NOTE: due to a limitation in the disklabel(8) program, the
    146   1.1   thorpej number of cylinders on the disk will be increased by 1 so that the initial
    147   1.1   thorpej label can be placed on disk for editing.  When the disklabel editor appears,
    148   1.1   thorpej make absolutely certain you subtract 1 from the total number of cylinders,
    149   1.1   thorpej and adjust the size of partition 'c' such that:
    150   1.1   thorpej 
    151   1.1   thorpej 	size = (sectors per track) * (tracks per cyl) * (total cylinders)
    152   1.1   thorpej 
    153   1.1   thorpej Note that the disklabel editor will be run twice; once to set the size of
    154   1.1   thorpej partition 'c' and correct the geometry, and again so that you may correctly
    155   1.1   thorpej edit the partition map.  This is to work around the afore mentioned
    156   1.1   thorpej limitation in disklabel(8).  Apologies offered in advance.
    157   1.1   thorpej 
    158   1.1   thorpej __scsi_label_1
    159   1.1   thorpej 
    160   1.1   thorpej 	# Give the opportunity to review the boot messages.
    161   1.1   thorpej 	echo -n	"Review boot messages now? [y] "
    162   1.1   thorpej 	getresp "y"
    163   1.1   thorpej 	case "$resp" in
    164   1.1   thorpej 		y*|Y*)
    165   1.1   thorpej 			(echo ""; dmesg; echo "") | more
    166   1.1   thorpej 			;;
    167   1.1   thorpej 
    168   1.1   thorpej 		*)
    169   1.1   thorpej 			;;
    170   1.1   thorpej 	esac
    171   1.1   thorpej 
    172   1.1   thorpej 	echo	""
    173   1.1   thorpej 	echo -n	"Number of bytes per disk sector? [512] "
    174   1.1   thorpej 	getresp "512"
    175   1.1   thorpej 	_secsize="$resp"
    176   1.1   thorpej 
    177   1.1   thorpej 	resp=""		# force one iteration
    178   1.1   thorpej 	while [ "X${resp}" = "X" ]; do
    179   1.1   thorpej 		echo -n	"Number of cylinders? "
    180   1.1   thorpej 		getresp ""
    181   1.1   thorpej 	done
    182   1.1   thorpej 	_cylinders="$resp"
    183   1.1   thorpej 	_fudge_cyl=`expr $_cylinders + 1`
    184   1.1   thorpej 
    185   1.1   thorpej 	resp=""		# force one iteration
    186   1.1   thorpej 	while [ "X${resp}" = "X" ]; do
    187   1.1   thorpej 		echo -n	"Number of tracks (heads)? "
    188   1.1   thorpej 		getresp ""
    189   1.1   thorpej 	done
    190   1.1   thorpej 	_tracks_per_cyl="$resp"
    191   1.1   thorpej 
    192   1.1   thorpej 	resp=""		# force one iteration
    193   1.1   thorpej 	while [ "X${resp}" = "X" ]; do
    194   1.1   thorpej 		echo -n	"Number of disk sectors (blocks)? "
    195   1.1   thorpej 		getresp ""
    196   1.1   thorpej 	done
    197   1.1   thorpej 	_nsectors="$resp"
    198   1.1   thorpej 
    199   1.1   thorpej 	# Calculate some values we need.
    200   1.1   thorpej 	_sec_per_cyl=`expr $_nsectors / $_cylinders`
    201   1.1   thorpej 	_sec_per_track=`expr $_sec_per_cyl / $_tracks_per_cyl`
    202   1.1   thorpej 	_new_c_size=`expr $_sec_per_track \* $_tracks_per_cyl \* $_cylinders`
    203   1.1   thorpej 
    204   1.1   thorpej 	# Emit a disktab entry, suitable for getting started.
    205   1.1   thorpej 	# What we have is a `c' partition with the total number of
    206   1.1   thorpej 	# blocks, and an `a' partition with 1 sector; just large enough
    207   1.1   thorpej 	# to open.  Don't ask.
    208   1.1   thorpej 	echo	"" >> /etc/disktab
    209   1.1   thorpej 	echo	"# Created by install" >> /etc/disktab
    210   1.1   thorpej 	echo	"${_cur_disk_name}:\\" >> /etc/disktab
    211   1.1   thorpej 	echo -n	"	:ty=winchester:ns#${_sec_per_track}:" >> /etc/disktab
    212   1.1   thorpej 	echo	"nt#${_tracks_per_cyl}:nc#${_fudge_cyl}:\\" >> /etc/disktab
    213   1.1   thorpej 	echo	"	:pa#1:\\" >> /etc/disktab
    214   1.1   thorpej 	echo	"	:pc#${_nsectors}:" >> /etc/disktab
    215   1.1   thorpej 
    216   1.1   thorpej 	# Ok, here's what we need to do.  First of all, we install
    217   1.1   thorpej 	# this initial label by opening the `c' partition of the disk
    218   1.1   thorpej 	# and using the `-r' flag for disklabel(8).  However, because
    219   1.1   thorpej 	# of limitations in disklabel(8), we've had to fudge the number
    220   1.1   thorpej 	# of cylinders up 1 so that disklabel(8) doesn't complain about
    221   1.1   thorpej 	# `c' running past the end of the disk, which can be quite
    222   1.1   thorpej 	# common even with OEM HP drives!  So, we've given ourselves
    223   1.1   thorpej 	# an `a' partition, which is the minimum needed to open the disk
    224   1.1   thorpej 	# so that we can perform the DIOCWDLABEL ioctl.  So, once the
    225   1.1   thorpej 	# initial label is installed, we open the `a' partition so that
    226   1.1   thorpej 	# we can fix up the number of cylinders and make the size of
    227   1.1   thorpej 	# `c' come out to (ncyl * ntracks_per_cyl * nsec_per_track).
    228   1.1   thorpej 	# After that's done, we re-open `c' and let the user actually
    229   1.1   thorpej 	# edit the partition table.  It's horrible, I know.  Bleh.
    230   1.1   thorpej 
    231   1.1   thorpej 	disklabel -W ${1}
    232   1.1   thorpej 	if ! disklabel -w -r ${1} ${_cur_disk_name}; then
    233   1.1   thorpej 		echo ""
    234   1.1   thorpej 		echo "ERROR: can't bootstrap disklabel!"
    235   1.1   thorpej 		rval="1"
    236   1.1   thorpej 		return
    237   1.1   thorpej 	fi
    238   1.1   thorpej 
    239   1.1   thorpej 	echo ""
    240   1.1   thorpej 	echo "The disklabel editor will now start.  During this phase, you"
    241   1.1   thorpej 	echo "must reset the 'cylinders' value to ${_cylinders}, and adjust"
    242   1.1   thorpej 	echo "the size of partition 'c' to ${_new_c_size}.  Do not modify"
    243   1.1   thorpej 	echo "the partition map at this time.  You will have the opportunity"
    244   1.1   thorpej 	echo "to do so in a moment."
    245   1.1   thorpej 	echo ""
    246   1.1   thorpej 	echo -n	"Press <return> to continue. "
    247   1.1   thorpej 	getresp ""
    248   1.1   thorpej 
    249   1.1   thorpej 	disklabel -W ${1}
    250   1.1   thorpej 	if ! disklabel -e /dev/r${1}a; then
    251   1.1   thorpej 		echo ""
    252   1.1   thorpej 		echo "ERROR: can't fixup geometry!"
    253   1.1   thorpej 		rval="1"
    254   1.1   thorpej 		return
    255   1.1   thorpej 	fi
    256   1.1   thorpej 
    257   1.1   thorpej 	cat << \__explain_motives_2
    258   1.1   thorpej 
    259   1.1   thorpej Now that you have corrected the geometry of your disk, you may edit the
    260   1.1   thorpej partition map.  Don't forget to fill in the fsize (frag size), bsize
    261   1.1   thorpej (filesystem block size), and cpg (cylinders per group) values.  If you
    262   1.1   thorpej are unsure what these should be, use:
    263   1.1   thorpej 
    264   1.1   thorpej 	fsize: 1024
    265   1.1   thorpej 	bsize: 4096
    266   1.1   thorpej 	cpg: 16
    267   1.1   thorpej 
    268   1.1   thorpej __explain_motives_2
    269   1.1   thorpej 	echo -n	"Press <return> to continue. "
    270   1.1   thorpej 	getresp ""
    271   1.1   thorpej 
    272   1.1   thorpej 	rval="0"
    273   1.1   thorpej 	return
    274   1.1   thorpej }
    275   1.1   thorpej 
    276   1.1   thorpej hp300_init_label_hpib_disk() {
    277   1.1   thorpej 	# $1 is the disk to label
    278   1.1   thorpej 
    279   1.1   thorpej 	# We look though the boot messages attempting to find
    280   1.1   thorpej 	# the model number for the provided disk.
    281   1.1   thorpej 	_hpib_disktype=""
    282   1.8        he 	if dmesg | grep_check_q "${1}: "; then
    283   1.8        he 		_hpib_disktype=HP`dmesg | plain_grep "${1}: " | sort -u | \
    284   1.1   thorpej 		    awk '{print $2}'`
    285   1.1   thorpej 	fi
    286   1.1   thorpej 	if [ "X${_hpib_disktype}" = "X" ]; then
    287   1.1   thorpej 		echo ""
    288   1.1   thorpej 		echo "ERROR: $1 doesn't appear to exist?!"
    289   1.1   thorpej 		rval="1"
    290   1.1   thorpej 		return
    291   1.1   thorpej 	fi
    292   1.1   thorpej 
    293   1.1   thorpej 	# Peer through /etc/disktab to see if the disk has a "default"
    294   1.1   thorpej 	# layout.  If it doesn't, we have to treat it like a SCSI disk;
    295   1.1   thorpej 	# i.e. prompt for geometry, and create a default to place
    296   1.1   thorpej 	# on the disk.
    297   1.8        he 	if ! grep_check_q "${_hpib_disktype}[:|]" /etc/disktab; then
    298   1.1   thorpej 		echo ""
    299   1.1   thorpej 		echo "WARNING: can't find defaults for $1 ($_hpib_disktype)"
    300   1.1   thorpej 		echo ""
    301   1.1   thorpej 		hp300_init_label_scsi_disk $1
    302   1.1   thorpej 		return
    303   1.1   thorpej 	fi
    304   1.1   thorpej 
    305   1.1   thorpej 	# We've found the defaults.  Now use them to place an initial
    306   1.1   thorpej 	# disklabel on the disk.
    307   1.1   thorpej 	# XXX What kind of ugliness to we have to deal with to get around
    308   1.1   thorpej 	# XXX stupidity on the part of disklabel semantics?
    309   1.1   thorpej 	disklabel -W ${1}
    310   1.1   thorpej 	if ! disklabel -r -w ${1} $_hpib_disktype; then
    311   1.1   thorpej 		# Error message displayed by disklabel(8)
    312   1.1   thorpej 		echo ""
    313   1.1   thorpej 		echo "ERROR: can't install default label!"
    314   1.1   thorpej 		echo ""
    315   1.1   thorpej 		echo -n	"Try a different method? [y] "
    316   1.1   thorpej 		getresp "y"
    317   1.1   thorpej 		case "$resp" in
    318   1.1   thorpej 			y*|Y*)
    319   1.1   thorpej 				hp300_init_label_scsi_disk $1
    320   1.1   thorpej 				return
    321   1.1   thorpej 				;;
    322   1.1   thorpej 
    323   1.1   thorpej 			*)
    324   1.1   thorpej 				rval="1"
    325   1.1   thorpej 				return
    326   1.1   thorpej 				;;
    327   1.1   thorpej 		esac
    328   1.1   thorpej 	fi
    329   1.1   thorpej 
    330   1.1   thorpej 	rval="0"
    331   1.1   thorpej 	return
    332   1.1   thorpej }
    333   1.1   thorpej 
    334   1.1   thorpej md_labeldisk() {
    335   1.1   thorpej 	# $1 is the disk to label
    336   1.1   thorpej 
    337   1.1   thorpej 	# Check to see if there is a disklabel present on the device.
    338   1.1   thorpej 	# If so, we can just edit it.  If not, we must first install
    339   1.1   thorpej 	# a default label.
    340   1.1   thorpej 	md_checkfordisklabel $1
    341   1.1   thorpej 	case "$rval" in
    342   1.1   thorpej 		0)
    343   1.1   thorpej 			# Go ahead and just edit the disklabel.
    344   1.1   thorpej 			disklabel -W $1
    345   1.1   thorpej 			disklabel -e $1
    346   1.1   thorpej 			;;
    347   1.1   thorpej 
    348   1.1   thorpej 		*)
    349   1.1   thorpej 		echo -n "No disklabel present, installing a default for type: "
    350   1.1   thorpej 			case "$1" in
    351   1.1   thorpej 				rd*)
    352   1.1   thorpej 					echo "HP-IB"
    353   1.1   thorpej 					hp300_init_label_hpib_disk $1
    354   1.1   thorpej 					;;
    355   1.1   thorpej 
    356   1.1   thorpej 				sd*)
    357   1.1   thorpej 					echo "SCSI"
    358   1.1   thorpej 					hp300_init_label_scsi_disk $1
    359   1.1   thorpej 					;;
    360   1.1   thorpej 
    361   1.1   thorpej 				*)
    362   1.1   thorpej 					# Shouldn't happen, but...
    363   1.1   thorpej 					echo "unknown?!  Giving up."
    364   1.1   thorpej 					return;
    365   1.1   thorpej 					;;
    366   1.1   thorpej 			esac
    367   1.1   thorpej 
    368   1.1   thorpej 			# Check to see if installing the default was
    369   1.1   thorpej 			# successful.  If so, go ahead and pop into the
    370   1.1   thorpej 			# disklabel editor.
    371   1.1   thorpej 			if [ "X${rval}" != X"0" ]; then
    372   1.1   thorpej 				echo "Sorry, can't label this disk."
    373   1.1   thorpej 				echo ""
    374   1.1   thorpej 				return;
    375   1.1   thorpej 			fi
    376   1.1   thorpej 
    377   1.1   thorpej 			# We have some defaults installed.  Pop into
    378   1.1   thorpej 			# the disklabel editor.
    379   1.1   thorpej 			disklabel -W $1
    380   1.1   thorpej 			if ! disklabel -e $1; then
    381   1.1   thorpej 				echo ""
    382   1.1   thorpej 				echo "ERROR: couldn't set partition map for $1"
    383   1.1   thorpej 				echo ""
    384   1.1   thorpej 			fi
    385   1.1   thorpej 	esac
    386   1.1   thorpej }
    387   1.1   thorpej 
    388   1.1   thorpej md_prep_disklabel() {
    389   1.1   thorpej 	# $1 is the root disk
    390   1.1   thorpej 
    391   1.1   thorpej 	# Make sure there's a disklabel there.  If there isn't, puke after
    392   1.1   thorpej 	# disklabel prints the error message.
    393   1.1   thorpej 	md_checkfordisklabel $1
    394   1.1   thorpej 	case "$resp" in
    395   1.1   thorpej 		1)
    396   1.1   thorpej 			cat << \__md_prep_disklabel_1
    397   1.1   thorpej 
    398   1.1   thorpej FATAL ERROR: There is no disklabel present on the root disk!  You must
    399   1.1   thorpej label the disk with SYS_INST before continuing.
    400   1.1   thorpej 
    401   1.1   thorpej __md_prep_disklabel_1
    402   1.1   thorpej 			exit
    403   1.1   thorpej 			;;
    404   1.1   thorpej 
    405   1.1   thorpej 		2)
    406   1.1   thorpej 			cat << \__md_prep_disklabel_2
    407   1.1   thorpej 
    408   1.1   thorpej FATAL ERROR: The disklabel on the root disk is corrupted!  You must
    409   1.1   thorpej re-label the disk with SYS_INST before continuing.
    410   1.1   thorpej 
    411   1.1   thorpej __md_prep_disklabel_2
    412   1.1   thorpej 			exit
    413   1.1   thorpej 			;;
    414   1.1   thorpej 
    415   1.1   thorpej 		*)
    416   1.1   thorpej 			;;
    417   1.1   thorpej 	esac
    418   1.1   thorpej 
    419   1.1   thorpej 	# Give the user the opportinuty to edit the root disklabel.
    420   1.1   thorpej 	cat << \__md_prep_disklabel_3
    421   1.1   thorpej 
    422   1.1   thorpej You have already placed a disklabel onto the target root disk.
    423   1.1   thorpej However, due to the limitations of the standalone program used
    424   1.1   thorpej you may want to edit that label to change partition type information.
    425   1.1   thorpej You will be given the opporunity to do that now.  Note that you may
    426   1.1   thorpej not change the size or location of any presently open partition.
    427   1.1   thorpej 
    428   1.1   thorpej __md_prep_disklabel_3
    429   1.1   thorpej 	echo -n "Do you wish to edit the root disklabel? [y] "
    430   1.1   thorpej 	getresp "y"
    431   1.1   thorpej 	case "$resp" in
    432   1.1   thorpej 		y*|Y*)
    433   1.1   thorpej 			disklabel -W $1
    434   1.1   thorpej 			disklabel -e $1
    435   1.1   thorpej 			;;
    436   1.1   thorpej 
    437   1.1   thorpej 		*)
    438   1.1   thorpej 			;;
    439   1.1   thorpej 	esac
    440   1.1   thorpej 
    441   1.1   thorpej 	cat << \__md_prep_disklabel_4
    442   1.1   thorpej 
    443   1.1   thorpej You will now be given the opportunity to place disklabels on any additional
    444   1.1   thorpej disks on your system.
    445   1.1   thorpej __md_prep_disklabel_4
    446   1.1   thorpej 
    447   1.1   thorpej 	_DKDEVS=`rmel ${ROOTDISK} ${_DKDEVS}`
    448   1.1   thorpej 	resp="X"	# force at least one iteration
    449   1.1   thorpej 	while [ "X$resp" != X"done" ]; do
    450   1.1   thorpej 		labelmoredisks
    451   1.1   thorpej 	done
    452   1.2   thorpej }
    453   1.2   thorpej 
    454   1.2   thorpej md_copy_kernel() {
    455  1.12   tsutsui 	if [ ! -f /mnt/netbsd ]; then
    456  1.12   tsutsui 		echo -n "No kernel set extracted. Copying miniroot kernel..."
    457  1.12   tsutsui 		cp -p /netbsd /mnt/netbsd
    458  1.12   tsutsui 		echo "done."
    459   1.7  gmcgarry 
    460  1.12   tsutsui 		cat << __md_copy_kernel_1
    461   1.7  gmcgarry 
    462   1.7  gmcgarry The INSTALL kernel from the miniroot has been copied to your root disk.
    463   1.7  gmcgarry It has minimal facilities enabled.  The first thing you should do after
    464   1.7  gmcgarry installation is install an appropriate kernel for your machine (such as
    465   1.7  gmcgarry the GENERIC kernel).
    466   1.7  gmcgarry 
    467   1.7  gmcgarry __md_copy_kernel_1
    468  1.12   tsutsui 		echo -n	"Press <return> to continue. "
    469  1.12   tsutsui 		getresp ""
    470  1.12   tsutsui 	fi
    471   1.1   thorpej }
    472   1.1   thorpej 
    473   1.1   thorpej 	# Note, while they might not seem machine-dependent, the
    474   1.1   thorpej 	# welcome banner and the punt message may contain information
    475   1.1   thorpej 	# and/or instructions specific to the type of machine.
    476   1.1   thorpej 
    477   1.1   thorpej md_welcome_banner() {
    478   1.1   thorpej (
    479   1.1   thorpej 	echo	""
    480   1.1   thorpej 	echo	"Welcome to the NetBSD/hp300 ${VERSION} installation program."
    481   1.1   thorpej 	cat << \__welcome_banner_1
    482   1.1   thorpej 
    483   1.1   thorpej This program is designed to help you install NetBSD on your system in a
    484   1.1   thorpej simple and rational way.  You'll be asked several questions, and it would
    485   1.1   thorpej probably be useful to have your disk's hardware manual, the installation
    486   1.1   thorpej notes, and a calculator handy.
    487   1.1   thorpej 
    488   1.1   thorpej In particular, you will need to know some reasonably detailed
    489   1.1   thorpej information about your disk's geometry.  This program can determine
    490   1.1   thorpej some limited information about certain specific types of HP-IB disks.
    491   1.1   thorpej If you have SCSI disks, however, prior knowledge of disk geometry
    492   1.1   thorpej is absolutely essential.  The kernel will attempt to display geometry
    493   1.1   thorpej information for SCSI disks during boot, if possible.  If you did not
    494   1.1   thorpej make it note of it before, you may wish to reboot and jot down your
    495   1.1   thorpej disk's geometry before proceeding.
    496   1.1   thorpej 
    497   1.1   thorpej As with anything which modifies your hard disk's contents, this
    498   1.1   thorpej program can cause SIGNIFICANT data loss, and you are advised
    499   1.1   thorpej to make sure your hard drive is backed up before beginning the
    500   1.1   thorpej installation process.
    501   1.1   thorpej 
    502   1.1   thorpej Default answers are displyed in brackets after the questions.
    503   1.1   thorpej You can hit Control-C at any time to quit, but if you do so at a
    504   1.1   thorpej prompt, you may have to hit return.  Also, quitting in the middle of
    505   1.1   thorpej installation may leave your system in an inconsistent state.
    506   1.1   thorpej 
    507   1.1   thorpej __welcome_banner_1
    508   1.1   thorpej ) | more
    509   1.1   thorpej }
    510   1.1   thorpej 
    511   1.1   thorpej md_not_going_to_install() {
    512   1.1   thorpej 		cat << \__not_going_to_install_1
    513   1.1   thorpej 
    514   1.1   thorpej OK, then.  Enter 'halt' at the prompt to halt the machine.  Once the
    515   1.1   thorpej machine has halted, power-cycle the system to load new boot code.
    516   1.1   thorpej 
    517   1.1   thorpej __not_going_to_install_1
    518   1.1   thorpej }
    519   1.1   thorpej 
    520   1.1   thorpej md_congrats() {
    521   1.1   thorpej 	cat << \__congratulations_1
    522   1.1   thorpej 
    523   1.1   thorpej CONGRATULATIONS!  You have successfully installed NetBSD!  To boot the
    524   1.1   thorpej installed system, enter halt at the command prompt.  Once the system has
    525   1.1   thorpej halted, power-cycle the machine in order to load new boot code.  Make sure
    526   1.1   thorpej you boot from the root disk.
    527   1.1   thorpej 
    528   1.1   thorpej __congratulations_1
    529   1.1   thorpej }
    530   1.1   thorpej 
    531   1.4   thorpej md_native_fstype() {
    532   1.4   thorpej 	# Nothing to do.
    533   1.4   thorpej }
    534   1.4   thorpej 
    535   1.4   thorpej md_native_fsopts() {
    536   1.4   thorpej 	# Nothing to do.
    537   1.4   thorpej }
    538