confd: Fix failure-config generation when password is missing

Setting admin's password to "!" is not accepted by the model, which
means we end up in RMA mode, even in cases when a valid startup
exists.

Not supplying a password will cause confd to generate a locked
account, which is what we want.
This commit is contained in:
Tobias Waldekranz
2023-11-25 20:37:15 +01:00
committed by Joachim Wiberg
parent e53fd91c7f
commit 2da2e7fd5e
+3 -2
View File
@@ -7,9 +7,10 @@ pwhash=$(jq -r '."factory-password-hash"' /run/system.json)
if [ -z "$pwhash" ] || [ "$pwhash" = "null" ]; then
# Do not fail, lock account instead. This way developers can enable
# root account login at build-time to diagnose the system.
pwhash="!"
password=""
rc=1
else
password="\"password\": \"$pwhash\","
rc=0
fi
@@ -20,7 +21,7 @@ cat <<EOF
"user": [
{
"name": "admin",
"password": "$pwhash",
${password}
"infix-system:shell": "$shell"
}
]