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