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