SVN: geninitrd/trunk/geninitrd

glen glen at pld-linux.org
Mon Mar 19 20:32:40 CET 2012


Author: glen
Date: Mon Mar 19 20:32:40 2012
New Revision: 12503

Modified:
   geninitrd/trunk/geninitrd
Log:
cleanup env

Modified: geninitrd/trunk/geninitrd
==============================================================================
--- geninitrd/trunk/geninitrd	(original)
+++ geninitrd/trunk/geninitrd	Mon Mar 19 20:32:40 2012
@@ -1378,6 +1378,38 @@
 initrd_gen_stop_udevd
 initrd_gen_stop_uvesafb
 
+# clean up env
+add_linuxrc <<-'EOF'
+	ifs=$IFS
+	IFS="
+	"
+	for i in $(export -p); do
+		i=${i#declare -x } # ksh/bash
+		i=${i#export } # busybox
+
+		case "$i" in
+		*=*)
+			: ;;
+		*)
+			continue ;;
+		esac
+
+		i=${i%%=*}
+
+		[ -z "$i" ] && continue
+
+		case "$i" in
+			root|PATH|HOME|TERM)
+				:
+				;;
+			*)
+				echo "unset $i"
+				;;
+		esac
+	done
+	IFS=$ifs
+EOF
+
 if [ "$INITRDFS" = "initramfs" ]; then
 	initrd_gen_initramfs_switchroot
 else


More information about the pld-cvs-commit mailing list