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