Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 May 2002 14:32:57 -0700 (PDT)
From:      Gordon Tetlow <gordont@gnf.org>
To:        current@freebsd.org
Subject:   Fix order of directories in rc.shutdown
Message-ID:  <Pine.LNX.4.44.0205101428530.27477-200000@smtp.gnf.org>

index | next in thread | raw e-mail

[-- Attachment #1 --]
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

[-- Attachment #2 --]
--- /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
home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.LNX.4.44.0205101428530.27477-200000>