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