dot.instutils revision 1.6
11.1Schopps#
21.1Schopps# Copyright (c) 1994 Christopher G. Demetriou
31.1Schopps# All rights reserved.
41.1Schopps# 
51.1Schopps# Redistribution and use in source and binary forms, with or without
61.1Schopps# modification, are permitted provided that the following conditions
71.1Schopps# are met:
81.1Schopps# 1. Redistributions of source code must retain the above copyright
91.1Schopps#    notice, this list of conditions and the following disclaimer.
101.1Schopps# 2. Redistributions in binary form must reproduce the above copyright
111.1Schopps#    notice, this list of conditions and the following disclaimer in the
121.1Schopps#    documentation and/or other materials provided with the distribution.
131.1Schopps# 3. All advertising materials mentioning features or use of this software
141.1Schopps#    must display the following acknowledgement:
151.1Schopps#	This product includes software developed by Christopher G. Demetriou.
161.1Schopps# 4. The name of the author may not be used to endorse or promote products
171.1Schopps#    derived from this software without specific prior written permission
181.1Schopps#
191.1Schopps# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
201.1Schopps# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
211.1Schopps# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
221.1Schopps# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
231.1Schopps# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
241.1Schopps# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
251.1Schopps# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
261.1Schopps# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
271.1Schopps# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
281.1Schopps# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
291.1Schopps#
301.6Slukem#	$NetBSD: dot.instutils,v 1.6 2000/05/13 08:13:53 lukem Exp $
311.1Schopps
321.1Schopps# Installation configuration utilites (functions), to get NetBSD configured
331.1Schopps# reasonably once it is installed on the hard disk.  These are meant to be
341.1Schopps# invoked from the shell prompt, by people installing NetBSD.
351.1Schopps
361.1SchoppsConfigure()
371.1Schopps{
381.1Schopps	DEV=/mnt/dev
391.1Schopps	ETC=/mnt/etc
401.1Schopps
411.1Schopps	echo	"You will now be prompted for information about this"
421.1Schopps	echo	"machine.  If you hit return, the default answer (in"
431.1Schopps	echo	"brackets) will be used."
441.1Schopps
451.1Schopps	echo	""
461.1Schopps	echo -n	"What is this machine's hostname? [unknown.host.domain] "
471.1Schopps	read hname
481.1Schopps	if [ "$hname" = "" ]; then
491.1Schopps		hname=unknown.host.domain
501.1Schopps	fi
511.1Schopps	echo $hname > ${ETC}/myname
521.1Schopps	proto_domain=`echo $hname | sed -e 's/[^.]*\.//'`
531.1Schopps
541.1Schopps	echo	""
551.1Schopps	echo	"What domain is this machine in (this is NOT its YP"
561.1Schopps	echo -n	"domain name)? [$proto_domain] "
571.1Schopps	read dname
581.1Schopps	if [ "$dname" = "" ]; then
591.1Schopps		dname=$proto_domain
601.1Schopps	fi
611.1Schopps
621.1Schopps	echo	""
631.2Schopps	if [ -e /mnt/etc/sendmail.cf ]; then
641.1Schopps		echo	"WARNING: A default sendmail.cf exists, and probably"
651.1Schopps		echo	"needs to be tuned and/or replaced, to work properly at"
661.1Schopps		echo	"your site!"
671.1Schopps	else
681.1Schopps		echo	"WARNING: No default sendmail.cf installed.  Did you"
691.1Schopps		echo	"forget to install the 'etc' distribution?"
701.1Schopps	fi
711.1Schopps
721.1Schopps	echo	"127.0.0.1	localhost localhost.$dname" > ${ETC}/hosts
731.1Schopps
741.1Schopps	echo	""
751.1Schopps	echo -n	"Does this machine have an ethernet interface? [y] "
761.1Schopps        read resp
771.1Schopps        case "$resp" in
781.1Schopps	n*)
791.1Schopps		;;
801.1Schopps	*)
811.1Schopps		intf=
821.1Schopps		while [ "$intf" = "" ]; do
831.1Schopps			echo -n "What is the primary interface name "
841.2Schopps			echo -n "(e.g. ae0, ed0, le0, or es0)? "
851.1Schopps			read intf
861.1Schopps		done
871.1Schopps		echo -n "What is the hostname for this interface? [$hname] "
881.1Schopps		read ifname
891.1Schopps		if [ "$ifname" = "" ]; then
901.1Schopps			ifname=$hname
911.1Schopps		fi
921.1Schopps		ifaddr=
931.1Schopps		while [ "$ifaddr" = "" ]; do
941.1Schopps			echo -n "What is the IP address associated with "
951.1Schopps			echo -n "interface ${intf}? "
961.1Schopps			read ifaddr
971.1Schopps		done
981.1Schopps		echo "$ifaddr	$ifname `echo $ifname | sed -e s/\.$dname//`" \
991.1Schopps		    >> ${ETC}/hosts
1001.1Schopps
1011.1Schopps		echo -n "Does this interface have a special netmask? [n] "
1021.1Schopps		read resp
1031.1Schopps		case "$resp" in
1041.1Schopps			y*)
1051.1Schopps				echo -n "What is the netmask? [0xffffff00] "
1061.1Schopps				read ifnetmask
1071.1Schopps				if [ "$ifnetmask" = "" ]; then
1081.1Schopps					ifnetmask=0xffffff00
1091.1Schopps				fi
1101.1Schopps				;;
1111.1Schopps			*)
1121.1Schopps				ifnetmask=
1131.1Schopps				;;
1141.1Schopps		esac
1151.1Schopps
1161.1Schopps		echo -n "Does this interface need additional flags? [n] "
1171.1Schopps		read resp
1181.1Schopps		case "$resp" in
1191.1Schopps			y*)
1201.1Schopps				echo -n "What flags? [link0] "
1211.1Schopps				read ifflags
1221.1Schopps				if [ "$ifflags" = "" ]; then
1231.1Schopps					ifflags=link0
1241.1Schopps				fi
1251.1Schopps				;;
1261.1Schopps			*)
1271.1Schopps				ifflags=
1281.1Schopps				;;
1291.1Schopps		esac
1301.1Schopps		echo "inet $ifname $ifnetmask $ifflags" > ${ETC}/hostname.$intf
1311.1Schopps
1321.1Schopps		echo    ""
1331.1Schopps		echo -n	"WARNING: if you have any more ethernet interfaces, "
1341.1Schopps		echo	"you will have to configure"
1351.6Slukem		echo -n "them by hand.  Read the comments in /etc/rc.d/network "
1361.6Slukem		echo	"to learn how to do this."
1371.1Schopps		;;
1381.1Schopps	esac
1391.1Schopps	
1401.1Schopps	echo	""
1411.2Schopps	echo -n	"Making device nodes (may take a while)..."
1421.1Schopps	cd ${DEV}
1431.1Schopps	sh MAKEDEV all
1441.1Schopps	echo	" done."
1451.1Schopps
1461.3Sis        echo    ""
1471.3Sis        echo -n "Copying the kernel..."
1481.3Sis        cp /netbsd /mnt/netbsd
1491.3Sis        echo    "Done."
1501.3Sis	echo -n "Installing boot block..."
1511.3Sis	read rdev rest < /mnt/etc/fstab
1521.4Sis	/mnt/usr/mdec/installboot /mnt/usr/mdec/xxboot `echo $rdev | sed -e 's^/dev/^/dev/r^'`
1531.3Sis	echo	" done."
1541.3Sis
1551.1Schopps	sync
1561.1Schopps
1571.1Schopps	echo	""
1581.3Sis	echo	"You should now halt your machine using the 'halt' command."
1591.3Sis	echo	"Once the machine is halted, reboot it."
1601.1Schopps}
161