diff --git a/etc/netstart b/etc/netstart index 0c3f3da69a7e..0c558b44625d 100644 --- a/etc/netstart +++ b/etc/netstart @@ -1,45 +1,8 @@ #!/bin/sh - # -# $NetBSD: netstart,v 1.26 1996/12/04 12:55:34 mrg Exp $ +# $NetBSD: netstart,v 1.27 1997/01/05 12:01:54 mrg Exp $ # @(#)netstart 5.9 (Berkeley) 3/30/91 -# set these to "NO" to turn them off. otherwise, they're used as flags -routed_flags=-q -mrouted_flags=NO # for 'normal' use: mrouted_flags="" -rarpd_flags=NO # for 'normal' use: rarpd_flags="-a" -bootparamd_flags=NO # for 'normal' use: bootparamd_flags="" -rbootd_flags=NO # for 'normal' use: rbootd_flags="" -sendmail_flags=NO # for 'normal' use: sendmail_flags="-bd -q30m" -named_flags=NO # for 'normal' use: named_flags="" -dhcpd_flags=NO # for 'normal' use: dhcpd_flags="" -timed_flags= -inetd_flags= # for libwrap logging, use: inetd_flags=-l - -# If your system is to be a YP server, you need to enable ypserv -# and (optionally) rpc.yppasswdd. Set these variables to "NO" -# to turn them off, otherwise they're used as flags. -ypserv_flags=NO # for 'normal' use: ypserv_flags="-d" -yppasswdd_flags=NO # for 'normal' use: yppasswdd_flags="" - -# If your system is to be a YP client, you need to enable ypbind. -# Set these variables to "NO" to turn them off, otherwise they're -# used as flags. -ypbind_flags=NO # for 'normal' use: ypbind_flags="" - -# set the following to "YES" to turn them on -rwhod=NO -nfs_server=NO -nfs_client=NO -gated=NO -kerberos_server=NO -amd=NO - -# miscellaneous other flags -# only used if the appropriate server is marked YES above -gated_flags= -amd_dir=/amd # AMD's mount directory -amd_master=/etc/amd/master # AMD 'master' map - # /etc/myname contains my symbolic name # hostname=`cat /etc/myname` @@ -48,6 +11,12 @@ if [ -f /etc/defaultdomain ]; then domainname `cat /etc/defaultdomain` fi +# install and enable packet filter rules before configuring interfaces. +if [ "X$ipfilter" != XNO -a -f /etc/ipf.conf ]; then + echo 'installing packet filter rules ... ' + ipf -f /etc/ipf.conf -E +fi + # configure all of the interfaces which we know about. # do this by reading /etc/hostname.* files, where * is the name # of a given interface. @@ -118,15 +87,20 @@ fi # /etc/ifaliases, if it exists, contains the names of additional IP # addresses for each interface. It is formatted as a series of lines # that contain -# address interface +# address interface netmask if [ -f /etc/ifaliases ]; then ( - set -- `cat /etc/ifaliases` - - while [ $# -ge 2 ] ; do - ifconfig $2 inet alias $1 - route add $1 localhost - shift 2 - done - ) + while read addr int net; do + if [ x"$net" = x ]; then + ifconfig $int inet alias $addr + else + ifconfig $int inet alias $addr netmask $net + fi + route add $addr localhost + done +) < /etc/ifaliases +fi + +if [ -s /etc/netstart.local ]; then + . /etc/netstart.local fi diff --git a/etc/rc b/etc/rc index 980ff1d01f04..b74d055b0f7f 100644 --- a/etc/rc +++ b/etc/rc @@ -1,4 +1,4 @@ -# $NetBSD: rc,v 1.62 1996/12/04 12:55:33 mrg Exp $ +# $NetBSD: rc,v 1.63 1997/01/05 12:01:55 mrg Exp $ # from: @(#)rc 8.2 (Berkeley) 3/17/94 # System startup script run by init on autoboot @@ -18,16 +18,13 @@ PATH=/sbin:/bin:/usr/sbin:/usr/bin export PATH # Configure ccd devices. -if [ -f /etc/ccd.conf ] -then +if [ -f /etc/ccd.conf ]; then ccdconfig -C fi -if [ -e /fastboot ] -then +if [ -e /fastboot ]; then echo "Fast boot: skipping disk checks." -elif [ $1x = autobootx ] -then +elif [ $1x = autobootx ]; then echo "Automatic boot in progress: starting file system checks." fsck -p case $? in @@ -69,10 +66,19 @@ umount -a >/dev/null 2>&1 mount -a -t nonfs rm -f /fastboot # XXX (root now writeable) +if [ -s /etc/rc.conf ]; then + . /etc/rc.conf +fi + # set flags on ttys. (do early, in case they use tty for SLIP in netstart) echo 'setting tty flags' ttyflags -a +# load any kernel modules specified in /etc/lkm.conf +if [ X"$lkm_init" != XNO -a -f /etc/rc.lkm ]; then + . /etc/rc.lkm +fi + # set hostname, turn on network echo 'starting network' . /etc/netstart @@ -86,22 +92,82 @@ rm -f /var/spool/lock/LCK.* rm -f /var/spool/uucp/STST/* (cd /var/run && { rm -rf -- *; install -c -m 664 -g utmp /dev/null utmp; }) -echo -n 'starting system logger' -rm -f /dev/log -syslogd +# start the system logger first, so that all messages +# from daemons are logged, and the name server next. -# $timed_flags is imported from /etc/netstart; -# if $timed_flags == NO, timed isn't run. -if [ "X${timed_flags}" != X"NO" ]; then - echo -n ', time daemon'; timed $timed_flags +if [ "X$syslogd_flags" != XNO ]; then + echo 'starting system logger' + rm -f /dev/log + syslogd $syslogd_flags fi + +if [ "X$named_flags" != XNO ]; then + echo 'starting name server'; named $named_flags +fi + +# now start the rpc servers, for YP server/client, NFS. +echo -n 'starting rpc daemons:' + +# note that portmap is generally required for all other rpc services. +if [ "X$portmap" != XNO ]; then + echo -n ' portmap'; portmap +fi + +if [ "X$ypserv_flags" != XNO ]; then + echo -n ' ypserv'; ypserv $ypserv_flags +fi + +if [ "X$ypbind_flags" != XNO ]; then + echo -n ' ypbind'; ypbind $ypbind_flags +fi + +if [ "X$yppasswdd_flags" != XNO ]; then + echo -n ' rpc.yppasswdd'; rpc.yppasswdd $yppasswdd_flags +fi + +if [ "X$bootparamd_flags" != XNO -a -r /etc/bootparams ]; then + echo -n ' rpc.bootparamd'; rpc.bootparamd $bootparamd_flags +fi + +if [ "X$nfs_server" = XYES -a -r /etc/exports ]; then + if [ "X$nfsd_flags" = X ]; then + nfsd_flags="-tun 4" + fi + rm -f /var/db/mountdtab + echo -n > /var/db/mountdtab + echo -n ' mountd'; mountd $mountd_flags + echo -n ' nfsd'; nfsd $nfsd_flags +fi + +if [ "X$nfs_client" = XYES ]; then + if [ "X$nfsiod_flags" = X ]; then + nfsiod_flags="-n 4" + fi + echo -n ' nfsiod'; nfsiod $nfsiod_flags +fi + +if [ "X$amd" = XYES -a -d "$amd_dir" -a -r "$amd_master" ]; then + echo -n ' amd' + amd $amd_flags -p -a $amd_dir `cat $amd_master` > /var/run/amd.pid +fi + echo '.' +mount -a -t nfs + +if [ -f /sbin/ldconfig ]; then + echo 'creating runtime link editor directory cache.' + if [ -s /etc/ld.so.conf ]; then + ldconfig `cat /etc/ld.so.conf` + else + ldconfig + fi +fi # /var/crash should be a directory or a symbolic link # to the crash directory if core dumps are to be saved. -if [ -d /var/crash ]; then +if [ X"savecore_flags" != XNO -a -d /var/crash ]; then echo checking for core dump... - savecore /var/crash + savecore $savecore_flags /var/crash fi echo -n 'checking quotas:' @@ -148,120 +214,58 @@ echo -n ' update'; update echo -n ' cron'; cron echo '.' +# now start all the other daemons echo -n starting network daemons: -# $gated and $routed_flags are imported from /etc/netstart. -# If $gated == YES, gated is used; otherwise routed. -# If $routed_flags == NO, routed isn't run. -if [ X${gated} = X"YES" -a -r /etc/gated.conf ]; then +if [ X$gated_flags != XNO -a -r /etc/gated.conf ]; then echo -n ' gated'; gated $gated_flags -elif [ "X${routed_flags}" != X"NO" ]; then +elif [ "X$routed_flags" != XNO ]; then echo -n ' routed'; routed $routed_flags fi -# $mrouted_flags is imported from /etc/netstart; -# If $mrouted_flags == NO, then mrouted isn't run. -if [ "X${mrouted_flags}" != X"NO" ]; then +if [ "X$mrouted_flags" != XNO ]; then echo -n ' mrouted'; mrouted $mrouted_flags fi -# $named_flags is imported from /etc/netstart; -# if $named_flags != NO, named is run. -if [ "X${named_flags}" != X"NO" ]; then - echo -n ' named'; named $named_flags +if [ "X$timed_flags" != XNO ]; then + echo -n ' time daemon'; timed $timed_flags fi -# $dhcpd_flags is imported from /etc/netstart; -# if $dhcpd_flags != NO, dhcpd is run. -if [ "X${dhcpd_flags}" != X"NO" -a -r /etc/dhcpd.conf ]; then +if [ "X$xntpd_flags" != XNO ]; then + echo -n ' ntp daemon'; xntpd $xntpd_flags +fi + +if [ "X$dhcpd_flags" != XNO -a -r /etc/dhcpd.conf ]; then echo -n ' dhcpd'; dhcpd $dhcpd_flags fi -# $rwhod is imported from /etc/netstart; -# if $rwhod == YES, rwhod is run. -if [ X${rwhod} = X"YES" ]; then +if [ X$rwhod = XYES ]; then echo -n ' rwhod'; rwhod fi -echo -n ' printer'; lpd - -# $sendmail_flags is imported from /etc/netstart; -# If $sendmail_flags == NO or /etc/sendmail.cf doesn't exist, then -# sendmail isn't run. We call sendmail with a full path so that -# SIGHUP works. -if [ "X${sendmail_flags}" != X"NO" -a -r /etc/sendmail.cf ]; then - echo -n ' sendmail'; /usr/sbin/sendmail ${sendmail_flags} +if [ "X$lpd_flags" != XNO ]; then + echo -n ' printer'; lpd $lpd_flags fi -# $inetd_flags is imported from /etc/netstart; -# If $inetd_flags == NO or /etc/inetd.conf doesn't exist, then -# inetd isn't run. -if [ "X${inetd_flags}" != X"NO" -a -r /etc/inetd.conf ]; then - echo -n ' inetd'; inetd ${inetd_flags} +# We call sendmail with a full path so that SIGHUP works. +if [ "X$sendmail_flags" != XNO -a -r /etc/sendmail.cf ]; then + echo -n ' sendmail'; /usr/sbin/sendmail $sendmail_flags fi -# $rarpd_flags is imported from /etc/netstart; -# If $rarpd_flags == NO or /etc/ethers doesn't exist, then -# rarpd isn't run. -if [ "X${rarpd_flags}" != X"NO" -a -r /etc/ethers ]; then - echo -n ' rarpd'; rarpd ${rarpd_flags} +if [ "X$rarpd_flags" != XNO -a -r /etc/ethers ]; then + echo -n ' rarpd'; rarpd $rarpd_flags fi -# $rbootd_flags is imported from /etc/netstart; -# If $rbootd_flags == NO or /etc/rbootd.conf doesn't exist, then -# rbootd isn't run. -if [ "X${rbootd_flags}" != X"NO" -a -r /etc/rbootd.conf ]; then - echo -n ' rbootd'; rbootd ${rbootd_flags} +if [ "X$rbootd_flags" != XNO -a -r /etc/rbootd.conf ]; then + echo -n ' rbootd'; rbootd $rbootd_flags +fi + +if [ "X$inetd_flags" != XNO -a -r /etc/inetd.conf ]; then + echo -n ' inetd'; inetd $inetd_flags fi echo '.' -echo -n 'starting rpc daemons:' -echo -n ' portmap'; portmap - -# $bootparamd_flags is imported from /etc/netstart; -# If $bootparamd_flags == NO or /etc/bootparams doesn't exist, then -# bootparamd isn't run. -if [ "X${bootparamd_flags}" != X"NO" -a -r /etc/bootparams ]; then - echo -n ' rpc.bootparamd'; rpc.bootparamd ${bootparamd_flags} -fi - -if [ "X${ypserv_flags}" != X"NO" ]; then - echo -n ' ypserv'; ypserv ${ypserv_flags} -fi - -if [ "X${yppasswdd_flags}" != X"NO" ]; then - echo -n ' rpc.yppasswdd'; rpc.yppasswdd ${yppasswdd_flags} -fi - -if [ "X${ypbind_flags}" != X"NO" ]; then - echo -n ' ypbind'; ypbind ${ypbind_flags} -fi - -# $nfs_server is imported from /etc/netstart; -# if $nfs_server == YES, the machine is setup for being an nfs server -if [ X${nfs_server} = X"YES" -a -r /etc/exports ]; then - rm -f /var/db/mountdtab - echo -n > /var/db/mountdtab - echo -n ' mountd'; mountd - echo -n ' nfsd'; nfsd -tun 4 -fi - -# $nfs_client is imported from /etc/netstart; -# if $nfs_client == YES, the machine is setup for being an nfs client -if [ X${nfs_client} = X"YES" ]; then - echo -n ' nfsiod'; nfsiod -n 4 -fi - -if [ X${amd} = X"YES" -a -d ${amd_dir} -a -r ${amd_master} ]; then - echo -n ' amd' - amd -l syslog -x error,noinfo,nostats -p \ - -a ${amd_dir} `cat ${amd_master}` > /var/run/amd.pid -fi - -echo '.' -mount -a -t nfs - . /etc/rc.local date diff --git a/etc/rc.conf b/etc/rc.conf new file mode 100644 index 000000000000..d16b1a9ddba0 --- /dev/null +++ b/etc/rc.conf @@ -0,0 +1,41 @@ +# $NetBSD: rc.conf,v 1.1 1997/01/05 12:01:56 mrg Exp $ +# +# see rc.conf(5) for more information. + +# uncomment this if you want to use local paths in rc +#export PATH=$PATH:/usr/local/sbin:/usr/local/bin + +# set these to "NO" to turn them off. otherwise, they're used as flags +ipfilter=NO # YES or NO. +lkm_init=YES # YES or NO. +syslogd_flags="" # for 'normal' use: syslogd_flags="" +named_flags=NO # for 'normal' use: named_flags="" +portmap=YES # YES or NO; normally required. +ypserv_flags=NO # for 'normal' use: ypserv_flags="-d" +ypbind_flags=NO # for 'normal' use: ypbind_flags="" +yppasswdd_flags=NO # for 'normal' use: yppasswdd_flags="" +bootparamd_flags=NO # for 'normal' use: bootparamd_flags="" +nfs_server=NO # YES or NO. +nfsd_flags="" # for 'normal' use: nfsd_flags="-tun 4" +mountd_flags="" # for 'normal' use: mountd_flags="" +nfs_client=NO # YES or NO. +nfsiod_flags="" # for 'normal use: nfsiod_flags="-n 4" +amd=NO # YES or NO. +amd_flags="" # for 'normal use: amd_flags="-l syslog -x error,noinfo,nostats" +amd_dir=/amd # AMD's mount directory +amd_master=/etc/amd/master # AMD 'master' map +timed_flags=NO # for 'normal' use: timed_flags="" +xntpd_flags=NO # for 'normal' use: xntpd_flags="" +savecore_flags="" # for 'normal' use: savecore_flags="" +gated=NO # YES or NO. +gated_flags=NO # note: gated is not distributed with NetBSD. +routed_flags=-q # for 'normal' use: routed_flags="-q" +mrouted_flags=NO # for 'normal' use: mrouted_flags="" +dhcpd_flags=NO # for 'normal' use: dhcpd_flags="" +rwhod=NO # YES or NO. +lpd_flags="" # for 'normal use: lpd_flags="" +sendmail_flags=NO # for 'normal' use: sendmail_flags="-bd -q30m" +rarpd_flags=NO # for 'normal' use: rarpd_flags="-a" +rbootd_flags=NO # for 'normal' use: rbootd_flags="" +inetd_flags="" # for libwrap logging, use: inetd_flags=-l +kerberos_server=NO diff --git a/etc/rc.local b/etc/rc.local index f5b4f9c3a481..d29e3c6425ca 100644 --- a/etc/rc.local +++ b/etc/rc.local @@ -1,4 +1,4 @@ -# $NetBSD: rc.local,v 1.14 1995/12/17 02:01:13 thorpej Exp $ +# $NetBSD: rc.local,v 1.15 1997/01/05 12:01:57 mrg Exp $ # # site-specific startup actions, daemons # @@ -16,11 +16,6 @@ sed '1,/^$/d' < /etc/motd >> $T cmp -s $T /etc/motd || cp $T /etc/motd rm -f $T -if [ -f /sbin/ldconfig ]; then - echo 'creating runtime link editor directory cache.' - ldconfig -fi - echo -n 'starting local daemons:' # Kerberos runs ONLY on the Kerberos server machine