The enclosed patch fixes the order of script execution so the directory 
order is also reversed. The current behavior is to have directories 
traversed in the same order as at startup, but have the scripts in the 
directories reversed. I just changed it so it builds the script list 
forward (like for startup), but then reverses the entire list before 
execution.

-gordon
--- /etc/rc.shutdown    Thu Apr 11 14:39:20 2002
+++ rc.shutdown Fri May 10 14:25:35 2002
@@ -52,6 +52,18 @@
        . /etc/rc.conf
 fi
 
+# reverse_list list
+#      print the list in reverse order
+#
+reverse_list()
+{
+       _revlist=
+       for _revfile in $*; do
+               _revlist="$_revfile${script_name_sep}$_revlist"
+       done
+       echo $_revlist
+}
+
 # Write some entropy so the rebooting /dev/random can reseed
 #
 case ${entropy_file} in
@@ -109,13 +121,13 @@
        for dir in ${local_startup}; do
                if [ -d "${dir}" ]; then
                        for script in ${dir}/*.sh; do
-                               slist="${script}${script_name_sep}${slist}"
+                               slist="${slist}${script_name_sep}${script}"
                        done
                fi
        done
        script_save_sep="$IFS"
        IFS="${script_name_sep}"
-       for script in ${slist}; do
+       for script in `reverse_list ${slist}`; do
                if [ -x "${script}" ]; then
                        (set -T
                        trap 'exit 1' 2

Reply via email to