dot.instutils revision 1.1
11.1Sperry#	$NetBSD: dot.instutils,v 1.1 1997/06/14 18:56:10 perry Exp $
21.1Sperry#
31.1Sperry# Copyright (c) 1994 Christopher G. Demetriou
41.1Sperry# All rights reserved.
51.1Sperry# 
61.1Sperry# Redistribution and use in source and binary forms, with or without
71.1Sperry# modification, are permitted provided that the following conditions
81.1Sperry# are met:
91.1Sperry# 1. Redistributions of source code must retain the above copyright
101.1Sperry#    notice, this list of conditions and the following disclaimer.
111.1Sperry# 2. Redistributions in binary form must reproduce the above copyright
121.1Sperry#    notice, this list of conditions and the following disclaimer in the
131.1Sperry#    documentation and/or other materials provided with the distribution.
141.1Sperry# 3. All advertising materials mentioning features or use of this software
151.1Sperry#    must display the following acknowledgement:
161.1Sperry#	This product includes software developed by Christopher G. Demetriou.
171.1Sperry# 4. The name of the author may not be used to endorse or promote products
181.1Sperry#    derived from this software without specific prior written permission
191.1Sperry#
201.1Sperry# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
211.1Sperry# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
221.1Sperry# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
231.1Sperry# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
241.1Sperry# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
251.1Sperry# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
261.1Sperry# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
271.1Sperry# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
281.1Sperry# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
291.1Sperry# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
301.1Sperry#
311.1Sperry
321.1Sperry# Installation configuration utilities (functions), to get NetBSD configured
331.1Sperry# reasonably once it is installed on the hard disk.  These are meant to be
341.1Sperry# invoked from the shell prompt, by people installing NetBSD.
351.1Sperry
361.1SperryConfigure()
371.1Sperry{
381.1Sperry	DEV=/dev
391.1Sperry	ETC=/etc
401.1Sperry	if [ ! -f /etc/fstab ]; then
411.1Sperry		DEV=/mnt/dev
421.1Sperry		ETC=/mnt/etc
431.1Sperry	fi
441.1Sperry
451.1Sperry	echo	"You will now be prompted for information about this"
461.1Sperry	echo	"machine.  If you hit return, the default answer (in"
471.1Sperry	echo	"brackets) will be used."
481.1Sperry
491.1Sperry	echo	""
501.1Sperry	echo -n	"What is this machine's hostname? [unknown.host.domain] "
511.1Sperry	read hname
521.1Sperry	if [ "$hname" = "" ]; then
531.1Sperry		hname=unknown.host.domain
541.1Sperry	fi
551.1Sperry	echo $hname > ${ETC}/myname
561.1Sperry	proto_domain=`echo $hname | sed -e 's/[^.]*\.//'`
571.1Sperry
581.1Sperry	echo	""
591.1Sperry	echo	"What domain is this machine in (this is NOT its YP"
601.1Sperry	echo -n	"domain name)? [$proto_domain] "
611.1Sperry	read dname
621.1Sperry	if [ "$dname" = "" ]; then
631.1Sperry		dname=$proto_domain
641.1Sperry	fi
651.1Sperry
661.1Sperry	echo	""
671.1Sperry	if [ -e $ETC/sendmail.cf ]; then
681.1Sperry		echo	"WARNING: A default sendmail.cf exists, and probably"
691.1Sperry		echo	"needs to be tuned and/or replaced, to work properly at"
701.1Sperry		echo	"your site!"
711.1Sperry	else
721.1Sperry		echo	"WARNING: No default sendmail.cf installed.  Did you"
731.1Sperry		echo	"forget to install the 'etc' distribution?"
741.1Sperry	fi
751.1Sperry
761.1Sperry	echo	"127.0.0.1	localhost localhost.$dname" > ${ETC}/hosts
771.1Sperry
781.1Sperry	echo	""
791.1Sperry	echo -n	"Does this machine have an ethernet interface? [y] "
801.1Sperry        read resp
811.1Sperry        case "$resp" in
821.1Sperry	n*)
831.1Sperry		;;
841.1Sperry	*)
851.1Sperry		intf=
861.1Sperry		while [ "$intf" = "" ]; do
871.1Sperry			echo -n "What is the primary interface name "
881.1Sperry			echo -n "(e.g. ed0, ep0, etc)? "
891.1Sperry			read intf
901.1Sperry		done
911.1Sperry		echo -n "What is the hostname for this interface? [$hname] "
921.1Sperry		read ifname
931.1Sperry		if [ "$ifname" = "" ]; then
941.1Sperry			ifname=$hname
951.1Sperry		fi
961.1Sperry		ifaddr=
971.1Sperry		while [ "$ifaddr" = "" ]; do
981.1Sperry			echo -n "What is the IP address associated with "
991.1Sperry			echo -n "interface ${intf}? "
1001.1Sperry			read ifaddr
1011.1Sperry		done
1021.1Sperry		echo "$ifaddr	$ifname `echo $ifname | sed -e s/\.$dname//`" \
1031.1Sperry		    >> ${ETC}/hosts
1041.1Sperry
1051.1Sperry		echo -n "Does this interface have a special netmask? [n] "
1061.1Sperry		read resp
1071.1Sperry		case "$resp" in
1081.1Sperry			y*)
1091.1Sperry				echo -n "What is the netmask? [0xffffff00] "
1101.1Sperry				read ifnetmask
1111.1Sperry				if [ "$ifnetmask" = "" ]; then
1121.1Sperry					ifnetmask=0xffffff00
1131.1Sperry				fi
1141.1Sperry				;;
1151.1Sperry			*)
1161.1Sperry				ifnetmask=
1171.1Sperry				;;
1181.1Sperry		esac
1191.1Sperry
1201.1Sperry		echo -n "Does this interface need additional flags? [n] "
1211.1Sperry		read resp
1221.1Sperry		case "$resp" in
1231.1Sperry			y*)
1241.1Sperry				echo -n "What flags? [link0] "
1251.1Sperry				read ifflags
1261.1Sperry				if [ "$ifflags" = "" ]; then
1271.1Sperry					ifflags=link0
1281.1Sperry				fi
1291.1Sperry				;;
1301.1Sperry			*)
1311.1Sperry				ifflags=
1321.1Sperry				;;
1331.1Sperry		esac
1341.1Sperry		echo "inet $ifname $ifnetmask $ifflags" > ${ETC}/hostname.$intf
1351.1Sperry
1361.1Sperry		echo    ""
1371.1Sperry		echo -n	"WARNING: if you have any more ethernet interfaces, "
1381.1Sperry		echo	"you will have to configure"
1391.1Sperry		echo -n "them by hand.  Read the comments in /etc/netstart to "
1401.1Sperry		echo	"learn how to do this."
1411.1Sperry		;;
1421.1Sperry	esac
1431.1Sperry	
1441.1Sperry	echo	""
1451.1Sperry	echo -n	"Making device nodes (may take a while)..."
1461.1Sperry	cd ${DEV}
1471.1Sperry	sh MAKEDEV all
1481.1Sperry	echo	" done."
1491.1Sperry
1501.1Sperry	sync
1511.1Sperry
1521.1Sperry	echo	""
1531.1Sperry	echo	"If you haven't already installed a kernel on the hard drive"
1541.1Sperry	echo	"using your kernel-copy floppy, do so now.  Kernel"
1551.1Sperry	echo 	"installation instructions can be found in the"
1561.1Sperry	echo 	"installation notes."	
1571.1Sperry}
1581.1Sperry
1591.1Sperry# Upgrade cleanup utilities (functions), to make sure a recently-upgraded
1601.1Sperry# system is safely runnable.  These are meant to be invoked from the shell
1611.1Sperry# prompt, by people installing NetBSD.
1621.1Sperry
1631.1SperryCleanup()
1641.1Sperry{
1651.1Sperry	upgrade_dir=/
1661.1Sperry
1671.1Sperry	if [ ! -f /etc/fstab ]; then
1681.1Sperry		upgrade_dir=/mnt
1691.1Sperry	fi
1701.1Sperry
1711.1Sperry	echo	"Cleaning up miscellaneous files in /etc..."
1721.1Sperry	mv $upgrade_dir/etc/rc.bak $upgrade_dir/etc/rc
1731.1Sperry	chroot $upgrade_dir /usr/sbin/pwd_mkdb -p /etc/master.passwd
1741.1Sperry	chroot $upgrade_dir /bin/rm /etc/sendmail.fc > /dev/null 2>&1
1751.1Sperry	sync
1761.1Sperry	echo	"Done."
1771.1Sperry
1781.1Sperry	echo	""
1791.1Sperry	echo	"All that's left to do now is to install a new NetBSD kernel"
1801.1Sperry	echo	"on your hard disk.  You should now halt your machine using"
1811.1Sperry	echo	"the 'halt' command.  Once the machine is halted, replace the"
1821.1Sperry	echo	"installation floppy with the kernel-copy floppy and hit any"
1831.1Sperry	echo	"key to reboot.  Use the kernel-copy floppy to copy a kernel"
1841.1Sperry	echo	"to your hard disk."
1851.1Sperry}
186