dot.instutils revision 1.1 1 1.1 perry # $NetBSD: dot.instutils,v 1.1 1997/06/14 18:56:10 perry Exp $
2 1.1 perry #
3 1.1 perry # Copyright (c) 1994 Christopher G. Demetriou
4 1.1 perry # All rights reserved.
5 1.1 perry #
6 1.1 perry # Redistribution and use in source and binary forms, with or without
7 1.1 perry # modification, are permitted provided that the following conditions
8 1.1 perry # are met:
9 1.1 perry # 1. Redistributions of source code must retain the above copyright
10 1.1 perry # notice, this list of conditions and the following disclaimer.
11 1.1 perry # 2. Redistributions in binary form must reproduce the above copyright
12 1.1 perry # notice, this list of conditions and the following disclaimer in the
13 1.1 perry # documentation and/or other materials provided with the distribution.
14 1.1 perry # 3. All advertising materials mentioning features or use of this software
15 1.1 perry # must display the following acknowledgement:
16 1.1 perry # This product includes software developed by Christopher G. Demetriou.
17 1.1 perry # 4. The name of the author may not be used to endorse or promote products
18 1.1 perry # derived from this software without specific prior written permission
19 1.1 perry #
20 1.1 perry # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21 1.1 perry # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22 1.1 perry # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 1.1 perry # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24 1.1 perry # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 1.1 perry # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 1.1 perry # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 1.1 perry # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 1.1 perry # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 1.1 perry # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 1.1 perry #
31 1.1 perry
32 1.1 perry # Installation configuration utilities (functions), to get NetBSD configured
33 1.1 perry # reasonably once it is installed on the hard disk. These are meant to be
34 1.1 perry # invoked from the shell prompt, by people installing NetBSD.
35 1.1 perry
36 1.1 perry Configure()
37 1.1 perry {
38 1.1 perry DEV=/dev
39 1.1 perry ETC=/etc
40 1.1 perry if [ ! -f /etc/fstab ]; then
41 1.1 perry DEV=/mnt/dev
42 1.1 perry ETC=/mnt/etc
43 1.1 perry fi
44 1.1 perry
45 1.1 perry echo "You will now be prompted for information about this"
46 1.1 perry echo "machine. If you hit return, the default answer (in"
47 1.1 perry echo "brackets) will be used."
48 1.1 perry
49 1.1 perry echo ""
50 1.1 perry echo -n "What is this machine's hostname? [unknown.host.domain] "
51 1.1 perry read hname
52 1.1 perry if [ "$hname" = "" ]; then
53 1.1 perry hname=unknown.host.domain
54 1.1 perry fi
55 1.1 perry echo $hname > ${ETC}/myname
56 1.1 perry proto_domain=`echo $hname | sed -e 's/[^.]*\.//'`
57 1.1 perry
58 1.1 perry echo ""
59 1.1 perry echo "What domain is this machine in (this is NOT its YP"
60 1.1 perry echo -n "domain name)? [$proto_domain] "
61 1.1 perry read dname
62 1.1 perry if [ "$dname" = "" ]; then
63 1.1 perry dname=$proto_domain
64 1.1 perry fi
65 1.1 perry
66 1.1 perry echo ""
67 1.1 perry if [ -e $ETC/sendmail.cf ]; then
68 1.1 perry echo "WARNING: A default sendmail.cf exists, and probably"
69 1.1 perry echo "needs to be tuned and/or replaced, to work properly at"
70 1.1 perry echo "your site!"
71 1.1 perry else
72 1.1 perry echo "WARNING: No default sendmail.cf installed. Did you"
73 1.1 perry echo "forget to install the 'etc' distribution?"
74 1.1 perry fi
75 1.1 perry
76 1.1 perry echo "127.0.0.1 localhost localhost.$dname" > ${ETC}/hosts
77 1.1 perry
78 1.1 perry echo ""
79 1.1 perry echo -n "Does this machine have an ethernet interface? [y] "
80 1.1 perry read resp
81 1.1 perry case "$resp" in
82 1.1 perry n*)
83 1.1 perry ;;
84 1.1 perry *)
85 1.1 perry intf=
86 1.1 perry while [ "$intf" = "" ]; do
87 1.1 perry echo -n "What is the primary interface name "
88 1.1 perry echo -n "(e.g. ed0, ep0, etc)? "
89 1.1 perry read intf
90 1.1 perry done
91 1.1 perry echo -n "What is the hostname for this interface? [$hname] "
92 1.1 perry read ifname
93 1.1 perry if [ "$ifname" = "" ]; then
94 1.1 perry ifname=$hname
95 1.1 perry fi
96 1.1 perry ifaddr=
97 1.1 perry while [ "$ifaddr" = "" ]; do
98 1.1 perry echo -n "What is the IP address associated with "
99 1.1 perry echo -n "interface ${intf}? "
100 1.1 perry read ifaddr
101 1.1 perry done
102 1.1 perry echo "$ifaddr $ifname `echo $ifname | sed -e s/\.$dname//`" \
103 1.1 perry >> ${ETC}/hosts
104 1.1 perry
105 1.1 perry echo -n "Does this interface have a special netmask? [n] "
106 1.1 perry read resp
107 1.1 perry case "$resp" in
108 1.1 perry y*)
109 1.1 perry echo -n "What is the netmask? [0xffffff00] "
110 1.1 perry read ifnetmask
111 1.1 perry if [ "$ifnetmask" = "" ]; then
112 1.1 perry ifnetmask=0xffffff00
113 1.1 perry fi
114 1.1 perry ;;
115 1.1 perry *)
116 1.1 perry ifnetmask=
117 1.1 perry ;;
118 1.1 perry esac
119 1.1 perry
120 1.1 perry echo -n "Does this interface need additional flags? [n] "
121 1.1 perry read resp
122 1.1 perry case "$resp" in
123 1.1 perry y*)
124 1.1 perry echo -n "What flags? [link0] "
125 1.1 perry read ifflags
126 1.1 perry if [ "$ifflags" = "" ]; then
127 1.1 perry ifflags=link0
128 1.1 perry fi
129 1.1 perry ;;
130 1.1 perry *)
131 1.1 perry ifflags=
132 1.1 perry ;;
133 1.1 perry esac
134 1.1 perry echo "inet $ifname $ifnetmask $ifflags" > ${ETC}/hostname.$intf
135 1.1 perry
136 1.1 perry echo ""
137 1.1 perry echo -n "WARNING: if you have any more ethernet interfaces, "
138 1.1 perry echo "you will have to configure"
139 1.1 perry echo -n "them by hand. Read the comments in /etc/netstart to "
140 1.1 perry echo "learn how to do this."
141 1.1 perry ;;
142 1.1 perry esac
143 1.1 perry
144 1.1 perry echo ""
145 1.1 perry echo -n "Making device nodes (may take a while)..."
146 1.1 perry cd ${DEV}
147 1.1 perry sh MAKEDEV all
148 1.1 perry echo " done."
149 1.1 perry
150 1.1 perry sync
151 1.1 perry
152 1.1 perry echo ""
153 1.1 perry echo "If you haven't already installed a kernel on the hard drive"
154 1.1 perry echo "using your kernel-copy floppy, do so now. Kernel"
155 1.1 perry echo "installation instructions can be found in the"
156 1.1 perry echo "installation notes."
157 1.1 perry }
158 1.1 perry
159 1.1 perry # Upgrade cleanup utilities (functions), to make sure a recently-upgraded
160 1.1 perry # system is safely runnable. These are meant to be invoked from the shell
161 1.1 perry # prompt, by people installing NetBSD.
162 1.1 perry
163 1.1 perry Cleanup()
164 1.1 perry {
165 1.1 perry upgrade_dir=/
166 1.1 perry
167 1.1 perry if [ ! -f /etc/fstab ]; then
168 1.1 perry upgrade_dir=/mnt
169 1.1 perry fi
170 1.1 perry
171 1.1 perry echo "Cleaning up miscellaneous files in /etc..."
172 1.1 perry mv $upgrade_dir/etc/rc.bak $upgrade_dir/etc/rc
173 1.1 perry chroot $upgrade_dir /usr/sbin/pwd_mkdb -p /etc/master.passwd
174 1.1 perry chroot $upgrade_dir /bin/rm /etc/sendmail.fc > /dev/null 2>&1
175 1.1 perry sync
176 1.1 perry echo "Done."
177 1.1 perry
178 1.1 perry echo ""
179 1.1 perry echo "All that's left to do now is to install a new NetBSD kernel"
180 1.1 perry echo "on your hard disk. You should now halt your machine using"
181 1.1 perry echo "the 'halt' command. Once the machine is halted, replace the"
182 1.1 perry echo "installation floppy with the kernel-copy floppy and hit any"
183 1.1 perry echo "key to reboot. Use the kernel-copy floppy to copy a kernel"
184 1.1 perry echo "to your hard disk."
185 1.1 perry }
186