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