luks: don't depend on autogenerated password

This commit is contained in:
Michael Hoang committed 2026-05-20 00:14:40 +02:00
1 parent d60b2b5e00
commit 0d15976fce
1 file changed
+6 -2
+6 -2
View File
@@ -227,13 +227,17 @@ in
export SLOT_ZERO_TO_DELETE=true
''}
cryptsetup -q luksFormat "${config.device}" ${toString config.extraFormatArgs} ${formatKeyFileArgs}
fi
if ! cryptsetup status "${config.name}" >/dev/null; then
${formatCryptsetupOpen} \
--persistent
fi
# Unlock without relying on the autogenerated password when someone
# calls this script after unmounting or rebooting
if ! cryptsetup status "${config.name}" >/dev/null; then
${cryptsetupOpen}
fi
${toString (
lib.forEach config.additionalKeyFiles (keyFile: ''
if ! cryptsetup open --test-passphrase --key-file=${keyFile} "${config.device}" 2>/dev/null; then