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