diff options
author | Symphorien Gibol <symphorien+git@xlumurb.eu> | 2017-10-14 18:08:25 +0200 |
---|---|---|
committer | Symphorien Gibol <symphorien+git@xlumurb.eu> | 2017-10-14 18:36:03 +0200 |
commit | 8158cd6d5e6464adaea135ada586f11b9dfca766 (patch) | |
tree | ea0a706dbbd3e2e3b0e8ba6c4a4581be109e6081 | |
parent | 3fe7cddc304abb86e61a750a4f807270c7ca7825 (diff) | |
download | nixlib-8158cd6d5e6464adaea135ada586f11b9dfca766.tar nixlib-8158cd6d5e6464adaea135ada586f11b9dfca766.tar.gz nixlib-8158cd6d5e6464adaea135ada586f11b9dfca766.tar.bz2 nixlib-8158cd6d5e6464adaea135ada586f11b9dfca766.tar.lz nixlib-8158cd6d5e6464adaea135ada586f11b9dfca766.tar.xz nixlib-8158cd6d5e6464adaea135ada586f11b9dfca766.tar.zst nixlib-8158cd6d5e6464adaea135ada586f11b9dfca766.zip |
nixos/luksroot.nix: fallback to interactive password entry when no keyfile found
-rw-r--r-- | nixos/modules/system/boot/luksroot.nix | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/nixos/modules/system/boot/luksroot.nix b/nixos/modules/system/boot/luksroot.nix index 06f004fb06ec..19ca2a2c1bd6 100644 --- a/nixos/modules/system/boot/luksroot.nix +++ b/nixos/modules/system/boot/luksroot.nix @@ -43,8 +43,15 @@ let open_normally() { echo luksOpen ${device} ${name} ${optionalString allowDiscards "--allow-discards"} \ ${optionalString (header != null) "--header=${header}"} \ - ${optionalString (keyFile != null) "--key-file=${keyFile} ${optionalString (keyFileSize != null) "--keyfile-size=${toString keyFileSize}"}"} \ > /.luksopen_args + ${optionalString (keyFile != null) '' + if [ -e ${keyFile} ]; then + echo " --key-file=${keyFile} ${optionalString (keyFileSize != null) "--keyfile-size=${toString keyFileSize}"}" \ + >> /.luksopen_args + else + echo "keyfile ${keyFile} not found -- fallback to interactive unlocking" + fi + ''} cryptsetup-askpass rm /.luksopen_args } |