dot.profile revision 1.13
11.11Spk# $NetBSD: dot.profile,v 1.13 2000/10/31 20:53:04 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.13Spk local dev fn bsa 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.12Spk 1051.12SpkEOF 1061.12Spk dev="/dev/nrst0" 1071.12Spk echo -n "Tape device to load the installation utilities from [$dev]: " 1081.12Spk getresp "$dev"; dev="$_resp" 1091.12Spk 1101.12Spk fn=2 1111.12Spk echo -n "Tape file number [$fn]: " 1121.12Spk getresp "$fn"; fn="$_resp" 1131.12Spk 1141.13Spk echo -n "Tape block size (use only if you know you need it): " 1151.13Spk getresp ""; if [ "$_resp" != "" ]; then 1161.13Spk bsa="-b $_resp" 1171.13Spk fi 1181.12Spk 1191.12Spk echo "Positioning tape... " 1201.12Spk mt -f $dev asf $(($fn - 1)) 1211.12Spk [ $? = 0 ] || return 1 1221.12Spk 1231.12Spk echo "Extracting installation utilities... " 1241.13Spk (cd $INSTFS_MP && tar $bsa -z -x -p -f $dev) || return 1 1251.12Spk} 1261.12Spk 1271.12Spkcdrom() 1281.12Spk{ 1291.12Spk local dev tf rval 1301.12Spk cat <<EOF 1311.12SpkThe installation utilities are located on the ISO CD9660 filesystem on the 1321.12SpkNetBSD/sparc CD-ROM. We need to mount the filesystem from the CD-ROM device 1331.12Spkwhich you can specify below. Note: after the installation utilities are 1341.12Spkextracted this filesystem will be unmounted again. 1351.12Spk 1361.12SpkEOF 1371.12Spk 1381.12Spk rval=0 1391.12Spk dev="/dev/cd0a" 1401.12Spk echo -n "CD-ROM device to use [$dev]: " 1411.12Spk getresp "$dev"; dev="$_resp" 1421.12Spk 1431.12Spk mount_cd9660 -o rdonly $dev /cdrom || return 1 1441.12Spk 1451.12Spk tf=/cdrom/installation/bootfs/instfs.tgz 1461.12Spk (cd $INSTFS_MP && tar zxpf $tf) || rval=1 1471.12Spk umount /cdrom 1481.12Spk return $rval 1491.12Spk} 1501.12Spk 1511.12Spkcat <<EOF 1521.12SpkWelcome to the NetBSD/sparc microroot setup utility. 1531.12Spk 1541.12SpkWe've just completed the first stage of a two-stage procedure to load a 1551.12Spkfully functional NetBSD installation environment on your machine. In the 1561.12Spksecond stage which is to follow now, a set of additional installation 1571.12Spkutilities must be load from your NetBSD/sparc installation medium. 1581.11Spk 1591.12SpkEOF 1601.11Spk 1611.11Spkwhile :; do 1621.12Spk cat <<EOF 1631.12SpkThis procedure supports one of the following media: 1641.12Spk 1651.12Spk 1) cdrom 1661.12Spk 2) tape 1671.12Spk 3) floppy 1681.12Spk 1691.12SpkEOF 1701.12Spk echo -n "Installation medium to load the additional utilities from: " 1711.12Spk read answer 1721.12Spk echo "" 1731.12Spk case "$answer" in 1741.12Spk 1|cdrom) _func=cdrom;; 1751.12Spk 2|tape) _func=tape;; 1761.12Spk 3|floppy) _func=floppy;; 1771.12Spk *) echo "option not supported"; continue;; 1781.12Spk esac 1791.12Spk $_func && break 1801.11Spkdone 1811.11Spk 1821.11Spk# switch to /instfs, and pretend we logged in there. 1831.12Spkchroot $INSTFS_MP /bin/sh /.profile 1841.12Spk 1851.12Spk# 1861.12Spkecho "Back in microroot; halting machine..." 1871.12Spkhalt 188