aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorq66 <[email protected]>2023-03-07 02:07:01 +0100
committerGitHub <[email protected]>2023-03-06 17:07:01 -0800
commit4628bb9c6059f997dcf9aba9478843aba1596026 (patch)
tree9af5fcc72a0d198f18b1bf5ceb1a344bac70e197
parent84a1c48c86775c21649ce42b3c512ca3070f8c2d (diff)
initramfs: fix zpool get argument order
When using the zfs initramfs scripts on my system, I get various errors at initramfs stage, such as: cannot open '-o': name must begin with a letter My zfs binaries are compiled with musl libc, which may be why this happens. In any case, fix the argument order to make the zpool binary happy, and to match its --help output. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Richard Yao <[email protected]> Signed-off-by: Daniel Kolesa <[email protected]> Closes #14572
-rw-r--r--contrib/initramfs/scripts/zfs6
1 files changed, 3 insertions, 3 deletions
diff --git a/contrib/initramfs/scripts/zfs b/contrib/initramfs/scripts/zfs
index d1a99e4a8..97d471cc8 100644
--- a/contrib/initramfs/scripts/zfs
+++ b/contrib/initramfs/scripts/zfs
@@ -194,7 +194,7 @@ import_pool()
# Verify that the pool isn't already imported
# Make as sure as we can to not require '-f' to import.
- "${ZPOOL}" get name,guid -o value -H 2>/dev/null | grep -Fxq "$pool" && return 0
+ "${ZPOOL}" get -H -o value name,guid 2>/dev/null | grep -Fxq "$pool" && return 0
# For backwards compatibility, make sure that ZPOOL_IMPORT_PATH is set
# to something we can use later with the real import(s). We want to
@@ -902,12 +902,12 @@ mountroot()
fi
# In case the pool was specified as guid, resolve guid to name
- pool="$("${ZPOOL}" get name,guid -o name,value -H | \
+ pool="$("${ZPOOL}" get -H -o name,value name,guid | \
awk -v pool="${ZFS_RPOOL}" '$2 == pool { print $1 }')"
if [ -n "$pool" ]; then
# If $ZFS_BOOTFS contains guid, replace the guid portion with $pool
ZFS_BOOTFS=$(echo "$ZFS_BOOTFS" | \
- sed -e "s/$("${ZPOOL}" get guid -o value "$pool" -H)/$pool/g")
+ sed -e "s/$("${ZPOOL}" get -H -o value guid "$pool")/$pool/g")
ZFS_RPOOL="${pool}"
fi