[PATCH] Avoid use of "export -n"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"export -n" is a bash extension, not part of POSIX, and is hence
incompatible with the busybox shell.

This was breaking boot when the busybox module was used.

Reimplement the scope change in a few lines of standard shell code.
---
 modules.d/99base/init.sh |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/modules.d/99base/init.sh b/modules.d/99base/init.sh
index 5d51c9d..f599fae 100755
--- a/modules.d/99base/init.sh
+++ b/modules.d/99base/init.sh
@@ -263,8 +263,15 @@ else
     udevadm info --cleanup-db
 fi
 
+# Retain the values of these variables but ensure that they are unexported
+# This is a POSIX-compliant equivalent of bash's "export -n"
+for var in root rflags fstype netroot NEWROOT; do
+    eval tmp=\$$var
+    unset $var
+    [ -n "$tmp" ] && eval $var=\"$tmp\"
+done
+
 export RD_TIMESTAMP
-export -n root rflags fstype netroot NEWROOT
 set +x # Turn off debugging for this section
 # Clean up the environment
 for i in $(export -p); do
-- 
1.7.7.6

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux