[Pkg-sysvinit-commits] r548 - in sysvinit/trunk/debian: . sysv-rc/etc/init.d

Petter Reinholdtsen pere at costa.debian.org
Sun Jan 8 17:00:58 UTC 2006


Author: pere
Date: 2006-01-08 17:00:57 +0000 (Sun, 08 Jan 2006)
New Revision: 548

Modified:
   sysvinit/trunk/debian/changelog
   sysvinit/trunk/debian/sysv-rc/etc/init.d/rc
Log:
Make sure sourcing work with dash /bin/sh, by using 'set $action'
to pass arguments to the script. (Closes: #345267)


Modified: sysvinit/trunk/debian/changelog
===================================================================
--- sysvinit/trunk/debian/changelog	2006-01-08 15:37:12 UTC (rev 547)
+++ sysvinit/trunk/debian/changelog	2006-01-08 17:00:57 UTC (rev 548)
@@ -51,6 +51,8 @@
   * sysv-rc: Fix some typos in the startpar handling.  (Closes: #345269)
   * Add code to detect and report bad 'exit' calls in init.d scripts,
     if they kill /etc/init.d/rc.
+  * Make sure sourcing work with dash /bin/sh, by using 'set $action'
+    to pass arguments to the script. (Closes: #345267)
 
   Thanks to Mark Hatle for help with this release.
 

Modified: sysvinit/trunk/debian/sysv-rc/etc/init.d/rc
===================================================================
--- sysvinit/trunk/debian/sysv-rc/etc/init.d/rc	2006-01-08 15:37:12 UTC (rev 547)
+++ sysvinit/trunk/debian/sysv-rc/etc/init.d/rc	2006-01-08 17:00:57 UTC (rev 548)
@@ -23,6 +23,9 @@
 # Valid options are 'none', 'shell' and 'startpar'
 CONCURRENCY=none
 
+# Make sure the name survive changing the argument list
+scriptname="$0"
+
 umask 022
 
 #
@@ -42,7 +45,13 @@
 		for script in $scripts ; do
 			case "$script" in
 			  *.sh)
-				$debug $sh "$script" $action
+				if [ "." = "$sh" ] ; then
+					set "$action"
+					$debug $sh "$script"
+				else
+					$debug $sh "$script" $action
+				fi
+				)
 				;;
 			  *)
 				$debug "$script" $action
@@ -55,7 +64,12 @@
 		for script in $scripts ; do
 			case "$script" in
 			  *.sh)
-				$debug $sh "$script" $action
+				if [ "." = "$sh" ] ; then
+					set "$action"
+					$debug $sh "$script"
+				else
+					$debug $sh "$script" $action
+				fi
 				;;
 			  *)
 				$debug "$script" $action &
@@ -90,7 +104,7 @@
 }
 
 on_exit() {
-    echo "$0 exited outside the expected code flow."
+    echo "error: '$scriptname' exited outside the expected code flow."
 }
 trap on_exit EXIT # Enable emergency handler
 
@@ -107,7 +121,7 @@
 [ "$1" != "" ] && runlevel=$1
 if [ "$runlevel" = "" ]
 then
-	echo "Usage: $0 <runlevel>" >&2
+	echo "Usage: $scriptname <runlevel>" >&2
 	exit 1
 fi
 previous=$PREVLEVEL




More information about the Pkg-sysvinit-commits mailing list