|
|
|
@ -27,19 +27,19 @@ zfs_get_bootfs () { |
|
|
|
|
|
|
|
|
|
zfs_decrypt_fs() { |
|
|
|
|
dataset=$1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# check if 'zfs load-key' is available |
|
|
|
|
zfs 2>&1 | grep load-key > /dev/null || return 0 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# check if dataset is encrypted |
|
|
|
|
[ "$(zfs get -H -o value encryption "${dataset}")" != "off" ] || return 0 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# check if key is already loaded |
|
|
|
|
[ "$(zfs get -H -o value keystatus "${dataset}")" != "available" ] || return 0 |
|
|
|
|
|
|
|
|
|
# get the encryption root |
|
|
|
|
encryptionroot=$(zfs get -H -o value encryptionroot "${dataset}") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# loop until we get the correct password |
|
|
|
|
while ! eval zfs load-key "${encryptionroot}"; do |
|
|
|
|
sleep 2 |
|
|
|
@ -90,7 +90,6 @@ zfs_mount_handler () { |
|
|
|
|
if findmnt -snero source -F "${tab_file}" -S "${dataset}" > /dev/null 2>&1; then |
|
|
|
|
opt=$(findmnt -snero options -F "${tab_file}" -S "${dataset}") |
|
|
|
|
mnt=$(findmnt -snero target -F "${tab_file}" -S "${dataset}") |
|
|
|
|
|
|
|
|
|
zfs_decrypt_fs "${dataset}" |
|
|
|
|
mount -t zfs -o "${opt}" "${dataset}" "${node}${mnt}" |
|
|
|
|
fi |
|
|
|
|