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