mirror of
https://github.com/nix-community/disko.git
synced 2026-12-04 15:03:28 +01:00
UI nit: remove unnecessary newline when prompting user for password
This commit is contained in:
1 parent
76c0a6dba3
commit
51d33bbb7f
1 file changed
+11
-4
+11
-4
@@ -132,13 +132,20 @@ in
|
|||||||
default = ''
|
default = ''
|
||||||
if ! blkid "${config.device}" >/dev/null || ! (blkid "${config.device}" -o export | grep -q '^TYPE='); then
|
if ! blkid "${config.device}" >/dev/null || ! (blkid "${config.device}" -o export | grep -q '^TYPE='); then
|
||||||
${lib.optionalString config.askPassword ''
|
${lib.optionalString config.askPassword ''
|
||||||
|
promptSecret() {
|
||||||
|
prompt=$1
|
||||||
|
var=$2
|
||||||
|
|
||||||
|
echo -n "$prompt"
|
||||||
|
IFS= read -r -s "$var"
|
||||||
|
echo
|
||||||
|
}
|
||||||
|
|
||||||
askPassword() {
|
askPassword() {
|
||||||
if [ -z ''${IN_DISKO_TEST+x} ]; then
|
if [ -z ''${IN_DISKO_TEST+x} ]; then
|
||||||
set +x
|
set +x
|
||||||
echo "Enter password for ${config.device}: "
|
promptSecret "Enter password for ${config.device}: " password
|
||||||
IFS= read -r -s password
|
promptSecret "Enter password for ${config.device} again to be safe: " password_check
|
||||||
echo "Enter password for ${config.device} again to be safe: "
|
|
||||||
IFS= read -r -s password_check
|
|
||||||
export password
|
export password
|
||||||
[ "$password" = "$password_check" ]
|
[ "$password" = "$password_check" ]
|
||||||
set -x
|
set -x
|
||||||
|
|||||||
Reference in new issue
Block a user