@@ -32,9 +32,12 @@ let
3232 ''}
3333
3434 open_normally() {
35− cryptsetup luksOpen ${device} ${name} ${optionalString allowDiscards "--allow-discards"} \
35+ echo luksOpen ${device} ${name} ${optionalString allowDiscards "--allow-discards"} \
3636 ${optionalString (header != null) "--header=${header}"} \
37− ${optionalString (keyFile != null) "--key-file=${keyFile} ${optionalString (keyFileSize != null) "--keyfile-size=${toString keyFileSize}"}"}
37+ ${optionalString (keyFile != null) "--key-file=${keyFile} ${optionalString (keyFileSize != null) "--keyfile-size=${toString keyFileSize}"}"} \
38+ > /.luksopen_args
39+ cryptsetup-askpass
40+ rm /.luksopen_args
3841 }
3942
4043 ${optionalString (luks.yubikeySupport && (yubikey != null)) ''
@@ -418,6 +421,18 @@ in
418421 boot.initrd.extraUtilsCommands = ''
419422 copy_bin_and_libs ${pkgs.cryptsetup}/bin/cryptsetup
420423
424+ cat > $out/bin/cryptsetup-askpass <<EOF
425+ #!$out/bin/sh -e
426+ if [ -e /.luksopen_args ]; then
427+ cryptsetup \$(cat /.luksopen_args)
428+ killall cryptsetup
429+ else
430+ echo "Passphrase is not requested now"
431+ exit 1
432+ fi
433+ EOF
434+ chmod +x $out/bin/cryptsetup-askpass
435+
421436 ${optionalString luks.yubikeySupport ''
422437 copy_bin_and_libs ${pkgs.ykpers}/bin/ykchalresp
423438 copy_bin_and_libs ${pkgs.ykpers}/bin/ykinfo