aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/dracut
diff options
context:
space:
mode:
authordacianstremtan <[email protected]>2019-10-01 15:54:27 -0400
committerBrian Behlendorf <[email protected]>2019-10-01 12:54:27 -0700
commitbd76e6817cb53ad621fc100d0ec01fcaacbb092e (patch)
treedf14c6520ab300a0b76d1914710c88ae9d59b8a2 /contrib/dracut
parent608f8749a1055e6769899788e11bd51fd396f9e5 (diff)
Fix for zfs-dracut regression
Line 31 and 32 overwrote the ${root} variable which broke mount-zfs.sh We have create a new variable for the dataset instead of overwriting the ${root} variable in zfs-load-key.sh${root} variable in zfs-load-key.sh Reviewed-by: Kash Pande <[email protected]> Reviewed-by: Garrett Fields <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Dacian Reece-Stremtan <[email protected]> Closes #8913 Closes #9379
Diffstat (limited to 'contrib/dracut')
-rwxr-xr-xcontrib/dracut/90zfs/zfs-load-key.sh.in13
1 files changed, 7 insertions, 6 deletions
diff --git a/contrib/dracut/90zfs/zfs-load-key.sh.in b/contrib/dracut/90zfs/zfs-load-key.sh.in
index 9e7adfc79..42dc1d08f 100755
--- a/contrib/dracut/90zfs/zfs-load-key.sh.in
+++ b/contrib/dracut/90zfs/zfs-load-key.sh.in
@@ -25,22 +25,23 @@ while true; do
done
# run this after import as zfs-import-cache/scan service is confirmed good
+# we do not overwrite the ${root} variable, but create a new one, BOOTFS, to hold the dataset
if [ "${root}" = "zfs:AUTO" ] ; then
- root="$(zpool list -H -o bootfs | awk '$1 != "-" {print; exit}')"
+ BOOTFS="$(zpool list -H -o bootfs | awk '$1 != "-" {print; exit}')"
else
- root="${root##zfs:}"
- root="${root##ZFS=}"
+ BOOTFS="${root##zfs:}"
+ BOOTFS="${root##ZFS=}"
fi
# if pool encryption is active and the zfs command understands '-o encryption'
-if [ "$(zpool list -H -o feature@encryption $(echo "${root}" | awk -F\/ '{print $1}'))" = 'active' ]; then
+if [ "$(zpool list -H -o feature@encryption $(echo "${BOOTFS}" | awk -F\/ '{print $1}'))" = 'active' ]; then
# if the root dataset has encryption enabled
- ENCRYPTIONROOT=$(zfs get -H -o value encryptionroot "${root}")
+ ENCRYPTIONROOT=$(zfs get -H -o value encryptionroot "${BOOTFS}")
if ! [ "${ENCRYPTIONROOT}" = "-" ]; then
# decrypt them
TRY_COUNT=5
while [ $TRY_COUNT -gt 0 ]; do
- systemd-ask-password "Encrypted ZFS password for ${root}" --no-tty | zfs load-key "${ENCRYPTIONROOT}" && break
+ systemd-ask-password "Encrypted ZFS password for ${BOOTFS}" --no-tty | zfs load-key "${ENCRYPTIONROOT}" && break
TRY_COUNT=$((TRY_COUNT - 1))
done
fi