tech-userlevel archive

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

Configurable list of rc directories



Hi all,
the attached patch adds rc_directories to specify what directories to
look in for rc scripts. It defaults to /etc/rc.d, but can be overriden
to separate e.g. pkgsrc rc scripts from base scripts. It does not change
the fact that all rc scripts must be on the root filesystem.

Comments? I do intend to get this pulled up to netbsd-5.

Joerg
Index: etc/rc
===================================================================
RCS file: /home/joerg/repo/netbsd/src/etc/rc,v
retrieving revision 1.162
diff -u -p -r1.162 rc
--- etc/rc      4 Jan 2003 15:27:43 -0000       1.162
+++ etc/rc      4 Apr 2009 21:04:42 -0000
@@ -37,7 +37,8 @@ trap "echo 'Boot interrupted.'; exit 1" 
 
 date
 
-files=$(rcorder -s nostart ${rc_rcorder_flags} /etc/rc.d/*)
+scripts=$(for rcd in ${rc_directories:-/etc/rc.d}; do test -d ${rcd} && echo 
${rcd}/*; done)
+files=$(rcorder -s nostart ${rc_rcorder_flags} ${scripts})
 
 for _rc_elem in $files; do
        run_rc_script $_rc_elem start
Index: etc/defaults/rc.conf
===================================================================
RCS file: /home/joerg/repo/netbsd/src/etc/defaults/rc.conf,v
retrieving revision 1.101
diff -u -p -r1.101 rc.conf
--- etc/defaults/rc.conf        23 Mar 2009 18:52:02 -0000      1.101
+++ etc/defaults/rc.conf        4 Apr 2009 21:06:09 -0000
@@ -30,6 +30,10 @@
 #
 rc_rcorder_flags=""
 
+# The directories searched for rc scripts.
+# This directories must be part of the root filesystem.
+rc_directories=/etc/rc.d 
+
 # If this is set to NO, shutdown(8) will not run /etc/rc.shutdown.
 #
 do_rcshutdown=YES
Index: share/man/man5/rc.conf.5
===================================================================
RCS file: /home/joerg/repo/netbsd/src/share/man/man5/rc.conf.5,v
retrieving revision 1.128
diff -u -p -r1.128 rc.conf.5
--- share/man/man5/rc.conf.5    27 Mar 2009 09:11:36 -0000      1.128
+++ share/man/man5/rc.conf.5    4 Apr 2009 22:01:39 -0000
@@ -55,7 +55,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd March 27, 2009
+.Dd April 5, 2009
 .Dt RC.CONF 5
 .Os
 .Sh NAME
@@ -184,6 +184,15 @@ Extra arguments to the
 .Xr rcorder 8
 run by
 .Pa /etc/rc .
+.It Sy rc_directories
+A string.
+Space separated list of directories searched for rc scripts.
+The default is
+.Pa /etc/rc.d .
+All directories in
+.Ev rc_directories
+must be located in the root filesystem, otherwise they will be silently
+skipped.
 .El
 .Ss Basic network configuration
 .Bl -tag -width net_interfaces


Home | Main Index | Thread Index | Old Index