]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
cleanup environment before calling real init
authorAndreas Thienemann <andreas@bawue.net>
Tue, 26 May 2009 16:08:19 +0000 (18:08 +0200)
committerHarald Hoyer <harald@redhat.com>
Tue, 26 May 2009 16:08:19 +0000 (18:08 +0200)
modules.d/99base/init

index 5ee897e875867f96c31e8edf842cef7be8840106..192e92ace985a3fba5445eef42649afb6d06b5f6 100755 (executable)
@@ -93,11 +93,23 @@ done
 
 getarg break && emergency_shell
 kill $(pidof udevd)
+
+# Clean up the environment
+for i in $(export -p); do
+    i=${i#declare -x}
+    i=${i#export}
+    i=${i%%=*}
+    [ "$i" = "root" -o "$i" = "PATH" -o "$i" = "HOME" -o "$i" = "TERM" ] || unset $i
+done
+
 initargs=""
 for x in "$@"; do
     [ "${x%%=*}" = "console" ] && continue
     [ "${x%%=*}" = "BOOT_IMAGE" ] && continue
     [ "${x%%=*}" = "break" ] && continue
+    [ "${x%%=*}" = "rdinitdebug" ] && continue
+    [ "${x%%=*}" = "rdudevinfo" ] && continue
+    [ "${x%%=*}" = "rdudevdebug" ] && continue
     initargs="$initargs $x"
 done
 exec switch_root "$NEWROOT" "$INIT" $initargs || {