Home | History | Annotate | Line # | Download | only in inst-common
dot.commonutils revision 1.1
      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.1  chopps $
     30  1.1  chopps $	$Id: dot.commonutils,v 1.1 1994/10/06 20:25:50 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.1  chopps Set_tmp_dir()
     37  1.1  chopps {
     38  1.1  chopps 	def_tmp_dir=`pwd`
     39  1.1  chopps 	if [ "$def_tmp_dir" = "/" -o "$def_tmp_dir" = "/mnt" ]; then
     40  1.1  chopps 		def_tmp_dir=/mnt/usr/distrib
     41  1.1  chopps 	fi
     42  1.1  chopps 
     43  1.1  chopps 	echo -n	"What directory should be used to find and/or store "
     44  1.1  chopps 	echo	"installtion"
     45  1.1  chopps 	echo -n	"files? [$def_tmp_dir] "
     46  1.1  chopps 	read tmp_dir
     47  1.1  chopps 	if [ "$tmp_dir" = "" ]; then
     48  1.1  chopps 		tmp_dir=$def_tmp_dir
     49  1.1  chopps 	fi
     50  1.1  chopps 	if [ ! -d "$tmp_dir" ]; then
     51  1.1  chopps 		/bin/rm -rf $tmp_dir
     52  1.1  chopps 		mkdir -p $tmp_dir
     53  1.1  chopps 	fi
     54  1.1  chopps }
     55  1.1  chopps 
     56  1.1  chopps Tmp_dir()
     57  1.1  chopps {
     58  1.1  chopps 	if [ "$tmp_dir" = "" ]; then
     59  1.1  chopps 		Set_tmp_dir
     60  1.1  chopps 	fi
     61  1.1  chopps 	cd $tmp_dir
     62  1.1  chopps }
     63  1.1  chopps 
     64  1.1  chopps Load_fd()
     65  1.1  chopps {
     66  1.1  chopps 	Tmp_dir
     67  1.1  chopps 	which=
     68  1.1  chopps 	while [ "$which" != "a" -a "$which" != "b" ]; do
     69  1.1  chopps 		echo -n	"Read from which floppy drive ('a' or 'b')? [a] "
     70  1.1  chopps 		read which
     71  1.1  chopps 		if [ "X$which" = "X" ]; then
     72  1.1  chopps 			which=a
     73  1.1  chopps 		fi
     74  1.1  chopps 	done
     75  1.1  chopps 	while echo -n "Insert floppy (hit ^C to terminate, enter to load): "
     76  1.1  chopps 	do
     77  1.1  chopps 		mount -t msdos /dev/fd0$which /mnt2
     78  1.1  chopps 		cp -rp /mnt2/* .
     79  1.1  chopps 		umount /mnt2
     80  1.1  chopps 	done
     81  1.1  chopps }
     82  1.1  chopps 
     83  1.1  chopps Load_tape()
     84  1.1  chopps {
     85  1.1  chopps 	Tmp_dir
     86  1.1  chopps 	echo -n	"Which tape drive will you be using? [rst0] "
     87  1.1  chopps 	read which
     88  1.1  chopps 	if [ "X$which" = "X" ]; then
     89  1.1  chopps 		which=rst0
     90  1.1  chopps 	fi
     91  1.1  chopps 	echo -n "Insert the tape into the tape drive and hit return to "
     92  1.1  chopps 	echo -n "continue..."
     93  1.1  chopps 	read foo
     94  1.1  chopps 	echo	"Extracting files from the tape..."
     95  1.1  chopps 	tar xvfp /dev/$which
     96  1.1  chopps 	echo	"Done."
     97  1.1  chopps }
     98  1.1  chopps 
     99  1.1  chopps Extract()
    100  1.1  chopps {
    101  1.1  chopps 	Tmp_dir
    102  1.1  chopps 	echo -n "Would you like to list the files as they're extracted? [n] "
    103  1.1  chopps 	read verbose
    104  1.1  chopps 	case $verbose in
    105  1.1  chopps 	y*|Y*)
    106  1.1  chopps 		tarverbose=v
    107  1.1  chopps 		;;
    108  1.1  chopps 	*)
    109  1.1  chopps 		tarverbose=
    110  1.1  chopps 		;;
    111  1.1  chopps 	esac
    112  1.1  chopps 	cat "$1".??? | gunzip | (cd / ; tar xfp$tarverbose -)
    113  1.1  chopps }
    114