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