Subject: misc/1919: merging functionality of netstart, etc, into rc
To: None <gnats-bugs@gnats.netbsd.org>
From: Luke Mewburn <lukem@supp.cpr.itg.telecom.com.au>
List: netbsd-bugs
Date: 01/10/1996 12:38:39
>Number: 1919
>Category: misc
>Synopsis: merging functionality of netstart, etc, into rc
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: misc-bug-people (Misc Bug People)
>State: open
>Class: change-request
>Submitter-Id: lm
>Arrival-Date: Tue Jan 9 21:05:02 1996
>Last-Modified:
>Originator: Luke Mewburn
>Organization:
Werj
>Release: NetBSD-960106
>Environment:
>Description:
A couple of weeks ago there was a discussion on /etc/rc vs
/etc/rc.?d/*, amongst other things
At that time I suggested that whatever decision is made, the
concept of having /etc/rc source /etc/rc.conf for information,
rather than using
/etc/{hostname.*,netstart,myname,mygate,defaultdomain,ifaliases}
I got a lot of positive replies on this, so here's the
changes.
>How-To-Repeat:
Look at
/etc/{rc,hostname.*,netstart,myname,mygate,defaultdomain,ifaliases}
Decide that it's a crock.
>Fix:
Apply this diff, rename rc.conf.eg to rc.conf, edit
appropriately, and reboot.
After the changes, the following files are superfluous and can
be removed from the src tree and /etc:
ifaliases
myname
mygate
defaultdomain
hostname.*
netstart
I've tested this fairly well, including the interface alias code.
The only thing I haven't tested is the 'destination_addr'
change, but it's trivial, and you can see from observation
that it should work.
*** /dev/null Wed Jan 10 12:24:54 1996
--- rc.conf.eg Wed Jan 10 12:12:58 1996
***************
*** 0 ****
--- 1,54 ----
+ #
+ # Host specific configuration information
+ #
+ # $NetBSD$
+ #
+
+ # primary hostname
+ #
+ hostname=myname
+
+ # domainname for DNS and NIS
+ #
+ domainname=my.domain
+
+ # interfaces
+ # for each WORD in $interfaces, set the following variables:
+ # - interface_WORD addr_family hostaddr [netmask [broadcast [options]]]
+ # - destination_WORD [dest_addr]
+ # - ifaliases_WORD [alias_addr [alias_addr ...]]
+ #
+ interfaces="ed0 le0"
+ interface_ed0="inet 192.168.1.2"
+ interface_le0="inet 192.168.1.3"
+
+ # default route. don't define if you don't want it
+ #
+ defaultroute=192.168.1.1
+
+ # 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=""
+ timed_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
Index: rc
===================================================================
RCS file: /z/cvsroot/src/etc/rc,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -c -r1.1.1.1 -r1.2
*** rc 1996/01/06 09:34:37 1.1.1.1
--- rc 1996/01/10 01:24:55 1.2
***************
*** 17,22 ****
--- 17,25 ----
PATH=/sbin:/bin:/usr/sbin:/usr/bin
export PATH
+ # Read in host-specific stuff from one file
+ . /etc/rc.conf
+
# Configure ccd devices.
if [ -f /etc/ccd.conf ]
then
***************
*** 69,81 ****
mount -a -t nonfs
rm -f /fastboot # XXX (root now writeable)
! # set flags on ttys. (do early, in case they use tty for SLIP in netstart)
echo 'setting tty flags'
ttyflags -a
# set hostname, turn on network
echo 'starting network'
! . /etc/netstart
mount /usr >/dev/null 2>&1
mount /var >/dev/null 2>&1
--- 72,154 ----
mount -a -t nonfs
rm -f /fastboot # XXX (root now writeable)
! # set flags on ttys. (do early, in case they use tty for SLIP)
echo 'setting tty flags'
ttyflags -a
# set hostname, turn on network
echo 'starting network'
!
! # $hostname is imported from /etc/rc.conf;
! if [ "X${hostname}" != "X" ]; then
! hostname ${hostname}
! fi
!
! # $domainname is imported from /etc/rc.conf;
! if [ "X${domainname}" != "X" ]; then
! domainname ${domainname}
! fi
!
! # configure all of the interfaces which we know about.
! # do this by running for each WORD in $interfaces, and extracting
! # the following variables, which are imported from /etc/rc.conf:
! # - interface_WORD addr_family hostaddr [netmask [broadcast [options]]]
! # - destination_WORD [dest_addr]
! # - ifaliases_WORD [alias_addr [alias_addr ...]]
! #
! # addr_family: address family of the interface, generally inet
! # hostaddr: host addr that belongs to the interface, in /etc/hosts.
! # netmask: network mask for the interface.
! # broadcast: broadcast address for the interface
! # options: misc. options to ifconfig for the interface.
! # dest_addr: if the interface has a "destination" (i.e. it's a
! # point-to-point link, like SLIP), this is the address
! # of the other end of the link, in /etc/hosts
! # alias_addr: interface aliases, in /etc/hosts.
!
! for iface in ${interfaces} ; do
! eval `echo 'args=$interface_'$iface`
! if [ "X$args" = "X" ] ; then continue; fi
! set -- $args
! af=$1 ; name=$2 ; mask=$3 ; bcaddr=$4 ; extras=$5
! if [ ! -n "$name" ]; then
! echo "\$interface_$iface: invalid network configuration"
! continue
! fi
!
! cmd="ifconfig $iface $af $name"
! eval `echo 'dest=$destination_'$iface`
! if [ "X$dest" != "X" ] ; then cmd="$cmd $dest"; fi
! if [ -n "$mask" ]; then cmd="$cmd netmask $mask"; fi
! if [ -n "$bcaddr" -a "X$bcaddr" != "XNONE" ]; then
! cmd="$cmd broadcast $bcaddr"
! fi
! cmd="$cmd $extras"
!
! $cmd
! done
!
! # set the address for the loopback interface
! ifconfig lo0 inet localhost
!
! # use loopback, not the wire
! route add $hostname localhost
!
! # $defaultroute is imported from /etc/rc.conf;
! if [ "X${defaultroute}" != "X" ]; then
! route add default ${defaultroute}
! fi
!
! # setup any interface aliases, as described above
! for iface in ${interfaces} ; do
! eval `echo 'aliases=$ifaliases_'$iface`
! set -- $aliases
! while [ $# -ge 1 ] ; do
! ifconfig $iface inet alias $1
! route add $1 localhost
! shift
! done
! done
mount /usr >/dev/null 2>&1
mount /var >/dev/null 2>&1
***************
*** 93,99 ****
echo -n ' ypbind'; ypbind
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
--- 166,172 ----
echo -n ' ypbind'; ypbind
fi
! # $nfs_server is imported from /etc/rc.conf;
# 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
***************
*** 102,108 ****
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
--- 175,181 ----
echo -n ' nfsd'; nfsd -tun 4
fi
! # $nfs_client is imported from /etc/rc.conf;
# 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
***************
*** 121,127 ****
rm -f /dev/log
syslogd
! # $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
--- 194,200 ----
rm -f /dev/log
syslogd
! # $timed_flags is imported from /etc/rc.conf;
# if $timed_flags == NO, timed isn't run.
if [ "X${timed_flags}" != X"NO" ]; then
echo -n ', time daemon'; timed $timed_flags
***************
*** 181,187 ****
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
--- 254,260 ----
echo -n starting network daemons:
! # $gated and $routed_flags are imported from /etc/rc.conf.
# 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
***************
*** 190,208 ****
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
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
fi
! # $rwhod is imported from /etc/netstart;
# if $rwhod == YES, rwhod is run.
if [ X${rwhod} = X"YES" ]; then
echo -n ' rwhod'; rwhod
--- 263,281 ----
echo -n ' routed'; routed $routed_flags
fi
! # $mrouted_flags is imported from /etc/rc.conf;
! # If $mrouted_flags != NO, then mrouted is run.
if [ "X${mrouted_flags}" != X"NO" ]; then
echo -n ' mrouted'; mrouted $mrouted_flags
fi
! # $name_flags is imported from /etc/rc.conf;
# if $named_flags != NO, named is run.
if [ "X${named_flags}" != X"NO" ]; then
echo -n ' named'; named $named_flags
fi
! # $rwhod is imported from /etc/rc.conf;
# if $rwhod == YES, rwhod is run.
if [ X${rwhod} = X"YES" ]; then
echo -n ' rwhod'; rwhod
***************
*** 210,216 ****
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.
if [ "X${sendmail_flags}" != X"NO" -a -r /etc/sendmail.cf ]; then
--- 283,289 ----
echo -n ' printer'; lpd
! # $sendmail_flags is imported from /etc/rc.conf;
# If $sendmail_flags == NO or /etc/sendmail.cf doesn't exist, then
# sendmail isn't run.
if [ "X${sendmail_flags}" != X"NO" -a -r /etc/sendmail.cf ]; then
***************
*** 219,239 ****
echo -n ' inetd'; inetd
! # $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}
fi
! # $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
! # $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
--- 292,312 ----
echo -n ' inetd'; inetd
! # $rarpd_flags is imported from /etc/rc.conf;
# 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}
fi
! # $bootparamd_flags is imported from /etc/rc.conf;
# 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
! # $rbootd_flags is imported from /etc/rc.conf;
# 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
>Audit-Trail:
>Unformatted: