aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/initramfs/scripts
diff options
context:
space:
mode:
authorWitaut Bajaryn <[email protected]>2019-11-08 23:34:07 +0100
committerBrian Behlendorf <[email protected]>2019-11-08 14:34:07 -0800
commit6c7023a5326cc999cfaced931ee2498642d5e63f (patch)
tree973cb3e4852c0c4f84134b0d0b6142c8a2743755 /contrib/initramfs/scripts
parent734de7ced12f376e8f07ad8cec3ccc1abf9779b1 (diff)
Skip loading already loaded key
Don't ask for the password / try to load the key if the key for the encryptionroot is already loaded. The user might have loaded the key manually or by other means before the scripts get called. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Tom Caputi <[email protected]> Reviewed-by: Richard Laager <[email protected]> Signed-off-by: Witaut Bajaryn <[email protected]> Closes #9495 Closes #9529
Diffstat (limited to 'contrib/initramfs/scripts')
-rw-r--r--contrib/initramfs/scripts/zfs.in3
1 files changed, 3 insertions, 0 deletions
diff --git a/contrib/initramfs/scripts/zfs.in b/contrib/initramfs/scripts/zfs.in
index c82b210d7..523694473 100644
--- a/contrib/initramfs/scripts/zfs.in
+++ b/contrib/initramfs/scripts/zfs.in
@@ -414,6 +414,9 @@ decrypt_fs()
# If root dataset is encrypted...
if ! [ "${ENCRYPTIONROOT}" = "-" ]; then
+ KEYSTATUS="$(${ZFS} get -H -o value keystatus "${ENCRYPTIONROOT}")"
+ # Continue only if the key needs to be loaded
+ [ "$KEYSTATUS" = "unavailable" ] || return 0
TRY_COUNT=3
# Prompt with plymouth, if active
if [ -e /bin/plymouth ] && /bin/plymouth --ping 2>/dev/null; then