1# $NetBSD: dot.instutils,v 1.8 2000/06/14 17:24:06 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 for the
17#          NetBSD Project.  See http://www.netbsd.org/ for
18#          information about NetBSD.
19# 4. The name of the author may not be used to endorse or promote products
20#    derived from this software without specific prior written permission.
21#
22# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32#
33# <<Id: LICENSE,v 1.2 2000/06/14 15:57:33 cgd Exp>>
34
35# Installation configuration utilites (functions), to get NetBSD configured
36# reasonably once it is installed on the hard disk.  These are meant to be
37# invoked from the shell prompt, by people installing NetBSD.
38
39Configure()
40{
41	DEV=/mnt/dev
42	ETC=/mnt/etc
43
44	echo	"You will now be prompted for information about this"
45	echo	"machine.  If you hit return, the default answer (in"
46	echo	"brackets) will be used."
47
48	echo	""
49	echo -n	"What is this machine's hostname? [unknown.host.domain] "
50	read hname
51	if [ "$hname" = "" ]; then
52		hname=unknown.host.domain
53	fi
54	echo $hname > ${ETC}/myname
55	proto_domain=`echo $hname | sed -e 's/[^.]*\.//'`
56
57	echo	""
58	echo	"What domain is this machine in (this is NOT its YP"
59	echo -n	"domain name)? [$proto_domain] "
60	read dname
61	if [ "$dname" = "" ]; then
62		dname=$proto_domain
63	fi
64
65	echo	""
66	if [ -e /mnt/etc/sendmail.cf ]; then
67		echo	"WARNING: A default sendmail.cf exists, and probably"
68		echo	"needs to be tuned and/or replaced, to work properly at"
69		echo	"your site!"
70	else
71		echo	"WARNING: No default sendmail.cf installed.  Did you"
72		echo	"forget to install the 'etc' distribution?"
73	fi
74
75	echo	"127.0.0.1	localhost localhost.$dname" > ${ETC}/hosts
76
77	echo	""
78	echo -n	"Does this machine have an ethernet interface? [y] "
79        read resp
80        case "$resp" in
81	n*)
82		;;
83	*)
84		intf=
85		while [ "$intf" = "" ]; do
86			echo -n "What is the primary interface name "
87			echo -n "(e.g. ae0, ed0, le0, or es0)? "
88			read intf
89		done
90		echo -n "What is the hostname for this interface? [$hname] "
91		read ifname
92		if [ "$ifname" = "" ]; then
93			ifname=$hname
94		fi
95		ifaddr=
96		while [ "$ifaddr" = "" ]; do
97			echo -n "What is the IP address associated with "
98			echo -n "interface ${intf}? "
99			read ifaddr
100		done
101		echo "$ifaddr	$ifname `echo $ifname | sed -e s/\.$dname//`" \
102		    >> ${ETC}/hosts
103
104		echo -n "Does this interface have a special netmask? [n] "
105		read resp
106		case "$resp" in
107			y*)
108				echo -n "What is the netmask? [0xffffff00] "
109				read ifnetmask
110				if [ "$ifnetmask" = "" ]; then
111					ifnetmask=0xffffff00
112				fi
113				;;
114			*)
115				ifnetmask=
116				;;
117		esac
118
119		echo -n "Does this interface need additional flags? [n] "
120		read resp
121		case "$resp" in
122			y*)
123				echo -n "What flags? [link0] "
124				read ifflags
125				if [ "$ifflags" = "" ]; then
126					ifflags=link0
127				fi
128				;;
129			*)
130				ifflags=
131				;;
132		esac
133		echo "inet $ifname $ifnetmask $ifflags" > ${ETC}/hostname.$intf
134
135		echo    ""
136		echo -n	"WARNING: if you have any more ethernet interfaces, "
137		echo	"you will have to configure"
138		echo -n "them by hand.  Read the comments in /etc/rc.d/network "
139		echo	"to learn how to do this."
140		;;
141	esac
142
143	echo	""
144	echo -n	"Making device nodes (may take a while)..."
145	cd ${DEV}
146	sh MAKEDEV all
147	echo	" done."
148
149        echo    ""
150        echo -n "Copying the kernel..."
151        cp /netbsd /mnt/netbsd
152        echo    "Done."
153	echo -n "Installing boot block..."
154	read rdev rest < /mnt/etc/fstab
155	/mnt/usr/mdec/installboot /mnt/usr/mdec/xxboot `echo $rdev | sed -e 's^/dev/^/dev/r^'`
156	echo	" done."
157
158	sync
159
160	echo	""
161	echo	"You should now halt your machine using the 'halt' command."
162	echo	"Once the machine is halted, reboot it."
163}
164