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