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