dot.profile revision 1.14
11.14Spk# $NetBSD: dot.profile,v 1.14 2000/11/06 23:17:45 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.14Spk local dev rval 821.14Spk 831.14Spk rval=0 841.14Spk 851.14Spk echo "Ejecting floppy disk" 861.14Spk eject floppy 871.14Spk 881.12Spk cat <<EOF 891.14SpkRemove the boot disk from the floppy station and insert the second disk of 901.14Spkthe floppy installation set into the disk drive. 911.12Spk 921.12SpkThe question below allows you to specify the device name of the floppy 931.12Spkdrive. Usually, the default device will do just fine. 941.12SpkEOF 951.12Spk dev="/dev/rfd0a" 961.12Spk echo -n "Floppy device to load the installation utilities from [$dev]: " 971.12Spk getresp "$dev"; dev="$_resp" 981.12Spk 991.12Spk echo "Extracting installation utilities... " 1001.14Spk (cd $INSTFS_MP && tar zxpf $dev) || rval=1 1011.14Spk 1021.14Spk echo "Ejecting floppy disk" 1031.14Spk eject floppy 1041.14Spk return $rval 1051.12Spk} 1061.12Spk 1071.12Spktape() 1081.12Spk{ 1091.13Spk local dev fn bsa 1101.12Spk cat <<EOF 1111.12SpkBy default, the installation utilities are located in the second tape file 1121.12Spkon the NetBSD/sparc installation tape. In case your tape layout is different, 1131.12Spkchoose the appropriate tape file number below. 1141.12Spk 1151.12SpkEOF 1161.12Spk dev="/dev/nrst0" 1171.12Spk echo -n "Tape device to load the installation utilities from [$dev]: " 1181.12Spk getresp "$dev"; dev="$_resp" 1191.12Spk 1201.12Spk fn=2 1211.12Spk echo -n "Tape file number [$fn]: " 1221.12Spk getresp "$fn"; fn="$_resp" 1231.12Spk 1241.13Spk echo -n "Tape block size (use only if you know you need it): " 1251.13Spk getresp ""; if [ "$_resp" != "" ]; then 1261.13Spk bsa="-b $_resp" 1271.13Spk fi 1281.12Spk 1291.12Spk echo "Positioning tape... " 1301.12Spk mt -f $dev asf $(($fn - 1)) 1311.12Spk [ $? = 0 ] || return 1 1321.12Spk 1331.12Spk echo "Extracting installation utilities... " 1341.13Spk (cd $INSTFS_MP && tar $bsa -z -x -p -f $dev) || return 1 1351.12Spk} 1361.12Spk 1371.12Spkcdrom() 1381.12Spk{ 1391.12Spk local dev tf rval 1401.12Spk cat <<EOF 1411.12SpkThe installation utilities are located on the ISO CD9660 filesystem on the 1421.12SpkNetBSD/sparc CD-ROM. We need to mount the filesystem from the CD-ROM device 1431.12Spkwhich you can specify below. Note: after the installation utilities are 1441.12Spkextracted this filesystem will be unmounted again. 1451.12Spk 1461.12SpkEOF 1471.12Spk 1481.12Spk rval=0 1491.12Spk dev="/dev/cd0a" 1501.12Spk echo -n "CD-ROM device to use [$dev]: " 1511.12Spk getresp "$dev"; dev="$_resp" 1521.12Spk 1531.12Spk mount_cd9660 -o rdonly $dev /cdrom || return 1 1541.12Spk 1551.12Spk tf=/cdrom/installation/bootfs/instfs.tgz 1561.12Spk (cd $INSTFS_MP && tar zxpf $tf) || rval=1 1571.12Spk umount /cdrom 1581.12Spk return $rval 1591.12Spk} 1601.12Spk 1611.12Spkcat <<EOF 1621.12SpkWelcome to the NetBSD/sparc microroot setup utility. 1631.12Spk 1641.12SpkWe've just completed the first stage of a two-stage procedure to load a 1651.12Spkfully functional NetBSD installation environment on your machine. In the 1661.12Spksecond stage which is to follow now, a set of additional installation 1671.12Spkutilities must be load from your NetBSD/sparc installation medium. 1681.11Spk 1691.12SpkEOF 1701.11Spk 1711.11Spkwhile :; do 1721.12Spk cat <<EOF 1731.12SpkThis procedure supports one of the following media: 1741.12Spk 1751.12Spk 1) cdrom 1761.12Spk 2) tape 1771.12Spk 3) floppy 1781.12Spk 1791.12SpkEOF 1801.12Spk echo -n "Installation medium to load the additional utilities from: " 1811.12Spk read answer 1821.12Spk echo "" 1831.12Spk case "$answer" in 1841.12Spk 1|cdrom) _func=cdrom;; 1851.12Spk 2|tape) _func=tape;; 1861.12Spk 3|floppy) _func=floppy;; 1871.12Spk *) echo "option not supported"; continue;; 1881.12Spk esac 1891.12Spk $_func && break 1901.11Spkdone 1911.11Spk 1921.11Spk# switch to /instfs, and pretend we logged in there. 1931.12Spkchroot $INSTFS_MP /bin/sh /.profile 1941.12Spk 1951.12Spk# 1961.12Spkecho "Back in microroot; halting machine..." 1971.12Spkhalt 198