dot.instutils revision 1.7
1# $NetBSD: dot.instutils,v 1.7 2000/06/14 06:48:48 cgd 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# Installation configuration utilites (functions), to get NetBSD configured
32# reasonably once it is installed on the hard disk.  These are meant to be
33# invoked from the shell prompt, by people installing NetBSD.
34
35Configure()
36{
37	DEV=/mnt/dev
38	ETC=/mnt/etc
39
40	echo	"You will now be prompted for information about this"
41	echo	"machine.  If you hit return, the default answer (in"
42	echo	"brackets) will be used."
43
44	echo	""
45	echo -n	"What is this machine's hostname? [unknown.host.domain] "
46	read hname
47	if [ "$hname" = "" ]; then
48		hname=unknown.host.domain
49	fi
50	echo $hname > ${ETC}/myname
51	proto_domain=`echo $hname | sed -e 's/[^.]*\.//'`
52
53	echo	""
54	echo	"What domain is this machine in (this is NOT its YP"
55	echo -n	"domain name)? [$proto_domain] "
56	read dname
57	if [ "$dname" = "" ]; then
58		dname=$proto_domain
59	fi
60
61	echo	""
62	if [ -e /mnt/etc/sendmail.cf ]; then
63		echo	"WARNING: A default sendmail.cf exists, and probably"
64		echo	"needs to be tuned and/or replaced, to work properly at"
65		echo	"your site!"
66	else
67		echo	"WARNING: No default sendmail.cf installed.  Did you"
68		echo	"forget to install the 'etc' distribution?"
69	fi
70
71	echo	"127.0.0.1	localhost localhost.$dname" > ${ETC}/hosts
72
73	echo	""
74	echo -n	"Does this machine have an ethernet interface? [y] "
75        read resp
76        case "$resp" in
77	n*)
78		;;
79	*)
80		intf=
81		while [ "$intf" = "" ]; do
82			echo -n "What is the primary interface name "
83			echo -n "(e.g. ae0, ed0, le0, or es0)? "
84			read intf
85		done
86		echo -n "What is the hostname for this interface? [$hname] "
87		read ifname
88		if [ "$ifname" = "" ]; then
89			ifname=$hname
90		fi
91		ifaddr=
92		while [ "$ifaddr" = "" ]; do
93			echo -n "What is the IP address associated with "
94			echo -n "interface ${intf}? "
95			read ifaddr
96		done
97		echo "$ifaddr	$ifname `echo $ifname | sed -e s/\.$dname//`" \
98		    >> ${ETC}/hosts
99
100		echo -n "Does this interface have a special netmask? [n] "
101		read resp
102		case "$resp" in
103			y*)
104				echo -n "What is the netmask? [0xffffff00] "
105				read ifnetmask
106				if [ "$ifnetmask" = "" ]; then
107					ifnetmask=0xffffff00
108				fi
109				;;
110			*)
111				ifnetmask=
112				;;
113		esac
114
115		echo -n "Does this interface need additional flags? [n] "
116		read resp
117		case "$resp" in
118			y*)
119				echo -n "What flags? [link0] "
120				read ifflags
121				if [ "$ifflags" = "" ]; then
122					ifflags=link0
123				fi
124				;;
125			*)
126				ifflags=
127				;;
128		esac
129		echo "inet $ifname $ifnetmask $ifflags" > ${ETC}/hostname.$intf
130
131		echo    ""
132		echo -n	"WARNING: if you have any more ethernet interfaces, "
133		echo	"you will have to configure"
134		echo -n "them by hand.  Read the comments in /etc/rc.d/network "
135		echo	"to learn how to do this."
136		;;
137	esac
138	
139	echo	""
140	echo -n	"Making device nodes (may take a while)..."
141	cd ${DEV}
142	sh MAKEDEV all
143	echo	" done."
144
145        echo    ""
146        echo -n "Copying the kernel..."
147        cp /netbsd /mnt/netbsd
148        echo    "Done."
149	echo -n "Installing boot block..."
150	read rdev rest < /mnt/etc/fstab
151	/mnt/usr/mdec/installboot /mnt/usr/mdec/xxboot `echo $rdev | sed -e 's^/dev/^/dev/r^'`
152	echo	" done."
153
154	sync
155
156	echo	""
157	echo	"You should now halt your machine using the 'halt' command."
158	echo	"Once the machine is halted, reboot it."
159}
160