dot.commonutils revision 1.6
11.6Stsutsui# $NetBSD: dot.commonutils,v 1.6 2022/08/28 12:44:01 tsutsui Exp $ 21.1Sragge# 31.1Sragge# Copyright (c) 1994 Christopher G. Demetriou 41.1Sragge# All rights reserved. 51.1Sragge# 61.1Sragge# Redistribution and use in source and binary forms, with or without 71.1Sragge# modification, are permitted provided that the following conditions 81.1Sragge# are met: 91.1Sragge# 1. Redistributions of source code must retain the above copyright 101.1Sragge# notice, this list of conditions and the following disclaimer. 111.1Sragge# 2. Redistributions in binary form must reproduce the above copyright 121.1Sragge# notice, this list of conditions and the following disclaimer in the 131.1Sragge# documentation and/or other materials provided with the distribution. 141.1Sragge# 3. All advertising materials mentioning features or use of this software 151.1Sragge# must display the following acknowledgement: 161.4Scgd# This product includes software developed for the 171.5Ssalo# NetBSD Project. See http://www.NetBSD.org/ for 181.4Scgd# information about NetBSD. 191.1Sragge# 4. The name of the author may not be used to endorse or promote products 201.4Scgd# derived from this software without specific prior written permission. 211.4Scgd# 221.1Sragge# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 231.1Sragge# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 241.1Sragge# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 251.1Sragge# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 261.1Sragge# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 271.1Sragge# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 281.1Sragge# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 291.1Sragge# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 301.1Sragge# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 311.1Sragge# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 321.4Scgd# 331.4Scgd# <<Id: LICENSE,v 1.2 2000/06/14 15:57:33 cgd Exp>> 341.1Sragge 351.1Sragge# Installation utilites (functions), to get NetBSD installed on 361.1Sragge# the hard disk. These are meant to be invoked from the shell prompt, 371.1Sragge# by people installing NetBSD. 381.1Sragge 391.1SraggeSet_tmp_dir() 401.1Sragge{ 411.1Sragge def_tmp_dir=`pwd` 421.6Stsutsui if [ "$def_tmp_dir" = "/" ] || [ "$def_tmp_dir" = "/mnt" ]; then 431.1Sragge def_tmp_dir=/mnt/usr/distrib 441.1Sragge fi 451.1Sragge 461.1Sragge echo -n "What directory should be used to find and/or store " 471.1Sragge echo "installtion" 481.1Sragge echo -n "files? [$def_tmp_dir] " 491.1Sragge read tmp_dir 501.1Sragge if [ "$tmp_dir" = "" ]; then 511.1Sragge tmp_dir=$def_tmp_dir 521.1Sragge fi 531.1Sragge if [ ! -d "$tmp_dir" ]; then 541.1Sragge /bin/rm -rf $tmp_dir 551.1Sragge mkdir -p $tmp_dir 561.1Sragge fi 571.1Sragge} 581.1Sragge 591.1SraggeTmp_dir() 601.1Sragge{ 611.1Sragge if [ "$tmp_dir" = "" ]; then 621.1Sragge Set_tmp_dir 631.1Sragge fi 641.1Sragge cd $tmp_dir 651.1Sragge} 661.1Sragge 671.1SraggeLoad_fd() 681.1Sragge{ 691.1Sragge Tmp_dir 701.1Sragge which= 711.6Stsutsui while [ "$which" != "a" ] && [ "$which" != "b" ]; do 721.1Sragge echo -n "Read from which floppy drive ('a' or 'b')? [a] " 731.1Sragge read which 741.1Sragge if [ "X$which" = "X" ]; then 751.1Sragge which=a 761.1Sragge fi 771.1Sragge done 781.1Sragge while echo -n "Insert floppy (hit ^C to terminate, enter to load): " 791.1Sragge do 801.1Sragge mount -t msdos /dev/fd0$which /mnt2 811.1Sragge cp -rp /mnt2/* . 821.1Sragge umount /mnt2 831.1Sragge done 841.1Sragge} 851.1Sragge 861.1SraggeLoad_tape() 871.1Sragge{ 881.1Sragge Tmp_dir 891.1Sragge echo -n "Which tape drive will you be using? [rst0] " 901.1Sragge read which 911.1Sragge if [ "X$which" = "X" ]; then 921.1Sragge which=rst0 931.1Sragge fi 941.1Sragge echo -n "Insert the tape into the tape drive and hit return to " 951.1Sragge echo -n "continue..." 961.1Sragge read foo 971.1Sragge echo "Extracting files from the tape..." 981.1Sragge tar xvfp /dev/$which 991.1Sragge echo "Done." 1001.1Sragge} 1011.1Sragge 1021.1SraggeExtract() 1031.1Sragge{ 1041.1Sragge Tmp_dir 1051.1Sragge echo -n "Would you like to list the files as they're extracted? [n] " 1061.1Sragge read verbose 1071.1Sragge case $verbose in 1081.1Sragge y*|Y*) 1091.1Sragge tarverbose=v 1101.1Sragge ;; 1111.1Sragge *) 1121.1Sragge tarverbose= 1131.1Sragge ;; 1141.1Sragge esac 1151.1Sragge cat "$1".??? | gunzip | (cd / ; tar xfp$tarverbose -) 1161.1Sragge} 117