The following commit has been merged in the master branch:
commit 31099ca2c12ac8c37cc953cd998e0aafc5944433
Author: Samuel Thibault <[email protected]>
Date:   Sun Aug 22 16:30:24 2010 +0200

    Better parse kernel command line to only keep proper variable names

diff --git a/debian/local/runsystem b/debian/local/runsystem
index 028ee2e..150d4c9 100755
--- a/debian/local/runsystem
+++ b/debian/local/runsystem
@@ -24,22 +24,26 @@ echo "Console started."
 # Set the console device used by /sbin/reopen-console
 echo /dev/tty1 >/var/run/console-device
 
-export TERM=hurd
-
-# Preset the terminal type for /lib/debian-installer/detect-console
-export TERM_TYPE=virtual
-
-# Export kernel parameters into environment, like Linux does.
-for i in $*
-do
-  var=$(echo $i | sed "s/=.*$//")
-  [ $var != $i ] || continue
-  [ $var != root ] || continue
-  val=$(echo $i | sed "s/^$var=//")
-  echo $var is $val
-  eval export $var=\$val
-done
+# Get all kernel parameters that can be exported as environment variables
+envvars="$(echo $* | tr ' ' '\012' | egrep '^[-_/[:alnum:]]+=.*$')"
 
 # Invoke init as linuxrc to work around pid != 1
-exec /bin/busybox linuxrc
+init='/bin/busybox linuxrc'
+
+# Parse kernel parameters
+for i in $envvars ; do
+    case "$i" in
+        init="/sbin/init"|init="init")
+            # Avoid endless loop
+            : ;;
+        init=*)
+            init=${i#init=}
+            ;;
+        noshell=*)
+            sed -i '/^tty[12]/s/^/#/' /etc/inittab
+            ;;
+    esac
+done
 
+# Preset the terminal type for /lib/debian-installer/detect-console
+eval exec env - $envvars TERM=hurd TERM_TYPE=virtual $init

-- 
Debian GNU Hurd packaging

Reply via email to