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