From 51d33bbb7f1e74ba5f9d9a77357735149da99081 Mon Sep 17 00:00:00 2001 From: Jeremy Fleischman Date: Thu, 17 Apr 2025 16:21:41 -0700 Subject: [PATCH] UI nit: remove unnecessary newline when prompting user for password --- lib/types/luks.nix | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/types/luks.nix b/lib/types/luks.nix index 9a58b7f..409f62a 100644 --- a/lib/types/luks.nix +++ b/lib/types/luks.nix @@ -132,13 +132,20 @@ in default = '' if ! blkid "${config.device}" >/dev/null || ! (blkid "${config.device}" -o export | grep -q '^TYPE='); then ${lib.optionalString config.askPassword '' + promptSecret() { + prompt=$1 + var=$2 + + echo -n "$prompt" + IFS= read -r -s "$var" + echo + } + askPassword() { if [ -z ''${IN_DISKO_TEST+x} ]; then set +x - echo "Enter password for ${config.device}: " - IFS= read -r -s password - echo "Enter password for ${config.device} again to be safe: " - IFS= read -r -s password_check + promptSecret "Enter password for ${config.device}: " password + promptSecret "Enter password for ${config.device} again to be safe: " password_check export password [ "$password" = "$password_check" ] set -x