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