1*6baa9127Stsutsui# $NetBSD: dot.commonutils,v 1.8 2022/08/28 12:44:01 tsutsui Exp $ 23148c0e4Sperry# 33148c0e4Sperry# Copyright (c) 1994 Christopher G. Demetriou 43148c0e4Sperry# All rights reserved. 53148c0e4Sperry# 63148c0e4Sperry# Redistribution and use in source and binary forms, with or without 73148c0e4Sperry# modification, are permitted provided that the following conditions 83148c0e4Sperry# are met: 93148c0e4Sperry# 1. Redistributions of source code must retain the above copyright 103148c0e4Sperry# notice, this list of conditions and the following disclaimer. 113148c0e4Sperry# 2. Redistributions in binary form must reproduce the above copyright 123148c0e4Sperry# notice, this list of conditions and the following disclaimer in the 133148c0e4Sperry# documentation and/or other materials provided with the distribution. 143148c0e4Sperry# 3. All advertising materials mentioning features or use of this software 153148c0e4Sperry# must display the following acknowledgement: 16db755e7cScgd# This product includes software developed for the 178d1781e3Ssalo# NetBSD Project. See http://www.NetBSD.org/ for 18db755e7cScgd# information about NetBSD. 193148c0e4Sperry# 4. The name of the author may not be used to endorse or promote products 20db755e7cScgd# derived from this software without specific prior written permission. 213148c0e4Sperry# 223148c0e4Sperry# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 233148c0e4Sperry# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 243148c0e4Sperry# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 253148c0e4Sperry# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 263148c0e4Sperry# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 273148c0e4Sperry# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 283148c0e4Sperry# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 293148c0e4Sperry# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 303148c0e4Sperry# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 313148c0e4Sperry# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32db755e7cScgd# 33db755e7cScgd# <<Id: LICENSE,v 1.2 2000/06/14 15:57:33 cgd Exp>> 343148c0e4Sperry 353148c0e4Sperry# Installation utilites (functions), to get NetBSD installed on 363148c0e4Sperry# the hard disk. These are meant to be invoked from the shell prompt, 373148c0e4Sperry# by people installing NetBSD. 383148c0e4Sperry 393148c0e4Sperry# we know that /etc/fstab is only generated on the hard drive 403148c0e4Sperrydest_dir=/ 413148c0e4Sperryif [ ! -f /etc/fstab ]; then 423148c0e4Sperry dest_dir=/mnt/ 433148c0e4Sperryfi 443148c0e4Sperry 453148c0e4Sperry# counter for possible shared library confusion 46632ad8cdSminouraPAX=/bin/pax 473148c0e4SperryGUNZIP=/usr/bin/gunzip 483148c0e4Sperry 493148c0e4SperrySet_tmp_dir() 503148c0e4Sperry{ 513148c0e4Sperry def_tmp_dir=`pwd` 52*6baa9127Stsutsui if [ "$def_tmp_dir" = "/" ] || [ "$def_tmp_dir" = "/mnt" ]; then 533148c0e4Sperry def_tmp_dir="$dest_dir"usr/distrib 543148c0e4Sperry fi 553148c0e4Sperry 563148c0e4Sperry echo -n "What directory should be used to find and/or store " 573148c0e4Sperry echo "installtion" 5886417913Sminoura echo -n "files such as base.tgz and kern.tgz? [$def_tmp_dir] " 593148c0e4Sperry read tmp_dir 603148c0e4Sperry if [ "$tmp_dir" = "" ]; then 613148c0e4Sperry tmp_dir=$def_tmp_dir 623148c0e4Sperry fi 633148c0e4Sperry if [ ! -d "$tmp_dir" ]; then 643148c0e4Sperry /bin/rm -rf $tmp_dir 653148c0e4Sperry mkdir -p $tmp_dir 663148c0e4Sperry fi 673148c0e4Sperry} 683148c0e4Sperry 693148c0e4SperryTmp_dir() 703148c0e4Sperry{ 713148c0e4Sperry if [ "$tmp_dir" = "" ]; then 723148c0e4Sperry Set_tmp_dir 733148c0e4Sperry fi 743148c0e4Sperry cd $tmp_dir 753148c0e4Sperry} 763148c0e4Sperry 773148c0e4SperryLoad_fd() 783148c0e4Sperry{ 793148c0e4Sperry Tmp_dir 803148c0e4Sperry which= 813148c0e4Sperry# echo "Don't forget that you can't load from the drive you booted from." 823148c0e4Sperry echo "" 833148c0e4Sperry 84*6baa9127Stsutsui while [ "$which" != "0" ] && [ "$which" != "1" ]; do 853148c0e4Sperry echo -n "Read from which floppy drive ('0' or '1')? [0] " 863148c0e4Sperry read which 873148c0e4Sperry if [ "X$which" = "X" ]; then 883148c0e4Sperry which=0 893148c0e4Sperry fi 903148c0e4Sperry done 913148c0e4Sperry echo "" 923148c0e4Sperry echo "WARNING: during the floppy loading process, you should only" 933148c0e4Sperry echo "use Control-C at the prompt." 943148c0e4Sperry echo "" 953148c0e4Sperry while echo -n \ 963148c0e4Sperry "Insert floppy (hit Control-C to terminate, enter to load): " 973148c0e4Sperry do 983148c0e4Sperry read foo 993148c0e4Sperry mount -r -t msdos /dev/fd${which}a /mnt2 1003148c0e4Sperry cp -rp /mnt2/* . 1013148c0e4Sperry umount /mnt2 1023148c0e4Sperry done 1033148c0e4Sperry} 1043148c0e4Sperry 1053148c0e4SperryLoad_tape() 1063148c0e4Sperry{ 1073148c0e4Sperry Tmp_dir 1083148c0e4Sperry echo -n "Which tape drive will you be using? [rst0] " 1093148c0e4Sperry read which 1103148c0e4Sperry if [ "X$which" = "X" ]; then 1113148c0e4Sperry which=rst0 1123148c0e4Sperry fi 1133148c0e4Sperry echo -n "Insert the tape into the tape drive and hit return to " 1143148c0e4Sperry echo -n "continue..." 1153148c0e4Sperry read foo 1163148c0e4Sperry echo "Extracting files from the tape..." 117632ad8cdSminoura $PAX -rvpe -f /dev/$which 1183148c0e4Sperry echo "Done." 1193148c0e4Sperry} 1203148c0e4Sperry 1213148c0e4SperryExtract() 1223148c0e4Sperry{ 1233148c0e4Sperry Tmp_dir 1243148c0e4Sperry echo -n "Would you like to list the files as they're extracted? [n] " 1253148c0e4Sperry read verbose 1263148c0e4Sperry case $verbose in 1273148c0e4Sperry y*|Y*) 128632ad8cdSminoura tarverbose=-v 1293148c0e4Sperry ;; 1303148c0e4Sperry *) 1313148c0e4Sperry tarverbose= 1323148c0e4Sperry ;; 1333148c0e4Sperry esac 134632ad8cdSminoura cat "$1"* | $GUNZIP | (cd $dest_dir ; $PAX -rpe $tarverbose ) 1353148c0e4Sperry} 136