dot.profile revision 1.16
11.16Spk# $NetBSD: dot.profile,v 1.16 2001/06/17 11:57:23 pk Exp $ 21.1Smrg# 31.11Spk# Copyright (c) 2000 The NetBSD Foundation, Inc. 41.1Smrg# All rights reserved. 51.11Spk# 61.11Spk# This code is derived from software contributed to The NetBSD Foundation 71.11Spk# by Paul Kranenburg. 81.11Spk# 91.1Smrg# Redistribution and use in source and binary forms, with or without 101.1Smrg# modification, are permitted provided that the following conditions 111.1Smrg# are met: 121.1Smrg# 1. Redistributions of source code must retain the above copyright 131.1Smrg# notice, this list of conditions and the following disclaimer. 141.1Smrg# 2. Redistributions in binary form must reproduce the above copyright 151.1Smrg# notice, this list of conditions and the following disclaimer in the 161.1Smrg# documentation and/or other materials provided with the distribution. 171.1Smrg# 3. All advertising materials mentioning features or use of this software 181.1Smrg# must display the following acknowledgement: 191.11Spk# This product includes software developed by the NetBSD 201.11Spk# Foundation, Inc. and its contributors. 211.11Spk# 4. Neither the name of The NetBSD Foundation nor the names of its 221.11Spk# contributors may be used to endorse or promote products derived 231.11Spk# from this software without specific prior written permission. 241.11Spk# 251.11Spk# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 261.11Spk# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 271.11Spk# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 281.11Spk# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 291.11Spk# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 301.11Spk# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 311.11Spk# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 321.11Spk# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 331.11Spk# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 341.11Spk# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 351.11Spk# POSSIBILITY OF SUCH DAMAGE. 361.11Spk# 371.1Smrg 381.1SmrgPATH=/sbin:/bin:/usr/bin:/usr/sbin:/ 391.1Smrgexport PATH 401.1SmrgHOME=/ 411.1Smrgexport HOME 421.1Smrg 431.1Smrgumask 022 441.1Smrg 451.15SpkMACHINE=sparc 461.12SpkINSTFS_MP=/instfs 471.12SpkMINIROOT_FSSIZE=10000 481.12Spk 491.12Spkif [ "${BOOTFS_DONEPROFILE}" != "YES" ]; then 501.12Spk 511.12Spk BOOTFS_DONEPROFILE=YES 521.12Spk export BOOTFS_DONEPROFILE 531.12Spk 541.12Spk # mount root read-write 551.12Spk mount_ffs -o update /dev/md0a / 561.12Spk 571.12Spk # mount /instfs 581.12Spk mount_mfs -s $MINIROOT_FSSIZE swap $INSTFS_MP 591.1Smrgfi 601.11Spk 611.12Spk# A cat simulator 621.12Spkcat() 631.12Spk{ 641.12Spk local l 651.12Spk while read l; do 661.12Spk echo "$l" 671.12Spk done 681.12Spk} 691.12Spk 701.12Spk_resp="" 711.12Spkgetresp() { 721.12Spk read _resp 731.12Spk if [ "$_resp" = "" ]; then 741.12Spk _resp=$1 751.12Spk fi 761.12Spk} 771.11Spk 781.12Spk# Load instfs 791.11Spk 801.12Spkfloppy() 811.12Spk{ 821.14Spk local dev rval 831.14Spk 841.14Spk rval=0 851.14Spk 861.14Spk echo "Ejecting floppy disk" 871.14Spk eject floppy 881.14Spk 891.12Spk cat <<EOF 901.14SpkRemove the boot disk from the floppy station and insert the second disk of 911.14Spkthe floppy installation set into the disk drive. 921.12Spk 931.12SpkThe question below allows you to specify the device name of the floppy 941.12Spkdrive. Usually, the default device will do just fine. 951.12SpkEOF 961.12Spk dev="/dev/rfd0a" 971.12Spk echo -n "Floppy device to load the installation utilities from [$dev]: " 981.12Spk getresp "$dev"; dev="$_resp" 991.12Spk 1001.12Spk echo "Extracting installation utilities... " 1011.14Spk (cd $INSTFS_MP && tar zxpf $dev) || rval=1 1021.14Spk 1031.14Spk echo "Ejecting floppy disk" 1041.14Spk eject floppy 1051.14Spk return $rval 1061.12Spk} 1071.12Spk 1081.12Spktape() 1091.12Spk{ 1101.13Spk local dev fn bsa 1111.12Spk cat <<EOF 1121.12SpkBy default, the installation utilities are located in the second tape file 1131.12Spkon the NetBSD/sparc installation tape. In case your tape layout is different, 1141.12Spkchoose the appropriate tape file number below. 1151.12Spk 1161.12SpkEOF 1171.12Spk dev="/dev/nrst0" 1181.12Spk echo -n "Tape device to load the installation utilities from [$dev]: " 1191.12Spk getresp "$dev"; dev="$_resp" 1201.12Spk 1211.12Spk fn=2 1221.12Spk echo -n "Tape file number [$fn]: " 1231.12Spk getresp "$fn"; fn="$_resp" 1241.12Spk 1251.13Spk echo -n "Tape block size (use only if you know you need it): " 1261.13Spk getresp ""; if [ "$_resp" != "" ]; then 1271.13Spk bsa="-b $_resp" 1281.13Spk fi 1291.12Spk 1301.12Spk echo "Positioning tape... " 1311.12Spk mt -f $dev asf $(($fn - 1)) 1321.12Spk [ $? = 0 ] || return 1 1331.12Spk 1341.12Spk echo "Extracting installation utilities... " 1351.13Spk (cd $INSTFS_MP && tar $bsa -z -x -p -f $dev) || return 1 1361.12Spk} 1371.12Spk 1381.12Spkcdrom() 1391.12Spk{ 1401.12Spk local dev tf rval 1411.12Spk cat <<EOF 1421.12SpkThe installation utilities are located on the ISO CD9660 filesystem on the 1431.12SpkNetBSD/sparc CD-ROM. We need to mount the filesystem from the CD-ROM device 1441.12Spkwhich you can specify below. Note: after the installation utilities are 1451.12Spkextracted this filesystem will be unmounted again. 1461.12Spk 1471.12SpkEOF 1481.12Spk 1491.12Spk rval=0 1501.12Spk dev="/dev/cd0a" 1511.12Spk echo -n "CD-ROM device to use [$dev]: " 1521.12Spk getresp "$dev"; dev="$_resp" 1531.12Spk 1541.12Spk mount_cd9660 -o rdonly $dev /cdrom || return 1 1551.12Spk 1561.15Spk # Look for instfs.tgz in MACHINE subdirectory first 1571.15Spk tf=/cdrom/$MACHINE/installation/bootfs/instfs.tgz 1581.15Spk [ -f $tf ] || tf=/cdrom/installation/bootfs/instfs.tgz 1591.16Spk [ -f $tf ] || { 1601.16Spk echo "Note: instfs.tgz image not found in default location" 1611.16Spk tf="" 1621.16Spk } 1631.16Spk 1641.16Spk while :; do 1651.16Spk echo -n "Path to instfs.tgz [$tf] " 1661.16Spk [ -z "$tf" ] && echo -n "(<return> to abort) " 1671.16Spk getresp "$tf"; tf="$_resp" 1681.16Spk [ -z "$tf" ] && { rval=1; break; } 1691.16Spk [ -f "$tf" ] && break; 1701.16Spk echo "$tf not found" 1711.16Spk tf="" 1721.16Spk done 1731.15Spk 1741.15Spk [ $rval = 0 ] && (cd $INSTFS_MP && tar zxpf $tf) || rval=1 1751.15Spk 1761.12Spk umount /cdrom 1771.12Spk return $rval 1781.12Spk} 1791.12Spk 1801.12Spkcat <<EOF 1811.12SpkWelcome to the NetBSD/sparc microroot setup utility. 1821.12Spk 1831.12SpkWe've just completed the first stage of a two-stage procedure to load a 1841.12Spkfully functional NetBSD installation environment on your machine. In the 1851.12Spksecond stage which is to follow now, a set of additional installation 1861.12Spkutilities must be load from your NetBSD/sparc installation medium. 1871.11Spk 1881.12SpkEOF 1891.11Spk 1901.11Spkwhile :; do 1911.12Spk cat <<EOF 1921.12SpkThis procedure supports one of the following media: 1931.12Spk 1941.12Spk 1) cdrom 1951.12Spk 2) tape 1961.12Spk 3) floppy 1971.12Spk 1981.12SpkEOF 1991.12Spk echo -n "Installation medium to load the additional utilities from: " 2001.12Spk read answer 2011.12Spk echo "" 2021.12Spk case "$answer" in 2031.12Spk 1|cdrom) _func=cdrom;; 2041.12Spk 2|tape) _func=tape;; 2051.12Spk 3|floppy) _func=floppy;; 2061.12Spk *) echo "option not supported"; continue;; 2071.12Spk esac 2081.12Spk $_func && break 2091.11Spkdone 2101.11Spk 2111.11Spk# switch to /instfs, and pretend we logged in there. 2121.12Spkchroot $INSTFS_MP /bin/sh /.profile 2131.12Spk 2141.12Spk# 2151.12Spkecho "Back in microroot; halting machine..." 2161.12Spkhalt 217