Home | History | Annotate | Line # | Download | only in sparc
install.md revision 1.12
      1  1.12      mrg #	$NetBSD: install.md,v 1.12 1999/06/27 12:55:59 mrg Exp $
      2   1.1       pk #
      3   1.2  thorpej #
      4   1.2  thorpej # Copyright (c) 1996 The NetBSD Foundation, Inc.
      5   1.1       pk # All rights reserved.
      6   1.1       pk #
      7   1.2  thorpej # This code is derived from software contributed to The NetBSD Foundation
      8   1.2  thorpej # by Jason R. Thorpe.
      9   1.2  thorpej #
     10   1.1       pk # Redistribution and use in source and binary forms, with or without
     11   1.1       pk # modification, are permitted provided that the following conditions
     12   1.1       pk # are met:
     13   1.1       pk # 1. Redistributions of source code must retain the above copyright
     14   1.1       pk #    notice, this list of conditions and the following disclaimer.
     15   1.1       pk # 2. Redistributions in binary form must reproduce the above copyright
     16   1.1       pk #    notice, this list of conditions and the following disclaimer in the
     17   1.1       pk #    documentation and/or other materials provided with the distribution.
     18   1.1       pk # 3. All advertising materials mentioning features or use of this software
     19   1.1       pk #    must display the following acknowledgement:
     20   1.2  thorpej #        This product includes software developed by the NetBSD
     21   1.2  thorpej #        Foundation, Inc. and its contributors.
     22   1.2  thorpej # 4. Neither the name of The NetBSD Foundation nor the names of its
     23   1.2  thorpej #    contributors may be used to endorse or promote products derived
     24   1.2  thorpej #    from this software without specific prior written permission.
     25   1.1       pk #
     26   1.2  thorpej # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27   1.2  thorpej # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28   1.2  thorpej # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29  1.11      jtc # PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30  1.11      jtc # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31   1.2  thorpej # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32   1.2  thorpej # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33   1.2  thorpej # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34   1.2  thorpej # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35   1.2  thorpej # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36   1.2  thorpej # POSSIBILITY OF SUCH DAMAGE.
     37   1.1       pk #
     38   1.1       pk 
     39   1.1       pk #
     40   1.1       pk # machine dependent section of installation/upgrade script.
     41   1.1       pk #
     42   1.1       pk 
     43   1.8  thorpej # Machine-dependent install sets
     44  1.12      mrg MDSETS="kern xbase xcomp xcontrib xfont xserver"
     45  1.10       pk 
     46  1.10       pk if [ "$MODE" = upgrade ]; then
     47  1.10       pk 	RELOCATED_FILES_13="${RELOCATED_FILES_13} /usr/sbin/installboot /usr/mdec/installboot"
     48  1.10       pk fi
     49   1.8  thorpej 
     50  1.12      mrg # Mount /kern to get at /kern/msgbuf
     51  1.12      mrg mount -t kernfs none /kern
     52  1.12      mrg 
     53   1.1       pk md_set_term() {
     54   1.1       pk 	if [ ! -z "$TERM" ]; then
     55   1.1       pk 		return
     56   1.1       pk 	fi
     57   1.1       pk 	echo -n "Specify terminal type [sun]: "
     58   1.1       pk 	getresp "sun"
     59   1.1       pk 	TERM="$resp"
     60   1.1       pk 	export TERM
     61   1.1       pk }
     62   1.1       pk 
     63   1.9      jtc md_makerootwritable() {
     64   1.9      jtc 	# Was: do_mfs_mount "/tmp" "2048"
     65   1.9      jtc 	# /tmp is the mount point
     66   1.9      jtc 	# 2048 is the size in DEV_BIZE blocks
     67   1.9      jtc 
     68   1.9      jtc 	umount /tmp > /dev/null 2>&1
     69   1.9      jtc 	if ! mount_mfs -s 2048 swap /tmp ; then
     70   1.9      jtc 		cat << \__mfs_failed_1
     71   1.9      jtc 
     72   1.9      jtc FATAL ERROR: Can't mount the memory filesystem.
     73   1.9      jtc 
     74   1.9      jtc __mfs_failed_1
     75   1.9      jtc 		exit
     76   1.9      jtc 	fi
     77   1.9      jtc 
     78   1.9      jtc 	# Bleh.  Give mount_mfs a chance to DTRT.
     79   1.9      jtc 	sleep 2
     80   1.9      jtc }
     81   1.9      jtc 
     82   1.1       pk md_get_diskdevs() {
     83   1.1       pk 	# return available disk devices
     84  1.12      mrg 	< /kern/msgbuf sed -n -e 's/^\(sd[0-9]\) .*/\1/p' -e 's/^\(x[dy][0-9]\) .*/\1/p' | sort -u
     85   1.1       pk }
     86   1.1       pk 
     87   1.1       pk md_get_cddevs() {
     88   1.1       pk 	# return available CDROM devices
     89  1.12      mrg 	< /kern/msgbuf sed -n -e 's/^\(cd[0-9]\) .*/\1/p' | sort -u
     90   1.1       pk }
     91   1.1       pk 
     92   1.1       pk md_get_ifdevs() {
     93   1.1       pk 	# return available network devices
     94  1.12      mrg 	< /kern/msgbuf sed -n -e 's/^\(le[0-9]\) .*/\1/p' -e 's/^\(ie[0-9]\) .*/\1/p' | sort -u
     95   1.1       pk }
     96   1.1       pk 
     97   1.4      leo md_get_partition_range() {
     98   1.4      leo     # return range of valid partition letters
     99   1.4      leo     echo "[a-h]"
    100   1.4      leo }
    101   1.4      leo 
    102   1.1       pk md_installboot() {
    103   1.1       pk 	echo "Installing boot block..."
    104   1.5       pk 	/usr/mdec/binstall ffs /mnt
    105   1.1       pk }
    106   1.1       pk 
    107   1.4      leo md_native_fstype() {
    108   1.4      leo }
    109   1.4      leo 
    110   1.4      leo md_native_fsopts() {
    111   1.4      leo }
    112   1.4      leo 
    113   1.1       pk md_checkfordisklabel() {
    114   1.1       pk 	# $1 is the disk to check
    115   1.6       pk 	local rval
    116  1.12      mrg 	local cfdl
    117   1.1       pk 
    118  1.12      mrg 	cfdl=`disklabel $1 2>&1 > /dev/null | \
    119  1.12      mrg 	    sed -n -e '/no disk label/{s/.*/ndl/p;q;}; \
    120  1.12      mrg 		 /disk label corrupted/{s/.*/dlc/p;q;}; \
    121  1.12      mrg 		 $s/.*/no/p'`
    122  1.12      mrg 	if [ x$cfdl = xndl ]; then
    123   1.6       pk 		rval=1
    124  1.12      mrg 	elif [ x$cfdl = xdlc ]; then
    125   1.6       pk 		rval=2
    126   1.1       pk 	else
    127   1.6       pk 		rval=0
    128   1.1       pk 	fi
    129   1.1       pk 
    130   1.6       pk 	return $rval
    131   1.1       pk }
    132   1.1       pk 
    133   1.1       pk md_prep_disklabel()
    134   1.1       pk {
    135   1.6       pk 	local _disk
    136   1.6       pk 
    137   1.6       pk 	_disk=$1
    138   1.6       pk 	md_checkfordisklabel $_disk
    139   1.6       pk 	case $? in
    140   1.6       pk 	0)
    141   1.6       pk 		echo -n "Do you wish to edit the disklabel on $_disk? [y]"
    142   1.6       pk 		;;
    143   1.6       pk 	1)
    144   1.6       pk 		echo "WARNING: Disk $_disk has no label"
    145   1.6       pk 		echo -n "Do you want to create one with the disklabel editor? [y]"
    146   1.6       pk 		;;
    147   1.6       pk 	2)
    148   1.6       pk 		echo "WARNING: Label on disk $_disk is corrupted"
    149   1.6       pk 		echo -n "Do you want to try and repair the damage using the disklabel editor? [y]"
    150   1.6       pk 		;;
    151   1.6       pk 	esac
    152   1.6       pk 
    153   1.6       pk 	getresp "y"
    154   1.6       pk 	case "$resp" in
    155   1.6       pk 	y*|Y*) ;;
    156   1.6       pk 	*)	return ;;
    157   1.6       pk 	esac
    158   1.6       pk 
    159   1.1       pk 	# display example
    160   1.1       pk 	cat << \__md_prep_disklabel_1
    161   1.6       pk 
    162   1.1       pk Here is an example of what the partition information will look like once
    163   1.1       pk you have entered the disklabel editor. Disk partition sizes and offsets
    164   1.1       pk are in sector (most likely 512 bytes) units. Make sure these size/offset
    165   1.1       pk pairs are on cylinder boundaries (the number of sector per cylinder is
    166   1.1       pk given in the `sectors/cylinder' entry, which is not shown here).
    167   1.1       pk 
    168   1.1       pk Do not change any parameters except the partition layout and the label name.
    169   1.1       pk It's probably also wisest not to touch the `8 partitions:' line, even
    170   1.1       pk in case you have defined less than eight partitions.
    171   1.1       pk 
    172   1.1       pk [Example]
    173   1.1       pk 8 partitions:
    174   1.1       pk #        size   offset    fstype   [fsize bsize   cpg]
    175   1.1       pk   a:    50176        0    4.2BSD     1024  8192    16   # (Cyl.    0 - 111)
    176   1.1       pk   b:    64512    50176      swap                        # (Cyl.  112 - 255)
    177   1.1       pk   c:   640192        0   unknown                        # (Cyl.    0 - 1428)
    178   1.1       pk   d:   525504   114688    4.2BSD     1024  8192    16   # (Cyl.  256 - 1428)
    179   1.1       pk [End of example]
    180   1.1       pk 
    181   1.1       pk __md_prep_disklabel_1
    182   1.5       pk 	echo -n "Press [Enter] to continue "
    183   1.5       pk 	getresp ""
    184   1.6       pk 	disklabel -W ${_disk}
    185  1.12      mrg 	if [ -f /usr/bin/vi ]; then 
    186  1.12      mrg 		disklabel -e ${_disk}
    187  1.12      mrg 	else
    188  1.12      mrg 		disklabel -i ${_disk}
    189  1.12      mrg 	fi
    190   1.4      leo }
    191   1.3       pk 
    192   1.4      leo md_copy_kernel() {
    193  1.12      mrg 	if [ -f /mnt/netbsd.GENERIC ]; then
    194  1.12      mrg 		echo -n "Linking /netbsd.GENERIC to /netbsd ... "
    195  1.12      mrg 		ln /mnt/netbsd.GENERIC /mnt/netbsd
    196  1.12      mrg 		echo "done."
    197  1.12      mrg 	else
    198  1.12      mrg 		echo "WARNING: No /netbsd.GENERIC!  Please install /netbsd manually!"
    199  1.12      mrg 	fi
    200   1.1       pk }
    201   1.1       pk 
    202   1.1       pk md_welcome_banner() {
    203   1.1       pk {
    204   1.1       pk 	if [ "$MODE" = "install" ]; then
    205   1.1       pk 		echo ""
    206   1.1       pk 		echo "Welcome to the NetBSD/sparc ${VERSION} installation program."
    207   1.1       pk 		cat << \__welcome_banner_1
    208   1.1       pk 
    209   1.1       pk This program is designed to help you put NetBSD on your disk,
    210   1.1       pk in a simple and rational way.  You'll be asked several questions,
    211   1.1       pk and it would probably be useful to have your disk's hardware
    212   1.1       pk manual, the installation notes, and a calculator handy.
    213   1.1       pk __welcome_banner_1
    214   1.1       pk 
    215   1.1       pk 	else
    216   1.1       pk 		echo ""
    217   1.1       pk 		echo "Welcome to the NetBSD/sparc ${VERSION} upgrade program."
    218   1.1       pk 		cat << \__welcome_banner_2
    219   1.1       pk 
    220   1.1       pk This program is designed to help you upgrade your NetBSD system in a
    221   1.1       pk simple and rational way.
    222   1.1       pk 
    223   1.1       pk As a reminder, installing the `etc' binary set is NOT recommended.
    224   1.1       pk Once the rest of your system has been upgraded, you should manually
    225   1.1       pk merge any changes to files in the `etc' set into those files which
    226   1.1       pk already exist on your system.
    227   1.1       pk __welcome_banner_2
    228   1.1       pk 	fi
    229   1.1       pk 
    230   1.1       pk cat << \__welcome_banner_3
    231   1.1       pk 
    232   1.1       pk As with anything which modifies your disk's contents, this
    233   1.1       pk program can cause SIGNIFICANT data loss, and you are advised
    234   1.1       pk to make sure your data is backed up before beginning the
    235   1.1       pk installation process.
    236   1.1       pk 
    237   1.9      jtc Default answers are displayed in brackets after the questions.
    238   1.1       pk You can hit Control-C at any time to quit, but if you do so at a
    239   1.1       pk prompt, you may have to hit return.  Also, quitting in the middle of
    240   1.1       pk installation may leave your system in an inconsistent state.
    241   1.1       pk 
    242   1.1       pk __welcome_banner_3
    243   1.1       pk } | more
    244   1.1       pk }
    245   1.1       pk 
    246   1.1       pk md_not_going_to_install() {
    247   1.1       pk 	cat << \__not_going_to_install_1
    248   1.1       pk 
    249   1.1       pk OK, then.  Enter `halt' at the prompt to halt the machine.  Once the
    250   1.1       pk machine has halted, power-cycle the system to load new boot code.
    251   1.1       pk 
    252   1.1       pk __not_going_to_install_1
    253   1.1       pk }
    254   1.1       pk 
    255   1.1       pk md_congrats() {
    256   1.1       pk 	local what;
    257   1.1       pk 	if [ "$MODE" = "install" ]; then
    258   1.1       pk 		what="installed";
    259   1.1       pk 	else
    260   1.1       pk 		what="upgraded";
    261   1.1       pk 	fi
    262   1.1       pk 	cat << __congratulations_1
    263   1.1       pk 
    264   1.1       pk CONGRATULATIONS!  You have successfully $what NetBSD!
    265   1.1       pk To boot the installed system, enter halt at the command prompt. Once the
    266   1.1       pk system has halted, reset the machine and boot from the disk.
    267   1.1       pk 
    268   1.1       pk __congratulations_1
    269   1.1       pk }
    270