dot.profile revision 1.12
11.11Spk# $NetBSD: dot.profile,v 1.12 2000/10/30 23:13:10 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.12SpkINSTFS_MP=/instfs 461.12SpkMINIROOT_FSSIZE=10000 471.12Spk 481.12Spkif [ "${BOOTFS_DONEPROFILE}" != "YES" ]; then 491.12Spk 501.12Spk BOOTFS_DONEPROFILE=YES 511.12Spk export BOOTFS_DONEPROFILE 521.12Spk 531.12Spk # mount root read-write 541.12Spk mount_ffs -o update /dev/md0a / 551.12Spk 561.12Spk # mount /instfs 571.12Spk mount_mfs -s $MINIROOT_FSSIZE swap $INSTFS_MP 581.1Smrgfi 591.11Spk 601.12Spk# A cat simulator 611.12Spkcat() 621.12Spk{ 631.12Spk local l 641.12Spk while read l; do 651.12Spk echo "$l" 661.12Spk done 671.12Spk} 681.12Spk 691.12Spk_resp="" 701.12Spkgetresp() { 711.12Spk read _resp 721.12Spk if [ "$_resp" = "" ]; then 731.12Spk _resp=$1 741.12Spk fi 751.12Spk} 761.11Spk 771.12Spk# Load instfs 781.11Spk 791.12Spkfloppy() 801.12Spk{ 811.12Spk local dev 821.12Spk cat <<EOF 831.12SpkFirst, remove the boot disk from the floppy station. 841.12Spk 851.12SpkNext, insert the floppy disk labeled \`instfs' into the disk drive. 861.12SpkThe question below allows you to specify the device name of the floppy 871.12Spkdrive. Usually, the default device will do just fine. 881.12SpkEOF 891.12Spk dev="/dev/rfd0a" 901.12Spk echo -n "Floppy device to load the installation utilities from [$dev]: " 911.12Spk getresp "$dev"; dev="$_resp" 921.12Spk 931.12Spk echo "Extracting installation utilities... " 941.12Spk (cd $INSTFS_MP && tar zxpf $dev) || return 1 951.12Spk} 961.12Spk 971.12Spktape() 981.12Spk{ 991.12Spk local dev fn bs 1001.12Spk cat <<EOF 1011.12SpkBy default, the installation utilities are located in the second tape file 1021.12Spkon the NetBSD/sparc installation tape. In case your tape layout is different, 1031.12Spkchoose the appropriate tape file number below. 1041.12SpkIf the installation tape was written with a different block size than 1051.12Spkthe default suggested by this installation procedure, you have the 1061.12Spkopportunity to change that as well. 1071.12Spk 1081.12SpkEOF 1091.12Spk dev="/dev/nrst0" 1101.12Spk echo -n "Tape device to load the installation utilities from [$dev]: " 1111.12Spk getresp "$dev"; dev="$_resp" 1121.12Spk 1131.12Spk fn=2 1141.12Spk echo -n "Tape file number [$fn]: " 1151.12Spk getresp "$fn"; fn="$_resp" 1161.12Spk 1171.12Spk bs=4k 1181.12Spk echo -n "Tape block size [$bs]: " 1191.12Spk getresp "$bs"; bs="$_resp" 1201.12Spk 1211.12Spk echo "Positioning tape... " 1221.12Spk mt -f $dev asf $(($fn - 1)) 1231.12Spk [ $? = 0 ] || return 1 1241.12Spk 1251.12Spk echo "Extracting installation utilities... " 1261.12Spk (cd $INSTFS_MP && tar zxpbf $bs $dev) || return 1 1271.12Spk} 1281.12Spk 1291.12Spkcdrom() 1301.12Spk{ 1311.12Spk local dev tf rval 1321.12Spk cat <<EOF 1331.12SpkThe installation utilities are located on the ISO CD9660 filesystem on the 1341.12SpkNetBSD/sparc CD-ROM. We need to mount the filesystem from the CD-ROM device 1351.12Spkwhich you can specify below. Note: after the installation utilities are 1361.12Spkextracted this filesystem will be unmounted again. 1371.12Spk 1381.12SpkEOF 1391.12Spk 1401.12Spk rval=0 1411.12Spk dev="/dev/cd0a" 1421.12Spk echo -n "CD-ROM device to use [$dev]: " 1431.12Spk getresp "$dev"; dev="$_resp" 1441.12Spk 1451.12Spk mount_cd9660 -o rdonly $dev /cdrom || return 1 1461.12Spk 1471.12Spk tf=/cdrom/installation/bootfs/instfs.tgz 1481.12Spk (cd $INSTFS_MP && tar zxpf $tf) || rval=1 1491.12Spk umount /cdrom 1501.12Spk return $rval 1511.12Spk} 1521.12Spk 1531.12Spkcat <<EOF 1541.12SpkWelcome to the NetBSD/sparc microroot setup utility. 1551.12Spk 1561.12SpkWe've just completed the first stage of a two-stage procedure to load a 1571.12Spkfully functional NetBSD installation environment on your machine. In the 1581.12Spksecond stage which is to follow now, a set of additional installation 1591.12Spkutilities must be load from your NetBSD/sparc installation medium. 1601.11Spk 1611.12SpkEOF 1621.11Spk 1631.11Spkwhile :; do 1641.12Spk cat <<EOF 1651.12SpkThis procedure supports one of the following media: 1661.12Spk 1671.12Spk 1) cdrom 1681.12Spk 2) tape 1691.12Spk 3) floppy 1701.12Spk 1711.12SpkEOF 1721.12Spk echo -n "Installation medium to load the additional utilities from: " 1731.12Spk read answer 1741.12Spk echo "" 1751.12Spk case "$answer" in 1761.12Spk 1|cdrom) _func=cdrom;; 1771.12Spk 2|tape) _func=tape;; 1781.12Spk 3|floppy) _func=floppy;; 1791.12Spk *) echo "option not supported"; continue;; 1801.12Spk esac 1811.12Spk $_func && break 1821.11Spkdone 1831.11Spk 1841.11Spk# switch to /instfs, and pretend we logged in there. 1851.12Spkchroot $INSTFS_MP /bin/sh /.profile 1861.12Spk 1871.12Spk# 1881.12Spkecho "Back in microroot; halting machine..." 1891.12Spkhalt 190