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