Subject: Re: admin script for ipfilter
To: Darren Reed <darrenr@NetBSD.org>
From: Hubert Feyrer <hubert@feyrer.de>
List: tech-userlevel
Date: 12/30/2006 01:05:14
On Fri, 29 Dec 2006, Darren Reed wrote:
> that functioned in a manner specific to rc.d.  Having a chkconfig
> in NetBSD that was similar but different will just lead to confusion
> when you have to use both NetBSD AND Linux.

True... you mean like the one in Linux that seems to obscure what I know 
from Irix?

Let me recap from what I know about the Irix one, so maybe you have an 
idea why I suggested it (see 
http://www.cs.stevens.edu/~feyrer/SA/en/06-booting.html for some 
reference):

  * It can be used to show if services are disabled or enabled, without
    a need to know any paths:

       rfhsi8089% chkconfig
               Flag                 State
               ====                 =====

               array                off
               autoconfig_ipaddress off
               autofs               on
               automount            off
               cesag                off
               desktop              on
               dtlogin              off
       	...

  * It can do so for individual services, for scripting, again without
    bothering for any pathnames:

       rfhsi8089% chkconfig autofs
       rfhsi8089% echo $?
       0
       rfhsi8089% chkconfig automount
       rfhsi8089% echo $?
       1

  * The implementation is done in single files as you wanted:

       rfhsi8089% cat /etc/config/autofs
       on
       rfhsi8089% cat /etc/config/automount
       off


       rfhsi8089% cat /etc/init.d/network
       ...
       IS_ON=/sbin/chkconfig
       ...
                   # Start the NFS automounter daemon
                   if $IS_ON autofs && test -x $NFS/autofsd && \
                                       test -x $NFS/autofs; then
                       /sbin/killall -k 30 -TERM automount
                       /sbin/killall -k 10 -TERM autofs autofsd
                       AUTOFSD_OPTS="`cat $CONFIG/autofsd.options 2> /dev/null`"
                       $CSU CAP_MOUNT_MGT,CAP_SCHED_MGT,CAP_MAC_READ,CAP_MAC_WRITE,CAP_AUDIT_WRITE,CAP_MAC_UPGRADE,CAP_MAC_DOWNGRADE,CAP_MAC_RELABEL_OPEN,CAP_MAC_MLD,CAP_NETWORK_MGT,CAP_PRIV_PORT+ip -c "$NFS/autofsd $AUTOFSD_OPTS" >/dev/null 2>&1
                                                               $ECHO " autofsd\c"
                       AUTOFS_OPTS="`cat $CONFIG/autofs.options 2> /dev/null`"
                       $CSU CAP_MOUNT_MGT,CAP_MAC_READ+ip -c "$NFS/autofs $AUTOFS_OPTS" 2>&1 | while read l; do $LOGGER "autofs: %s\n" "$l"; done >/dev/null 2>&1
                    elif $IS_ON automount && test -x $NFS/automount ; then
                       /sbin/killall -k 30 -TERM automount
                       AUTOMOUNT_OPTS="`cat $CONFIG/automount.options 2> /dev/null`"
                       $NFS/automount $AUTOMOUNT_OPTS 2>&1 | \
                              while read l; do $LOGGER "automount: %s\n" "$l" ; done > /dev/null 2>&1
                                                                $ECHO " automount\c"
                   fi

  * IIRC it can enable and disable services with the same tool ("chkconfig
    service on/off") but i can't test this right now.

I do not know what Linux added beyond that, but the above is what I had in 
mind, as answer to your list of requirements.


  - Hubert