Skip to content

Commit 430f04f

Browse files
Fix(zfs_volume); Volume mount/unmount with encryption
- Fix consistent use of fully qualified dataset path - Add idempotent unmounting with encryption keys
1 parent b8dd0e2 commit 430f04f

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

lib/types/zfs_volume.nix

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@
8484
default = {
8585
dev = ''
8686
${lib.optionalString (config.options.keylocation or "none" != "none") ''
87-
if [ "$(zfs get keystatus ${config.name} -H -o value)" == "unavailable" ]; then
88-
zfs load-key ${config.name}
87+
if [ "$(zfs get keystatus ${config._name} -H -o value)" == "unavailable" ]; then
88+
zfs load-key ${config._name}
8989
fi
9090
''}
9191
@@ -98,9 +98,11 @@
9898
inherit config options;
9999
default = {
100100
dev = ''
101-
${lib.optionalString (
102-
config.options.keylocation or "none" != "none"
103-
) "zfs unload-key ${config.name}"}
101+
${lib.optionalString (config.options.keylocation or "none" != "none") ''
102+
if [ "$(zfs get keystatus ${config._name} -H -o value)" == "available" ]; then
103+
zfs unload-key ${config._name}
104+
fi
105+
''}
104106
105107
${config.content._unmount.dev or ""}
106108
'';

0 commit comments

Comments
 (0)