[patch] rc.d cleanup

diz at linuxpowered.com diz at linuxpowered.com
Tue Aug 2 02:49:21 GMT 2005


> diz at linuxpowered.com wrote this message on Mon, Aug 01, 2005 at 12:29
> -0500:
>> This has the result of reducing the size of the shell code, and reducing
>
> Unless you cross a fs frag (usually 1024 bytes), i.e. reduce the scripts
> by an average of 512bytes *per* script, you will see no disk space savings
> from these changes...  considering that on my 5.4-R system over half
> (73 of 124) are under a frag in size, it isn't that much...
>
> One thing that would be really useful for rc.d system is a way to cache
> the ordering on boot...  On a slow system like a 200mhz arm, the rc
> ordering can take a long while....
>
> --
>   John-Mark Gurney				Voice: +1 415 225 5579
>
>      "All that I will do, has been done, All that I have, has not."
>


Ok thanks for the dirrection. Ask and thy shall receive. well a quick hack
at least to implement cache of rcorder, although from my tests even on old
hardware rcorder is quick. I wrote this in (cring) the long-spelled out
way. Anyways... don't forget to add the essential rc.conf knobs for the
two variables shown bellow.

[root@:/etc]# diff -u rc rc.new
--- rc  Sun Jul 31 17:45:19 2005
+++ rc.new      Mon Aug  1 21:42:12 2005
@@ -72,7 +72,17 @@

 skip="-s nostart"
 [ `/sbin/sysctl -n security.jail.jailed` -eq 1 ] && skip="$skip -s nojail"
-files=`rcorder ${skip} /etc/rc.d/* 2>/dev/null`
+# check for a rc.conf knob to check for existing cache, and skip the
rcorder part
+if checkyesno ${rc_cache_enable} ; then
+       if [ -f ${rc_cache_file} ] ; then
+               files=`cat ${rc_cache_file}`
+       else
+               files=`rcorder ${skip} /etc/rc.d/* 2>/dev/null`
+               echo "${files}" > ${rc_cache_file}
+       fi
+else
+       files=`rcorder ${skip} /etc/rc.d/* 2>/dev/null`
+fi

 for _rc_elem in ${files}; do
        run_rc_script ${_rc_elem} ${_boot}







More information about the freebsd-hackers mailing list