summaryrefslogtreecommitdiffstats
path: root/etc
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 /etc
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 'etc')
-rwxr-xr-xetc/systemd/system-generators/zfs-mount-generator.in2
1 files changed, 2 insertions, 0 deletions
diff --git a/etc/systemd/system-generators/zfs-mount-generator.in b/etc/systemd/system-generators/zfs-mount-generator.in
index 3e529cb67..be2c1420c 100755
--- a/etc/systemd/system-generators/zfs-mount-generator.in
+++ b/etc/systemd/system-generators/zfs-mount-generator.in
@@ -182,6 +182,8 @@ process_line() {
keyloadcmd="@sbindir@/zfs load-key '${dataset}'"
elif [ "${p_keyloc}" = "prompt" ] ; then
keyloadcmd="sh -c 'set -eu;"\
+"keystatus=\"\$\$(@sbindir@/zfs get -H -o value keystatus \"${dataset}\")\";"\
+"[ \"\$\$keystatus\" = \"unavailable\" ] || exit 0;"\
"count=0;"\
"while [ \$\$count -lt 3 ];do"\
" systemd-ask-password --id=\"zfs:${dataset}\""\