From: Andreas Thienemann Date: Tue, 26 May 2009 16:08:19 +0000 (+0200) Subject: cleanup environment before calling real init X-Git-Tag: 0.1~168 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5fa499403fdead7b5c845514e764b04d08e9441c;p=thirdparty%2Fdracut.git cleanup environment before calling real init --- diff --git a/modules.d/99base/init b/modules.d/99base/init index 5ee897e87..192e92ace 100755 --- a/modules.d/99base/init +++ b/modules.d/99base/init @@ -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 || {