[arch-projects] [mkinitcpio] [PATCH 3/4] rely on libmount defaults for file locations

Dave Reisner dreisner at archlinux.org
Wed Aug 28 21:32:06 EDT 2013


Using --tab-file for findmnt calls is redundant if we can rely on the
defaults. Sanitize the environment from any LIBMOUNT_* variables so
that we can be sure of what file we're reading.

Signed-off-by: Dave Reisner <dreisner at archlinux.org>
---
 install/autodetect | 2 +-
 mkinitcpio         | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/install/autodetect b/install/autodetect
index 3710e68..b3db536 100644
--- a/install/autodetect
+++ b/install/autodetect
@@ -37,7 +37,7 @@ build() {
     fi
 
     # detect filesystem for separate /usr
-    if usrfstype=$(findmnt -snero fstype --tab-file '/etc/fstab' -T '/usr'); then
+    if usrfstype=$(findmnt -snero fstype -T '/usr'); then
         add_if_avail "$usrfstype"
     fi
 
diff --git a/mkinitcpio b/mkinitcpio
index 0ae6913..2d8c579 100755
--- a/mkinitcpio
+++ b/mkinitcpio
@@ -31,7 +31,8 @@ export PATH='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
 # Sanitize environment further
 # GREP_OPTIONS="--color=always" will break everything
 # CDPATH can affect cd and pushd
-unset GREP_OPTIONS CDPATH
+# LIBMOUNT_* options can affect findmnt and other tools
+unset GREP_OPTIONS CDPATH "${!LIBMOUNT_@}"
 
 usage() {
     cat <<EOF
-- 
1.8.4



More information about the arch-projects mailing list