dracut/0057-Avoid-use-of-export-n.patch

37 lines
1.1 KiB
Diff
Raw Normal View History

From 4e25cf6edf94755219a822ebc0e108e13377cc27 Mon Sep 17 00:00:00 2001
From: Daniel Drake <dsd@laptop.org>
Date: Fri, 16 Mar 2012 21:11:24 +0000
Subject: [PATCH] Avoid use of "export -n"
"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 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/modules.d/99base/init.sh b/modules.d/99base/init.sh
index fa712a7..84c13e0 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