11.9Stsutsui# $NetBSD: dot.commonutils,v 1.9 2022/08/28 12:44:00 tsutsui Exp $ 21.1Schopps# 31.1Schopps# Copyright (c) 1994 Christopher G. Demetriou 41.1Schopps# All rights reserved. 51.1Schopps# 61.1Schopps# Redistribution and use in source and binary forms, with or without 71.1Schopps# modification, are permitted provided that the following conditions 81.1Schopps# are met: 91.1Schopps# 1. Redistributions of source code must retain the above copyright 101.1Schopps# notice, this list of conditions and the following disclaimer. 111.1Schopps# 2. Redistributions in binary form must reproduce the above copyright 121.1Schopps# notice, this list of conditions and the following disclaimer in the 131.1Schopps# documentation and/or other materials provided with the distribution. 141.1Schopps# 3. All advertising materials mentioning features or use of this software 151.1Schopps# must display the following acknowledgement: 161.7Scgd# This product includes software developed for the 171.8Ssalo# NetBSD Project. See http://www.NetBSD.org/ for 181.7Scgd# information about NetBSD. 191.1Schopps# 4. The name of the author may not be used to endorse or promote products 201.7Scgd# derived from this software without specific prior written permission. 211.7Scgd# 221.1Schopps# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 231.1Schopps# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 241.1Schopps# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 251.1Schopps# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 261.1Schopps# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 271.1Schopps# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 281.1Schopps# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 291.1Schopps# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 301.1Schopps# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 311.1Schopps# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 321.7Scgd# 331.7Scgd# <<Id: LICENSE,v 1.2 2000/06/14 15:57:33 cgd Exp>> 341.1Schopps 351.1Schopps# Installation utilites (functions), to get NetBSD installed on 361.1Schopps# the hard disk. These are meant to be invoked from the shell prompt, 371.1Schopps# by people installing NetBSD. 381.1Schopps 391.3Schopps# we know that /etc/fstab is only generated on the hard drive 401.3Schoppsdest_dir=/ 411.3Schoppsif [ ! -f /etc/fstab ]; then 421.3Schopps dest_dir=/mnt/ 431.3Schoppsfi 441.3Schopps 451.3Schopps# counter for possible shared library confusion 461.3SchoppsTAR=/usr/bin/tar 471.3SchoppsGUNZIP=/usr/bin/gunzip 481.3Schopps 491.1SchoppsSet_tmp_dir() 501.1Schopps{ 511.1Schopps def_tmp_dir=`pwd` 521.9Stsutsui if [ "$def_tmp_dir" = "/" ] || [ "$def_tmp_dir" = "/mnt" ]; then 531.3Schopps def_tmp_dir="$dest_dir"usr/distrib 541.1Schopps fi 551.1Schopps 561.1Schopps echo -n "What directory should be used to find and/or store " 571.3Schopps echo "installation" 581.1Schopps echo -n "files? [$def_tmp_dir] " 591.1Schopps read tmp_dir 601.1Schopps if [ "$tmp_dir" = "" ]; then 611.1Schopps tmp_dir=$def_tmp_dir 621.1Schopps fi 631.1Schopps if [ ! -d "$tmp_dir" ]; then 641.1Schopps /bin/rm -rf $tmp_dir 651.1Schopps mkdir -p $tmp_dir 661.1Schopps fi 671.1Schopps} 681.1Schopps 691.1SchoppsTmp_dir() 701.1Schopps{ 711.1Schopps if [ "$tmp_dir" = "" ]; then 721.1Schopps Set_tmp_dir 731.1Schopps fi 741.1Schopps cd $tmp_dir 751.1Schopps} 761.1Schopps 771.1SchoppsLoad_fd() 781.1Schopps{ 791.1Schopps Tmp_dir 801.1Schopps which= 811.9Stsutsui while [ "$which" != "a" ] && [ "$which" != "b" ]; do 821.1Schopps echo -n "Read from which floppy drive ('a' or 'b')? [a] " 831.1Schopps read which 841.1Schopps if [ "X$which" = "X" ]; then 851.1Schopps which=a 861.1Schopps fi 871.1Schopps done 881.1Schopps while echo -n "Insert floppy (hit ^C to terminate, enter to load): " 891.1Schopps do 901.1Schopps mount -t msdos /dev/fd0$which /mnt2 911.1Schopps cp -rp /mnt2/* . 921.1Schopps umount /mnt2 931.1Schopps done 941.1Schopps} 951.1Schopps 961.1SchoppsLoad_tape() 971.1Schopps{ 981.1Schopps Tmp_dir 991.1Schopps echo -n "Which tape drive will you be using? [rst0] " 1001.1Schopps read which 1011.1Schopps if [ "X$which" = "X" ]; then 1021.1Schopps which=rst0 1031.1Schopps fi 1041.1Schopps echo -n "Insert the tape into the tape drive and hit return to " 1051.1Schopps echo -n "continue..." 1061.1Schopps read foo 1071.1Schopps echo "Extracting files from the tape..." 1081.4Sjtc $TAR --unlink -xvpf /dev/$which 1091.1Schopps echo "Done." 1101.1Schopps} 1111.1Schopps 1121.1SchoppsExtract() 1131.1Schopps{ 1141.1Schopps Tmp_dir 1151.1Schopps echo -n "Would you like to list the files as they're extracted? [n] " 1161.1Schopps read verbose 1171.1Schopps case $verbose in 1181.1Schopps y*|Y*) 1191.1Schopps tarverbose=v 1201.1Schopps ;; 1211.1Schopps *) 1221.1Schopps tarverbose= 1231.1Schopps ;; 1241.1Schopps esac 1251.3Schopps cat "$1".?? | $GUNZIP | (cd $dest_dir ; $TAR --unlink -xp"$tarverbose"f -) 1261.1Schopps} 127