user-password: fix variables beeing incorrect

This commit is contained in:
Jörg Thalheim
2025-04-08 11:36:43 +02:00
committed by Mic92
parent 84a3f709e0
commit 6ba2d7fc02

View File

@@ -44,12 +44,13 @@ in
pkgs.mkpasswd pkgs.mkpasswd
]; ];
script = '' script = ''
prompt_value=$(cat $prompts/user-password)
if [[ -n ''${prompt_value-} ]]; then if [[ -n ''${prompt_value-} ]]; then
echo $prompt_value | tr -d "\n" > $secrets/user-password echo $prompt_value | tr -d "\n" > $out/user-password
else else
xkcdpass --numwords 3 --delimiter - --count 1 | tr -d "\n" > $secrets/user-password xkcdpass --numwords 3 --delimiter - --count 1 | tr -d "\n" > $out/user-password
fi fi
cat $secrets/user-password | mkpasswd -s -m sha-512 | tr -d "\n" > $secrets/user-password-hash mkpasswd -s -m sha-512 < $out/user-password | tr -d "\n" > $out/user-password-hash
''; '';
}; };
}; };