Home | History | Annotate | Line # | Download | only in script-installer
dot.instutils revision 1.5
      1  1.5    cgd #	$NetBSD: dot.instutils,v 1.5 1999/06/22 02:21:58 cgd Exp $
      2  1.1  perry #
      3  1.1  perry # Copyright (c) 1994 Christopher G. Demetriou
      4  1.1  perry # All rights reserved.
      5  1.1  perry # 
      6  1.1  perry # Redistribution and use in source and binary forms, with or without
      7  1.1  perry # modification, are permitted provided that the following conditions
      8  1.1  perry # are met:
      9  1.1  perry # 1. Redistributions of source code must retain the above copyright
     10  1.1  perry #    notice, this list of conditions and the following disclaimer.
     11  1.1  perry # 2. Redistributions in binary form must reproduce the above copyright
     12  1.1  perry #    notice, this list of conditions and the following disclaimer in the
     13  1.1  perry #    documentation and/or other materials provided with the distribution.
     14  1.1  perry # 3. All advertising materials mentioning features or use of this software
     15  1.1  perry #    must display the following acknowledgement:
     16  1.1  perry #	This product includes software developed by Christopher G. Demetriou.
     17  1.1  perry # 4. The name of the author may not be used to endorse or promote products
     18  1.1  perry #    derived from this software without specific prior written permission
     19  1.1  perry #
     20  1.1  perry # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     21  1.1  perry # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     22  1.1  perry # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     23  1.1  perry # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     24  1.1  perry # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     25  1.1  perry # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     26  1.1  perry # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     27  1.1  perry # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     28  1.1  perry # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     29  1.1  perry # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     30  1.1  perry #
     31  1.1  perry 
     32  1.1  perry # Installation configuration utilities (functions), to get NetBSD configured
     33  1.1  perry # reasonably once it is installed on the hard disk.  These are meant to be
     34  1.1  perry # invoked from the shell prompt, by people installing NetBSD.
     35  1.1  perry 
     36  1.3  perry config_int()
     37  1.3  perry {
     38  1.3  perry 	local intf resp ifname ifaddr ifflags
     39  1.3  perry 	intf=$1
     40  1.3  perry 	case "$intf" in
     41  1.3  perry 		""|lo*|ppp*|sl*|tun*)
     42  1.3  perry 			return 0;
     43  1.3  perry 			;;
     44  1.3  perry 		*)
     45  1.3  perry 			;;
     46  1.3  perry 	esac
     47  1.3  perry 		
     48  1.3  perry 	echo -n "Configure" $intf "? [y]"
     49  1.3  perry 	read resp
     50  1.3  perry 	case "$resp" in
     51  1.3  perry 	n*|N*)
     52  1.3  perry 		return 0;
     53  1.3  perry 		;;
     54  1.3  perry 	*)
     55  1.3  perry 		;;
     56  1.3  perry 	esac
     57  1.3  perry 
     58  1.3  perry 	echo -n "What is the hostname for this interface? [$hname] "
     59  1.3  perry 	read ifname
     60  1.3  perry 	if [ "$ifname" = "" ]; then
     61  1.3  perry 		ifname=$hname
     62  1.3  perry 	fi
     63  1.3  perry 	ifaddr=
     64  1.3  perry 	while [ "$ifaddr" = "" ]; do
     65  1.3  perry 		echo -n "What is the IP address associated with "
     66  1.3  perry 		echo -n "interface ${intf}? "
     67  1.3  perry 		read ifaddr
     68  1.3  perry 	done
     69  1.3  perry 	echo "$ifaddr	$ifname `echo $ifname | sed -e s/\.$dname//`" \
     70  1.3  perry 	    >> ${ETC}/hosts
     71  1.3  perry 
     72  1.3  perry 	echo -n "Does this interface have a special netmask? [n] "
     73  1.3  perry 	read resp
     74  1.3  perry 	case "$resp" in
     75  1.3  perry 		y*)
     76  1.3  perry 			echo -n "What is the netmask? [0xffffff00] "
     77  1.3  perry 			read ifnetmask
     78  1.3  perry 			if [ "$ifnetmask" = "" ]; then
     79  1.3  perry 				ifnetmask=0xffffff00
     80  1.3  perry 			fi
     81  1.3  perry 			ifnetmask_arg="netmask $ifnetmask"
     82  1.3  perry 			;;
     83  1.3  perry 		*)
     84  1.3  perry 			ifnetmask=
     85  1.3  perry 			ifnetmask_arg=
     86  1.3  perry 			;;
     87  1.3  perry 	esac
     88  1.3  perry 
     89  1.3  perry 	echo -n "Does this interface need a special media type? [n] "
     90  1.3  perry 	read resp
     91  1.3  perry 	case "$resp" in
     92  1.3  perry 		y*)
     93  1.3  perry 			echo -n "What media type? [10baseT/UTP] "
     94  1.3  perry 			read ifflags
     95  1.3  perry 			if [ "$ifflags" = "" ]; then
     96  1.3  perry 				ifflags="10baseT/UTP"
     97  1.3  perry 			fi
     98  1.3  perry 			ifflags_arg="media $ifflags"
     99  1.3  perry 			;;
    100  1.3  perry 		*)
    101  1.3  perry 			ifflags=
    102  1.3  perry 			ifflags_arg=
    103  1.3  perry 			;;
    104  1.3  perry 	esac
    105  1.3  perry 	echo "inet $ifname $ifnetmask_arg $ifflags_arg" > ${ETC}/ifconfig.$intf
    106  1.3  perry }
    107  1.3  perry 
    108  1.3  perry 
    109  1.1  perry Configure()
    110  1.1  perry {
    111  1.1  perry 	DEV=/dev
    112  1.1  perry 	ETC=/etc
    113  1.3  perry 	ROOT=/
    114  1.1  perry 	if [ ! -f /etc/fstab ]; then
    115  1.1  perry 		DEV=/mnt/dev
    116  1.1  perry 		ETC=/mnt/etc
    117  1.3  perry 		ROOT=/mnt
    118  1.1  perry 	fi
    119  1.1  perry 
    120  1.1  perry 	echo	"You will now be prompted for information about this"
    121  1.1  perry 	echo	"machine.  If you hit return, the default answer (in"
    122  1.1  perry 	echo	"brackets) will be used."
    123  1.1  perry 
    124  1.1  perry 	echo	""
    125  1.1  perry 	echo -n	"What is this machine's hostname? [unknown.host.domain] "
    126  1.1  perry 	read hname
    127  1.1  perry 	if [ "$hname" = "" ]; then
    128  1.1  perry 		hname=unknown.host.domain
    129  1.1  perry 	fi
    130  1.1  perry 	echo $hname > ${ETC}/myname
    131  1.1  perry 	proto_domain=`echo $hname | sed -e 's/[^.]*\.//'`
    132  1.1  perry 
    133  1.1  perry 	echo	""
    134  1.5    cgd 	echo	"What DNS domain is this machine in (this is NOT its YP"
    135  1.1  perry 	echo -n	"domain name)? [$proto_domain] "
    136  1.1  perry 	read dname
    137  1.1  perry 	if [ "$dname" = "" ]; then
    138  1.1  perry 		dname=$proto_domain
    139  1.1  perry 	fi
    140  1.1  perry 
    141  1.1  perry 	echo	""
    142  1.1  perry 	if [ -e $ETC/sendmail.cf ]; then
    143  1.1  perry 		echo	"WARNING: A default sendmail.cf exists, and probably"
    144  1.1  perry 		echo	"needs to be tuned and/or replaced, to work properly at"
    145  1.1  perry 		echo	"your site!"
    146  1.1  perry 	else
    147  1.1  perry 		echo	"WARNING: No default sendmail.cf installed.  Did you"
    148  1.1  perry 		echo	"forget to install the 'etc' distribution?"
    149  1.1  perry 	fi
    150  1.1  perry 
    151  1.1  perry 	echo	"127.0.0.1	localhost localhost.$dname" > ${ETC}/hosts
    152  1.1  perry 
    153  1.1  perry 	echo	""
    154  1.3  perry 	echo -n	"Configure network interfaces? [y] "
    155  1.1  perry         read resp
    156  1.1  perry         case "$resp" in
    157  1.1  perry 	n*)
    158  1.1  perry 		;;
    159  1.1  perry 	*)
    160  1.3  perry 		for if in `ifconfig -l`
    161  1.3  perry 		do
    162  1.3  perry 			config_int $if
    163  1.1  perry 		done
    164  1.1  perry 		;;
    165  1.1  perry 	esac
    166  1.3  perry 
    167  1.1  perry 	
    168  1.1  perry 	echo	""
    169  1.1  perry 	echo -n	"Making device nodes (may take a while)..."
    170  1.1  perry 	cd ${DEV}
    171  1.1  perry 	sh MAKEDEV all
    172  1.1  perry 	echo	" done."
    173  1.1  perry 
    174  1.1  perry 	sync
    175  1.1  perry 
    176  1.3  perry 	if [ ! -f ${ROOT}/netbsd ]
    177  1.3  perry 	then
    178  1.3  perry 		echo "You have not unpacked the kernel installation"
    179  1.3  perry 		echo "set. You must do so before you reboot."
    180  1.3  perry 	fi
    181  1.1  perry }
    182  1.1  perry 
    183  1.1  perry # Upgrade cleanup utilities (functions), to make sure a recently-upgraded
    184  1.1  perry # system is safely runnable.  These are meant to be invoked from the shell
    185  1.1  perry # prompt, by people installing NetBSD.
    186  1.1  perry 
    187  1.1  perry Cleanup()
    188  1.1  perry {
    189  1.1  perry 	upgrade_dir=/
    190  1.1  perry 
    191  1.1  perry 	if [ ! -f /etc/fstab ]; then
    192  1.1  perry 		upgrade_dir=/mnt
    193  1.1  perry 	fi
    194  1.1  perry 
    195  1.1  perry 	echo	"Cleaning up miscellaneous files in /etc..."
    196  1.1  perry 	mv $upgrade_dir/etc/rc.bak $upgrade_dir/etc/rc
    197  1.1  perry 	chroot $upgrade_dir /usr/sbin/pwd_mkdb -p /etc/master.passwd
    198  1.1  perry 	chroot $upgrade_dir /bin/rm /etc/sendmail.fc > /dev/null 2>&1
    199  1.1  perry 	sync
    200  1.1  perry 	echo	"Done."
    201  1.1  perry 
    202  1.1  perry 	echo	""
    203  1.1  perry 	echo	"All that's left to do now is to install a new NetBSD kernel"
    204  1.1  perry 	echo	"on your hard disk.  You should now halt your machine using"
    205  1.1  perry 	echo	"the 'halt' command.  Once the machine is halted, replace the"
    206  1.1  perry 	echo	"installation floppy with the kernel-copy floppy and hit any"
    207  1.1  perry 	echo	"key to reboot.  Use the kernel-copy floppy to copy a kernel"
    208  1.1  perry 	echo	"to your hard disk."
    209  1.1  perry }
    210