Home | History | Annotate | Line # | Download | only in ramdisk
dot.profile revision 1.12
      1  1.11   pk # $NetBSD: dot.profile,v 1.12 2000/10/30 23:13:10 pk Exp $
      2   1.1  mrg #
      3  1.11   pk # Copyright (c) 2000 The NetBSD Foundation, Inc.
      4   1.1  mrg # All rights reserved.
      5  1.11   pk #
      6  1.11   pk # This code is derived from software contributed to The NetBSD Foundation
      7  1.11   pk # by Paul Kranenburg.
      8  1.11   pk #
      9   1.1  mrg # Redistribution and use in source and binary forms, with or without
     10   1.1  mrg # modification, are permitted provided that the following conditions
     11   1.1  mrg # are met:
     12   1.1  mrg # 1. Redistributions of source code must retain the above copyright
     13   1.1  mrg #    notice, this list of conditions and the following disclaimer.
     14   1.1  mrg # 2. Redistributions in binary form must reproduce the above copyright
     15   1.1  mrg #    notice, this list of conditions and the following disclaimer in the
     16   1.1  mrg #    documentation and/or other materials provided with the distribution.
     17   1.1  mrg # 3. All advertising materials mentioning features or use of this software
     18   1.1  mrg #    must display the following acknowledgement:
     19  1.11   pk #        This product includes software developed by the NetBSD
     20  1.11   pk #        Foundation, Inc. and its contributors.
     21  1.11   pk # 4. Neither the name of The NetBSD Foundation nor the names of its
     22  1.11   pk #    contributors may be used to endorse or promote products derived
     23  1.11   pk #    from this software without specific prior written permission.
     24  1.11   pk #
     25  1.11   pk # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     26  1.11   pk # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     27  1.11   pk # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     28  1.11   pk # PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     29  1.11   pk # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     30  1.11   pk # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     31  1.11   pk # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     32  1.11   pk # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     33  1.11   pk # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     34  1.11   pk # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     35  1.11   pk # POSSIBILITY OF SUCH DAMAGE.
     36  1.11   pk #
     37   1.1  mrg 
     38   1.1  mrg PATH=/sbin:/bin:/usr/bin:/usr/sbin:/
     39   1.1  mrg export PATH
     40   1.1  mrg HOME=/
     41   1.1  mrg export HOME
     42   1.1  mrg 
     43   1.1  mrg umask 022
     44   1.1  mrg 
     45  1.12   pk INSTFS_MP=/instfs
     46  1.12   pk MINIROOT_FSSIZE=10000
     47  1.12   pk 
     48  1.12   pk if [ "${BOOTFS_DONEPROFILE}" != "YES" ]; then
     49  1.12   pk 
     50  1.12   pk 	BOOTFS_DONEPROFILE=YES
     51  1.12   pk 	export BOOTFS_DONEPROFILE
     52  1.12   pk 
     53  1.12   pk 	# mount root read-write
     54  1.12   pk 	mount_ffs -o update /dev/md0a /
     55  1.12   pk 
     56  1.12   pk 	# mount /instfs
     57  1.12   pk 	mount_mfs -s $MINIROOT_FSSIZE swap $INSTFS_MP
     58   1.1  mrg fi
     59  1.11   pk 
     60  1.12   pk # A cat simulator
     61  1.12   pk cat()
     62  1.12   pk {
     63  1.12   pk 	local l
     64  1.12   pk 	while read l; do
     65  1.12   pk 		echo "$l"
     66  1.12   pk 	done
     67  1.12   pk }
     68  1.12   pk 
     69  1.12   pk _resp=""
     70  1.12   pk getresp() {
     71  1.12   pk 	read _resp
     72  1.12   pk 	if [ "$_resp" = "" ]; then
     73  1.12   pk 		_resp=$1
     74  1.12   pk 	fi
     75  1.12   pk }
     76  1.11   pk 
     77  1.12   pk # Load instfs
     78  1.11   pk 
     79  1.12   pk floppy()
     80  1.12   pk {
     81  1.12   pk 	local dev
     82  1.12   pk 	cat <<EOF
     83  1.12   pk First, remove the boot disk from the floppy station.
     84  1.12   pk 
     85  1.12   pk Next, insert the floppy disk labeled \`instfs' into the disk drive.
     86  1.12   pk The question below allows you to specify the device name of the floppy
     87  1.12   pk drive.  Usually, the default device will do just fine.
     88  1.12   pk EOF
     89  1.12   pk 	dev="/dev/rfd0a"
     90  1.12   pk 	echo -n "Floppy device to load the installation utilities from [$dev]: "
     91  1.12   pk 	getresp "$dev"; dev="$_resp"
     92  1.12   pk 
     93  1.12   pk 	echo "Extracting installation utilities... "
     94  1.12   pk 	(cd $INSTFS_MP && tar zxpf $dev) || return 1
     95  1.12   pk }
     96  1.12   pk 
     97  1.12   pk tape()
     98  1.12   pk {
     99  1.12   pk 	local dev fn bs
    100  1.12   pk 	cat <<EOF
    101  1.12   pk By default, the installation utilities are located in the second tape file
    102  1.12   pk on the NetBSD/sparc installation tape. In case your tape layout is different,
    103  1.12   pk choose the appropriate tape file number below.
    104  1.12   pk If the installation tape was written with a different block size than
    105  1.12   pk the default suggested by this installation procedure, you have the
    106  1.12   pk opportunity to change that as well.
    107  1.12   pk 
    108  1.12   pk EOF
    109  1.12   pk 	dev="/dev/nrst0"
    110  1.12   pk 	echo -n "Tape device to load the installation utilities from [$dev]: "
    111  1.12   pk 	getresp "$dev"; dev="$_resp"
    112  1.12   pk 
    113  1.12   pk 	fn=2
    114  1.12   pk 	echo -n "Tape file number [$fn]: "
    115  1.12   pk 	getresp "$fn"; fn="$_resp"
    116  1.12   pk 
    117  1.12   pk 	bs=4k
    118  1.12   pk 	echo -n "Tape block size [$bs]: "
    119  1.12   pk 	getresp "$bs"; bs="$_resp"
    120  1.12   pk 
    121  1.12   pk 	echo "Positioning tape... "
    122  1.12   pk 	mt -f $dev asf $(($fn - 1))
    123  1.12   pk 	[ $? = 0 ] || return 1
    124  1.12   pk 
    125  1.12   pk 	echo "Extracting installation utilities... "
    126  1.12   pk 	(cd $INSTFS_MP && tar zxpbf $bs $dev) || return 1
    127  1.12   pk }
    128  1.12   pk 
    129  1.12   pk cdrom()
    130  1.12   pk {
    131  1.12   pk 	local dev tf rval
    132  1.12   pk 	cat <<EOF
    133  1.12   pk The installation utilities are located on the ISO CD9660 filesystem on the
    134  1.12   pk NetBSD/sparc CD-ROM. We need to mount the filesystem from the CD-ROM device
    135  1.12   pk which you can specify below. Note: after the installation utilities are
    136  1.12   pk extracted this filesystem will be unmounted again.
    137  1.12   pk 
    138  1.12   pk EOF
    139  1.12   pk 
    140  1.12   pk 	rval=0
    141  1.12   pk 	dev="/dev/cd0a"
    142  1.12   pk 	echo -n "CD-ROM device to use [$dev]: "
    143  1.12   pk 	getresp "$dev"; dev="$_resp"
    144  1.12   pk 
    145  1.12   pk 	mount_cd9660 -o rdonly $dev /cdrom || return 1
    146  1.12   pk 
    147  1.12   pk 	tf=/cdrom/installation/bootfs/instfs.tgz
    148  1.12   pk 	(cd $INSTFS_MP && tar zxpf $tf) || rval=1
    149  1.12   pk 	umount /cdrom
    150  1.12   pk 	return $rval
    151  1.12   pk }
    152  1.12   pk 
    153  1.12   pk cat <<EOF
    154  1.12   pk Welcome to the NetBSD/sparc microroot setup utility.
    155  1.12   pk 
    156  1.12   pk We've just completed the first stage of a two-stage procedure to load a
    157  1.12   pk fully functional NetBSD installation environment on your machine.  In the
    158  1.12   pk second stage which is to follow now, a set of additional installation
    159  1.12   pk utilities must be load from your NetBSD/sparc installation medium.
    160  1.11   pk 
    161  1.12   pk EOF
    162  1.11   pk 
    163  1.11   pk while :; do
    164  1.12   pk 	cat <<EOF
    165  1.12   pk This procedure supports one of the following media:
    166  1.12   pk 
    167  1.12   pk 	1) cdrom
    168  1.12   pk 	2) tape
    169  1.12   pk 	3) floppy
    170  1.12   pk 
    171  1.12   pk EOF
    172  1.12   pk 	echo -n "Installation medium to load the additional utilities from: "
    173  1.12   pk 	read answer
    174  1.12   pk 	echo ""
    175  1.12   pk 	case "$answer" in
    176  1.12   pk 		1|cdrom)	_func=cdrom;;
    177  1.12   pk 		2|tape)		_func=tape;;
    178  1.12   pk 		3|floppy)	_func=floppy;;
    179  1.12   pk 		*)		echo "option not supported"; continue;;
    180  1.12   pk 	esac
    181  1.12   pk 	$_func && break
    182  1.11   pk done
    183  1.11   pk 
    184  1.11   pk # switch to /instfs, and pretend we logged in there.
    185  1.12   pk chroot $INSTFS_MP /bin/sh /.profile
    186  1.12   pk 
    187  1.12   pk #
    188  1.12   pk echo "Back in microroot; halting machine..."
    189  1.12   pk halt
    190