[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

diffs for /etc/rc family of scripts



Purhaps I'm anal, but I've redone the system scripts a little to make them
consistant. It bugs me when they aren't. I've made some other minor changes
like changing tests for -f to -r instead. Makes more sense to me. Tests for -x
in rc.local were removed cause no where else do we make these checks, instead
the logic relies on the YES/NO flag from rc.conf.

FWIW...

--- rc  Fri Feb 20 13:27:28 1998
+++ /etc/rc     Mon Mar  2 09:58:07 1998
@@ -89,7 +89,7 @@
 
 # $named_flags is imported from /etc/rc.conf;
 # if $named_flags != NO, named is run.
-if [ "X${named_flags}" != X"NO" ]; then
+if [ X"${named_flags}" != X"NO" ]; then
        echo 'starting named';          named $named_flags
 fi
 
@@ -116,7 +116,7 @@
 # $photurisd_flags is imported from /etc/rc.conf;
 # If $photurisd_flags == NO or /etc/photuris/photuris.conf doesn't exist, then
 # photurisd isn't run.
-if [ "X${photurisd_flags}" != X"NO" -a -e /etc/photuris/photuris.conf ]; then
+if [ X"${photurisd_flags}" != X"NO" -a -r /etc/photuris/photuris.conf ]; then
        echo 'starting photurisd';      photurisd ${photurisd_flags}
 fi
 
@@ -159,24 +159,24 @@
 
 # $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 -a \
+if [ X"${nfs_server}" = X"YES" -a -r /etc/exports -a \
     `cat /etc/exports | sed -e '/^#/d' | wc -l` -ne 0 ]; then
        rm -f /var/db/mountdtab 
        echo -n > /var/db/mountdtab
        echo -n ' mountd';              mountd
        echo -n ' nfsd';                nfsd ${nfsd_flags}
-       if [ X${lockd} = X"YES" ]; then
+       if [ X"${lockd}" = X"YES" ]; then
                echo -n ' rpc.lockd';   rpc.lockd
        fi
 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
+if [ X"${nfs_client}" = X"YES" ]; then
        echo -n ' nfsiod';              nfsiod ${nfsiod_flags}
 fi
 
-if [ X${amd} = X"YES" -a -d ${amd_dir} -a -r ${amd_master} ]; then
+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
@@ -184,7 +184,7 @@
 
 # $timed_flags is imported from /etc/rc.conf;
 # if $timed_flags == NO, timed isn't run.
-if [ "X${timed_flags}" != X"NO" ]; then
+if [ X"${timed_flags}" != X"NO" ]; then
        echo -n ' timed'; timed $timed_flags
 fi
 echo '.'
@@ -198,7 +198,7 @@
        savecore /var/crash
 fi
 
-if [ "X${check_quotas}" = X"YES" ]; then
+if [ X"${check_quotas}" = X"YES" ]; then
        echo -n 'checking quotas:'
        quotacheck -a
        echo ' done.'
@@ -238,7 +238,7 @@
 fi
 
 test -f /etc/rc.securelevel && . /etc/rc.securelevel
-if [ X${securelevel} != X"" ]; then
+if [ X"${securelevel}" != X"" ]; then
        echo -n 'setting kernel security level: '
        sysctl -w kern.securelevel=${securelevel}
 fi
@@ -303,26 +303,26 @@
 # $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
+if [ X"${gated}" = X"YES" -a -r /etc/gated.conf ]; then
        echo -n ' gated';               gated $gated_flags
-elif [ "X${routed_flags}" != X"NO" ]; then
+elif [ X"${routed_flags}" != X"NO" ]; then
        echo -n ' routed';              routed $routed_flags
 fi
 
 # $mrouted_flags is imported from /etc/rc.conf;
 # If $mrouted_flags == NO, then mrouted isn't run.
-if [ "X${mrouted_flags}" != X"NO" ]; then
+if [ X"${mrouted_flags}" != X"NO" ]; then
        echo -n ' mrouted';             mrouted $mrouted_flags
 fi
 
 # $rwhod is imported from /etc/rc.conf;
 # if $rwhod == YES, rwhod is run.
-if [ X${rwhod} = X"YES" ]; then
+if [ X"${rwhod}" = X"YES" ]; then
        echo -n ' rwhod';               rwhod
 fi
 
 
-if [ X${lpd} = X"YES" ]; then
+if [ X"${lpd}" = X"YES" ]; then
        echo -n ' printer';             lpd
 fi
 
@@ -330,46 +330,46 @@
 # 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
+if [ X"${sendmail_flags}" != X"NO" -a -r /etc/sendmail.cf ]; then
        echo -n ' sendmail';            /usr/sbin/sendmail ${sendmail_flags}
 fi
 
 # $smtpfwdd_flags is imported from /etc/rc.conf;
 # If $smtpfwdd_flags == NO, smtpfwdd isn't run.
-if [ "X${smtpfwdd_flags}" != X"NO" ]; then
+if [ X"${smtpfwdd_flags}" != X"NO" ]; then
        echo -n ' smtpfwdd';    /usr/libexec/smtpfwdd ${smtpfwdd_flags}
 fi
 
 
-if [ X${inetd} = X"YES" ]; then
+if [ X"${inetd}" = X"YES" ]; then
        echo -n ' inetd';               inetd
 fi
 
 # $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
+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
+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
+if [ X"${rbootd_flags}" != X"NO" -a -r /etc/rbootd.conf ]; then
        echo -n ' rbootd';              rbootd ${rbootd_flags}
 fi
 
 # $mopd_flags is imported from /etc/rc.conf;
 # If $mopd_flags == NO or /tftpboot/mop doesn't exist, then
 # mopd isn't run.
-if [ "X${mopd_flags}" != X"NO" -a -d /tftpboot/mop ]; then
+if [ X"${mopd_flags}" != X"NO" -a -d /tftpboot/mop ]; then
        echo -n ' mopd';                mopd ${mopd_flags}
 fi
 
@@ -397,14 +397,14 @@
 
 # Kerberos runs ONLY on the Kerberos servers
 # Kadmin is runs only on the main server
-if [ X${kerberos_server} = X"YES" ]; then
+if [ X"${kerberos_server}" = X"YES" ]; then
        echo 'kerberos server'
        /usr/libexec/kerberos >> /var/log/kerberos.log &
        /usr/libexec/kadmind -n >> /var/log/kadmind.log &
 fi
 
 # Kpropd runs only on Kerberos slave servers
-if [ X${kerberos_slave} = X"YES" ]; then
+if [ X"${kerberos_slave}" = X"YES" ]; then
        echo 'kerberos slave server'
        /usr/libexec/kerberos -s >> /var/log/kerberos.log &
        /usr/libexec/kpropd -i &


--- netstart    Tue Feb 10 16:31:57 1998
+++ /etc/netstart       Mon Mar  2 10:05:41 1998
@@ -6,7 +6,7 @@
 #
 hostname=`cat /etc/myname`
 hostname $hostname
-if [ -f /etc/defaultdomain ]; then
+if [ -r /etc/defaultdomain ]; then
        domainname `cat /etc/defaultdomain`
 fi
 
@@ -15,7 +15,7 @@
 
 # Configure the IP filter before configuring network interfaces
 #
-if [ X"${ipfilter}" = X"YES" -a -f "${ipfilter_rules}" ]; then
+if [ X"${ipfilter}" = X"YES" -a -r "${ipfilter_rules}" ]; then
        echo 'configuring IP filter'
        ipf -Fa -f ${ipfilter_rules} -E
 else
@@ -24,7 +24,7 @@
 
 # Configure NAT before configuring network interfaces
 #
-if [ "${nat}" = "YES" -a "${ipfilter}" = "YES" -a -f "${nat_rules}" ]; then
+if [ X"${nat}" = X"YES" -a X"${ipfilter}" = X"YES" -a -r "${nat_rules}" ]; then
        echo 'configuring NAT'
        ipnat -CF -f ${nat_rules}
 else
@@ -82,7 +82,7 @@
            cmd="ifconfig $1 $af $name "
            if [ "${dt}" = "dest" ]; then cmd="$cmd $dtaddr"; fi
            if [ -n "$mask" ]; then cmd="$cmd netmask $mask"; fi
-           if [ -n "$bcaddr" -a "X$bcaddr" != "XNONE" ]; then
+           if [ -n "$bcaddr" -a X"$bcaddr" != X"NONE" ]; then
                cmd="$cmd broadcast $bcaddr";
            fi
            cmd="$cmd $extras"
@@ -95,7 +95,7 @@
 
 # /etc/mygate, if it exists, contains the name of my gateway host
 # that name must be in /etc/hosts.
-if [ -f /etc/mygate ]; then
+if [ -r /etc/mygate ]; then
        route add -host default `cat /etc/mygate`
 fi
 


--- rc.conf     Fri Feb 20 13:27:29 1998
+++ /etc/rc.conf        Tue Feb 24 16:59:45 1998
@@ -8,12 +8,13 @@
 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"
+sendmail_flags="-bd -q30m"     # for 'normal' use: sendmail_flags="-bd -q30m"
 smtpfwdd_flags=NO      # for 'normal' use: smtpfwdd_flags="", no -bd above.
 named_flags=NO         # for 'normal' use: named_flags=""
-timed_flags=NO         # for 'normal' use: timed_flags=""
-photurisd_flags=""     # for 'normal' use: photurisd_flags=""
+timed_flags=""         # for 'normal' use: timed_flags=""
+photurisd_flags=NO     # for 'normal' use: photurisd_flags=""
 mopd_flags=NO          # for 'normal' use: mopd_flags="-a"
+scon_flags=NO          # for 'normal' use: scon_flags="-t 300"
 
 # set the following to "YES" to turn them on
 rwhod=NO
@@ -26,10 +27,16 @@
 amd=NO
 ipfilter=NO
 nat=NO                 # for "YES" ipfilter must also be "YES"
-portmap=YES            # almost always needed
+portmap=NO             # almost always needed
 inetd=YES              # almost always needed
 lpd=NO                 # printing daemons
 check_quotas=YES       # NO may be desireable in some YP environments
+ntpd=NO
+httpd=NO
+sshd=YES
+cfsd=NO
+snmpd=NO
+xdm=NO
 
 # miscellaneous other flags
 # only used if the appropriate server is marked YES above
@@ -43,4 +50,4 @@
 ipfilter_rules=/etc/ipf.rules  # Rules for IP packet filtering
 nat_rules=/etc/ipnat.rules     # Rules for Network Address Translation
 ipmon_flags=-s                 # To disable logging, use ipmon_flags=NO
-syslogd_flags=                 # add more flags, ie. -u -a /chroot/dev/log
+syslogd_flags=-u                       # add more flags, ie. -u -a /chroot/dev/
log

OOPS!! ignore that last change on syslogd. It's a cut/paste error.


--- rc.local    Tue Feb 10 16:31:58 1998
+++ /etc/rc.local       Mon Mar  2 09:43:47 1998
@@ -1,4 +1,4 @@
-#      $OpenBSD: rc.local,v 1.19 1998/02/02 00:29:14 dima Exp $
+#      $OpenBSD: rc.local,v 1.11 1997/05/04 20:46:07 millert Exp $
 
 # site-specific startup actions, daemons, and other things which
 # can be done AFTER your system goes into securemode.  For actions
@@ -10,15 +10,21 @@
 
 echo -n 'starting local daemons:'
 
-if [ -x /usr/local/etc/httpd/httpd ]; then
-       echo -n ' httpd';       /usr/local/etc/httpd/httpd
+# $httpd is imported from /etc/rc.conf;
+# if $httpd = YES, httpd is run.
+if [ X"${httpd}" = X"YES" ]; then
+       echo -n ' httpd';       /usr/local/etc/httpd/httpd 
 fi
 
-if [ -x /usr/local/sbin/sshd ]; then
+# $sshd is imported from /etc/rc.conf;
+# if $sshd = YES, sshd is run.
+if [ X"${sshd}" = X"YES" ]; then
        echo -n ' sshd';        /usr/local/sbin/sshd
 fi
 
-if [ -x /usr/local/sbin/cfsd ]; then
+# $cfsd is imported from /etc/rc.conf;
+# if $cfsd = YES, cfsd is run.
+if [ X"${cfsd}" = X"YES" ]; then
        if ps auxc | grep -q '^ *root .* mountd$'; then
                echo -n ' cfsd';        /usr/local/sbin/cfsd
                mount -o port=3049,nfsv2,intr localhost:/null /crypt
@@ -27,18 +33,24 @@
        fi
 fi
 
-if [ -x /usr/local/sbin/snmpd ]; then
+# $snmpd is imported from /etc/rc.conf;
+# if $snmpd = YES, snmpd is run.
+if [ X"${snmpd}" = X"YES" ]; then
        echo -n ' snmpd';       /usr/local/sbin/snmpd
 fi
 
+# $scon_flags is imported from /etc/rc.conf;
+# if $scon_flags != NO, scon is run.
 # set pcvt screen saver time to 5min (see scon(1) for more options)
-#if test -x /usr/sbin/ispcvt -a -x /usr/sbin/scon && /usr/sbin/ispcvt; then
-#      echo -n ' scon';        /usr/sbin/scon -t 300
-#fi
+if [ X"${scon_flags}" != X"NO" ]; then
+       echo -n ' scon';        /usr/sbin/scon $scon_flags
+fi
 
 # Alternatively, xdm may be started in /etc/ttys.
-#if [ -x /usr/X11R6/bin/xdm ]; then
-#      echo -n ' xdm';         /usr/X11R6/bin/xdm
-#fi
+# $xdm is imported from /etc/rc.conf;
+# if $xdm = YES, xdm is run.
+if [ X"${xdm}" = X"YES" ]; then
+       echo -n ' xdm';         /usr/X11R6/bin/xdm
+fi                                                                            
 
 echo '.'