Use of rcorder for local rc.d/*.sh scripts

J.R. Oldroyd fbsd at opal.com
Mon Jun 6 23:08:54 GMT 2005


On Jun 06, 15:12, Doug Barton wrote:
> >If not, could we make the following change to /etc/rc.d/localpkg:
> >
> >--- localpkg.orig	Fri Oct  8 13:52:43 2004
> >+++ localpkg	Thu Jun  2 16:53:56 2005
> >@@ -36,7 +36,7 @@
> > 		done
> > 		script_save_sep="$IFS"
> > 		IFS="${script_name_sep}"
> >-		for script in ${slist}; do
> >+		for script in `rcorder -s nostart ${slist} 2>/dev/null`; do
> 
> This is an interesting approach. I'm in favor of incorporating rcorder for 
> local scripts (whether ports, or homegrown stuff), but I think I prefer an 
> approach that brings all the scripts into the fray, so that local scripts 
> that need to execute before parts of the base can do so. Have you put any 
> thought into such an approach?
> 

Yes, and I'd prefer that myself.

We'd need to eliminate /etc/rc.d/localpkg and merge its functionality
into /etc/rc.

The change would actually be trivial:

--- /etc/rc	Thu Jun  2 09:07:12 2005
+++ rc.new	Mon Jun  6 19:03:05 2005
@@ -72,7 +72,23 @@
 
 skip="-s nostart"
 [ `/sbin/sysctl -n security.jail.jailed` -eq 1 ] && skip="$skip -s nojail"
-files=`rcorder ${skip} /etc/rc.d/* 2>/dev/null`
+
+# For each dir in $local_startup, search for init scripts matching *.sh
+#
+case ${local_startup} in
+[Nn][Oo] | '')
+	;;
+*)
+	local_rc_files=""
+	for dir in ${local_startup}; do
+		if [ -d "${dir}" ]; then
+			local_rc_files="${local_rc_files} ${dir}/*.sh"
+		fi
+	done
+	;;
+esac
+
+files=`rcorder ${skip} /etc/rc.d/* ${local_rc_files} 2>/dev/null`
 
 for _rc_elem in ${files}; do
 	run_rc_script ${_rc_elem} ${_boot}


Also, a similar change for /etc/rc.shutdown.

	-jr


More information about the freebsd-rc mailing list