irises~!

zfs-load-key.service

Quick little systemd service to load ZFS encryption keys for all datasets, before zfs-mount.service runs:

[Unit]
Description=Load ZFS encryption keys
DefaultDependencies=false
Before=zfs-mount.service

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/bash -c 'for DS in $(/usr/bin/zfs list -Hpo name); do while [ "x$(/usr/bin/zfs get -Hpo value keystatus "$DS")" == "xunavailable" ]; do /usr/bin/systemd-ask-password "Passphrase for $DS" | /usr/bin/zfs load-key -r "$DS"; done; done'

[Install]
WantedBy=zfs.target

:)