[Pkg-sysvinit-commits] r1833 - in sysvinit/trunk/debian: . src/initscripts/lib/init

Petter Reinholdtsen pere at alioth.debian.org
Sat Mar 20 10:10:51 UTC 2010


Author: pere
Date: 2010-03-20 10:10:42 +0000 (Sat, 20 Mar 2010)
New Revision: 1833

Modified:
   sysvinit/trunk/debian/changelog
   sysvinit/trunk/debian/src/initscripts/lib/init/vars.sh
Log:
Make kernel argument parsing in /lib/init/vars.sh more robust to
avoid incorrect matches (Closes: #557648).

Modified: sysvinit/trunk/debian/changelog
===================================================================
--- sysvinit/trunk/debian/changelog	2010-03-20 10:01:00 UTC (rev 1832)
+++ sysvinit/trunk/debian/changelog	2010-03-20 10:10:42 UTC (rev 1833)
@@ -9,6 +9,8 @@
   * Only send SIGUSR to init from init.d/mountall.sh when /dev/initctl
     was created, to reduce the chance of confusing upstart (Related to
     #569032).
+  * Make kernel argument parsing in /lib/init/vars.sh more robust to
+    avoid incorrect matches (Closes: #557648).
 
  -- Petter Reinholdtsen <pere at debian.org>  Sun, 25 Oct 2009 22:32:18 +0100
 

Modified: sysvinit/trunk/debian/src/initscripts/lib/init/vars.sh
===================================================================
--- sysvinit/trunk/debian/src/initscripts/lib/init/vars.sh	2010-03-20 10:01:00 UTC (rev 1832)
+++ sysvinit/trunk/debian/src/initscripts/lib/init/vars.sh	2010-03-20 10:10:42 UTC (rev 1833)
@@ -2,25 +2,38 @@
 # Set rcS vars
 #
 
-[ -f /etc/default/rcS ] && . /etc/default/rcS || true
-
-# check for bootoption 'noswap' and do not activate swap
-# partitions/files when it is set.
-if [ -r /proc/cmdline ] && grep -qw 'noswap' /proc/cmdline ; then
-    NOSWAP=yes
-else
-    NOSWAP=no
+# Source conffile
+if [ -f /etc/default/rcS ]; then
+    . /etc/default/rcS
 fi
 
-# Accept the same 'quiet' option as the kernel, but only during boot
-# and shutdown.  Only use this rule when the variables set by
-# init.d/rc is present.
-if [ "$RUNLEVEL" ] && [ "$PREVLEVEL" ] ; then
-    if [ -r /proc/cmdline ] && egrep -qw 'quiet' /proc/cmdline ; then
-       VERBOSE="no"
-    fi
+# Parse kernel command line
+if [ -r /proc/cmdline ]; then
+    for ARG in $(cat /proc/cmdline); do
+        case $ARG in
+
+            # check for bootoption 'noswap' and do not activate swap
+            # partitions/files when it is set.
+            noswap)
+		NOSWAP=yes
+		break
+		;;
+
+            # Accept the same 'quiet' option as the kernel, but only
+            # during boot and shutdown.  Only use this rule when the
+            # variables set by init.d/rc is present.
+            quiet)
+		if [ "$RUNLEVEL" ] && [ "$PREVLEVEL" ] ; then
+		    VERBOSE="no"
+		fi
+		break
+		;;
+	esac
+    done
 fi
 
 # But allow both rcS and the kernel options 'quiet' to be overrided
 # when INIT_VERBOSE=yes is used as well.
-[ "$INIT_VERBOSE" ] && VERBOSE="$INIT_VERBOSE" || true
+if [ "$INIT_VERBOSE" ] ; then
+    VERBOSE="$INIT_VERBOSE"
+fi




More information about the Pkg-sysvinit-commits mailing list