dot.commonutils revision 1.3
11.1Schopps#
21.1Schopps# Copyright (c) 1994 Christopher G. Demetriou
31.1Schopps# All rights reserved.
41.1Schopps# 
51.1Schopps# Redistribution and use in source and binary forms, with or without
61.1Schopps# modification, are permitted provided that the following conditions
71.1Schopps# are met:
81.1Schopps# 1. Redistributions of source code must retain the above copyright
91.1Schopps#    notice, this list of conditions and the following disclaimer.
101.1Schopps# 2. Redistributions in binary form must reproduce the above copyright
111.1Schopps#    notice, this list of conditions and the following disclaimer in the
121.1Schopps#    documentation and/or other materials provided with the distribution.
131.1Schopps# 3. All advertising materials mentioning features or use of this software
141.1Schopps#    must display the following acknowledgement:
151.1Schopps#	This product includes software developed by Christopher G. Demetriou.
161.1Schopps# 4. The name of the author may not be used to endorse or promote products
171.1Schopps#    derived from this software without specific prior written permission
181.1Schopps#
191.1Schopps# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
201.1Schopps# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
211.1Schopps# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
221.1Schopps# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
231.1Schopps# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
241.1Schopps# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
251.1Schopps# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
261.1Schopps# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
271.1Schopps# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
281.1Schopps# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
291.2Schopps#
301.3Schopps#	$Id: dot.commonutils,v 1.3 1995/10/09 02:41:31 chopps Exp $
311.1Schopps
321.1Schopps# Installation utilites (functions), to get NetBSD installed on
331.1Schopps# the hard disk.  These are meant to be invoked from the shell prompt,
341.1Schopps# by people installing NetBSD.
351.1Schopps
361.3Schopps# we know that /etc/fstab is only generated on the hard drive
371.3Schoppsdest_dir=/
381.3Schoppsif [ ! -f /etc/fstab ]; then
391.3Schopps	dest_dir=/mnt/
401.3Schoppsfi
411.3Schopps
421.3Schopps# counter for possible shared library confusion
431.3SchoppsTAR=/usr/bin/tar
441.3SchoppsGUNZIP=/usr/bin/gunzip
451.3Schopps
461.1SchoppsSet_tmp_dir()
471.1Schopps{
481.1Schopps	def_tmp_dir=`pwd`
491.1Schopps	if [ "$def_tmp_dir" = "/" -o "$def_tmp_dir" = "/mnt" ]; then
501.3Schopps		def_tmp_dir="$dest_dir"usr/distrib
511.1Schopps	fi
521.1Schopps
531.1Schopps	echo -n	"What directory should be used to find and/or store "
541.3Schopps	echo	"installation"
551.1Schopps	echo -n	"files? [$def_tmp_dir] "
561.1Schopps	read tmp_dir
571.1Schopps	if [ "$tmp_dir" = "" ]; then
581.1Schopps		tmp_dir=$def_tmp_dir
591.1Schopps	fi
601.1Schopps	if [ ! -d "$tmp_dir" ]; then
611.1Schopps		/bin/rm -rf $tmp_dir
621.1Schopps		mkdir -p $tmp_dir
631.1Schopps	fi
641.1Schopps}
651.1Schopps
661.1SchoppsTmp_dir()
671.1Schopps{
681.1Schopps	if [ "$tmp_dir" = "" ]; then
691.1Schopps		Set_tmp_dir
701.1Schopps	fi
711.1Schopps	cd $tmp_dir
721.1Schopps}
731.1Schopps
741.1SchoppsLoad_fd()
751.1Schopps{
761.1Schopps	Tmp_dir
771.1Schopps	which=
781.1Schopps	while [ "$which" != "a" -a "$which" != "b" ]; do
791.1Schopps		echo -n	"Read from which floppy drive ('a' or 'b')? [a] "
801.1Schopps		read which
811.1Schopps		if [ "X$which" = "X" ]; then
821.1Schopps			which=a
831.1Schopps		fi
841.1Schopps	done
851.1Schopps	while echo -n "Insert floppy (hit ^C to terminate, enter to load): "
861.1Schopps	do
871.1Schopps		mount -t msdos /dev/fd0$which /mnt2
881.1Schopps		cp -rp /mnt2/* .
891.1Schopps		umount /mnt2
901.1Schopps	done
911.1Schopps}
921.1Schopps
931.1SchoppsLoad_tape()
941.1Schopps{
951.1Schopps	Tmp_dir
961.1Schopps	echo -n	"Which tape drive will you be using? [rst0] "
971.1Schopps	read which
981.1Schopps	if [ "X$which" = "X" ]; then
991.1Schopps		which=rst0
1001.1Schopps	fi
1011.1Schopps	echo -n "Insert the tape into the tape drive and hit return to "
1021.1Schopps	echo -n "continue..."
1031.1Schopps	read foo
1041.1Schopps	echo	"Extracting files from the tape..."
1051.3Schopps	$TAR xvpf --unlink /dev/$which
1061.1Schopps	echo	"Done."
1071.1Schopps}
1081.1Schopps
1091.1SchoppsExtract()
1101.1Schopps{
1111.1Schopps	Tmp_dir
1121.1Schopps	echo -n "Would you like to list the files as they're extracted? [n] "
1131.1Schopps	read verbose
1141.1Schopps	case $verbose in
1151.1Schopps	y*|Y*)
1161.1Schopps		tarverbose=v
1171.1Schopps		;;
1181.1Schopps	*)
1191.1Schopps		tarverbose=
1201.1Schopps		;;
1211.1Schopps	esac
1221.3Schopps	cat "$1".?? | $GUNZIP | (cd $dest_dir ; $TAR --unlink -xp"$tarverbose"f -)
1231.1Schopps}
124