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 87f7bd5651
commit aa8f7bd6ac

View File

@@ -44,12 +44,13 @@ in
pkgs.mkpasswd
];
script = ''
prompt_value=$(cat $prompts/user-password)
if [[ -n ''${prompt_value-} ]]; then
echo $prompt_value | tr -d "\n" > $secrets/user-password
echo $prompt_value | tr -d "\n" > $out/user-password
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
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
'';
};
};