dot.commonutils revision 1.4
1# 2# Copyright (c) 1994 Christopher G. Demetriou 3# All rights reserved. 4# 5# Redistribution and use in source and binary forms, with or without 6# modification, are permitted provided that the following conditions 7# are met: 8# 1. Redistributions of source code must retain the above copyright 9# notice, this list of conditions and the following disclaimer. 10# 2. Redistributions in binary form must reproduce the above copyright 11# notice, this list of conditions and the following disclaimer in the 12# documentation and/or other materials provided with the distribution. 13# 3. All advertising materials mentioning features or use of this software 14# must display the following acknowledgement: 15# This product includes software developed by Christopher G. Demetriou. 16# 4. The name of the author may not be used to endorse or promote products 17# derived from this software without specific prior written permission 18# 19# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 20# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 21# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 22# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 23# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 24# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 28# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29# 30# $Id: dot.commonutils,v 1.4 1995/11/28 23:57:04 jtc Exp $ 31 32# Installation utilites (functions), to get NetBSD installed on 33# the hard disk. These are meant to be invoked from the shell prompt, 34# by people installing NetBSD. 35 36# we know that /etc/fstab is only generated on the hard drive 37dest_dir=/ 38if [ ! -f /etc/fstab ]; then 39 dest_dir=/mnt/ 40fi 41 42# counter for possible shared library confusion 43TAR=/usr/bin/tar 44GUNZIP=/usr/bin/gunzip 45 46Set_tmp_dir() 47{ 48 def_tmp_dir=`pwd` 49 if [ "$def_tmp_dir" = "/" -o "$def_tmp_dir" = "/mnt" ]; then 50 def_tmp_dir="$dest_dir"usr/distrib 51 fi 52 53 echo -n "What directory should be used to find and/or store " 54 echo "installation" 55 echo -n "files? [$def_tmp_dir] " 56 read tmp_dir 57 if [ "$tmp_dir" = "" ]; then 58 tmp_dir=$def_tmp_dir 59 fi 60 if [ ! -d "$tmp_dir" ]; then 61 /bin/rm -rf $tmp_dir 62 mkdir -p $tmp_dir 63 fi 64} 65 66Tmp_dir() 67{ 68 if [ "$tmp_dir" = "" ]; then 69 Set_tmp_dir 70 fi 71 cd $tmp_dir 72} 73 74Load_fd() 75{ 76 Tmp_dir 77 which= 78 while [ "$which" != "a" -a "$which" != "b" ]; do 79 echo -n "Read from which floppy drive ('a' or 'b')? [a] " 80 read which 81 if [ "X$which" = "X" ]; then 82 which=a 83 fi 84 done 85 while echo -n "Insert floppy (hit ^C to terminate, enter to load): " 86 do 87 mount -t msdos /dev/fd0$which /mnt2 88 cp -rp /mnt2/* . 89 umount /mnt2 90 done 91} 92 93Load_tape() 94{ 95 Tmp_dir 96 echo -n "Which tape drive will you be using? [rst0] " 97 read which 98 if [ "X$which" = "X" ]; then 99 which=rst0 100 fi 101 echo -n "Insert the tape into the tape drive and hit return to " 102 echo -n "continue..." 103 read foo 104 echo "Extracting files from the tape..." 105 $TAR --unlink -xvpf /dev/$which 106 echo "Done." 107} 108 109Extract() 110{ 111 Tmp_dir 112 echo -n "Would you like to list the files as they're extracted? [n] " 113 read verbose 114 case $verbose in 115 y*|Y*) 116 tarverbose=v 117 ;; 118 *) 119 tarverbose= 120 ;; 121 esac 122 cat "$1".?? | $GUNZIP | (cd $dest_dir ; $TAR --unlink -xp"$tarverbose"f -) 123} 124