dot.instutils revision 1.3
11.3Sperry# $NetBSD: dot.instutils,v 1.3 1997/08/15 23:03:57 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.3Sperryconfig_int() 371.3Sperry{ 381.3Sperry local intf resp ifname ifaddr ifflags 391.3Sperry intf=$1 401.3Sperry case "$intf" in 411.3Sperry ""|lo*|ppp*|sl*|tun*) 421.3Sperry return 0; 431.3Sperry ;; 441.3Sperry *) 451.3Sperry ;; 461.3Sperry esac 471.3Sperry 481.3Sperry echo -n "Configure" $intf "? [y]" 491.3Sperry read resp 501.3Sperry case "$resp" in 511.3Sperry n*|N*) 521.3Sperry return 0; 531.3Sperry ;; 541.3Sperry *) 551.3Sperry ;; 561.3Sperry esac 571.3Sperry 581.3Sperry echo -n "What is the hostname for this interface? [$hname] " 591.3Sperry read ifname 601.3Sperry if [ "$ifname" = "" ]; then 611.3Sperry ifname=$hname 621.3Sperry fi 631.3Sperry ifaddr= 641.3Sperry while [ "$ifaddr" = "" ]; do 651.3Sperry echo -n "What is the IP address associated with " 661.3Sperry echo -n "interface ${intf}? " 671.3Sperry read ifaddr 681.3Sperry done 691.3Sperry echo "$ifaddr $ifname `echo $ifname | sed -e s/\.$dname//`" \ 701.3Sperry >> ${ETC}/hosts 711.3Sperry 721.3Sperry echo -n "Does this interface have a special netmask? [n] " 731.3Sperry read resp 741.3Sperry case "$resp" in 751.3Sperry y*) 761.3Sperry echo -n "What is the netmask? [0xffffff00] " 771.3Sperry read ifnetmask 781.3Sperry if [ "$ifnetmask" = "" ]; then 791.3Sperry ifnetmask=0xffffff00 801.3Sperry fi 811.3Sperry ifnetmask_arg="netmask $ifnetmask" 821.3Sperry ;; 831.3Sperry *) 841.3Sperry ifnetmask= 851.3Sperry ifnetmask_arg= 861.3Sperry ;; 871.3Sperry esac 881.3Sperry 891.3Sperry echo -n "Does this interface need a special media type? [n] " 901.3Sperry read resp 911.3Sperry case "$resp" in 921.3Sperry y*) 931.3Sperry echo -n "What media type? [10baseT/UTP] " 941.3Sperry read ifflags 951.3Sperry if [ "$ifflags" = "" ]; then 961.3Sperry ifflags="10baseT/UTP" 971.3Sperry fi 981.3Sperry ifflags_arg="media $ifflags" 991.3Sperry ;; 1001.3Sperry *) 1011.3Sperry ifflags= 1021.3Sperry ifflags_arg= 1031.3Sperry ;; 1041.3Sperry esac 1051.3Sperry echo "inet $ifname $ifnetmask_arg $ifflags_arg" > ${ETC}/ifconfig.$intf 1061.3Sperry} 1071.3Sperry 1081.3Sperry 1091.1SperryConfigure() 1101.1Sperry{ 1111.1Sperry DEV=/dev 1121.1Sperry ETC=/etc 1131.3Sperry ROOT=/ 1141.1Sperry if [ ! -f /etc/fstab ]; then 1151.1Sperry DEV=/mnt/dev 1161.1Sperry ETC=/mnt/etc 1171.3Sperry ROOT=/mnt 1181.1Sperry fi 1191.1Sperry 1201.1Sperry echo "You will now be prompted for information about this" 1211.1Sperry echo "machine. If you hit return, the default answer (in" 1221.1Sperry echo "brackets) will be used." 1231.1Sperry 1241.1Sperry echo "" 1251.1Sperry echo -n "What is this machine's hostname? [unknown.host.domain] " 1261.1Sperry read hname 1271.1Sperry if [ "$hname" = "" ]; then 1281.1Sperry hname=unknown.host.domain 1291.1Sperry fi 1301.1Sperry echo $hname > ${ETC}/myname 1311.1Sperry proto_domain=`echo $hname | sed -e 's/[^.]*\.//'` 1321.1Sperry 1331.1Sperry echo "" 1341.1Sperry echo "What domain is this machine in (this is NOT its YP" 1351.1Sperry echo -n "domain name)? [$proto_domain] " 1361.1Sperry read dname 1371.1Sperry if [ "$dname" = "" ]; then 1381.1Sperry dname=$proto_domain 1391.1Sperry fi 1401.1Sperry 1411.1Sperry echo "" 1421.1Sperry if [ -e $ETC/sendmail.cf ]; then 1431.1Sperry echo "WARNING: A default sendmail.cf exists, and probably" 1441.1Sperry echo "needs to be tuned and/or replaced, to work properly at" 1451.1Sperry echo "your site!" 1461.1Sperry else 1471.1Sperry echo "WARNING: No default sendmail.cf installed. Did you" 1481.1Sperry echo "forget to install the 'etc' distribution?" 1491.1Sperry fi 1501.1Sperry 1511.1Sperry echo "127.0.0.1 localhost localhost.$dname" > ${ETC}/hosts 1521.1Sperry 1531.1Sperry echo "" 1541.3Sperry echo -n "Configure network interfaces? [y] " 1551.1Sperry read resp 1561.1Sperry case "$resp" in 1571.1Sperry n*) 1581.1Sperry ;; 1591.1Sperry *) 1601.3Sperry for if in `ifconfig -l` 1611.3Sperry do 1621.3Sperry config_int $if 1631.1Sperry done 1641.1Sperry ;; 1651.1Sperry esac 1661.3Sperry 1671.1Sperry 1681.1Sperry echo "" 1691.1Sperry echo -n "Making device nodes (may take a while)..." 1701.1Sperry cd ${DEV} 1711.1Sperry sh MAKEDEV all 1721.1Sperry echo " done." 1731.1Sperry 1741.1Sperry sync 1751.1Sperry 1761.3Sperry if [ ! -f ${ROOT}/netbsd ] 1771.3Sperry then 1781.3Sperry echo "You have not unpacked the kernel installation" 1791.3Sperry echo "set. You must do so before you reboot." 1801.3Sperry fi 1811.1Sperry} 1821.1Sperry 1831.1Sperry# Upgrade cleanup utilities (functions), to make sure a recently-upgraded 1841.1Sperry# system is safely runnable. These are meant to be invoked from the shell 1851.1Sperry# prompt, by people installing NetBSD. 1861.1Sperry 1871.1SperryCleanup() 1881.1Sperry{ 1891.1Sperry upgrade_dir=/ 1901.1Sperry 1911.1Sperry if [ ! -f /etc/fstab ]; then 1921.1Sperry upgrade_dir=/mnt 1931.1Sperry fi 1941.1Sperry 1951.1Sperry echo "Cleaning up miscellaneous files in /etc..." 1961.1Sperry mv $upgrade_dir/etc/rc.bak $upgrade_dir/etc/rc 1971.1Sperry chroot $upgrade_dir /usr/sbin/pwd_mkdb -p /etc/master.passwd 1981.1Sperry chroot $upgrade_dir /bin/rm /etc/sendmail.fc > /dev/null 2>&1 1991.1Sperry sync 2001.1Sperry echo "Done." 2011.1Sperry 2021.1Sperry echo "" 2031.1Sperry echo "All that's left to do now is to install a new NetBSD kernel" 2041.1Sperry echo "on your hard disk. You should now halt your machine using" 2051.1Sperry echo "the 'halt' command. Once the machine is halted, replace the" 2061.1Sperry echo "installation floppy with the kernel-copy floppy and hit any" 2071.1Sperry echo "key to reboot. Use the kernel-copy floppy to copy a kernel" 2081.1Sperry echo "to your hard disk." 2091.1Sperry} 210