Use pre-existing setup user if existent

This commit is contained in:
Manuel Thalmann 2024-12-04 18:35:15 +01:00
parent 871992abbd
commit 542dc6f5a8

View file

@ -55,6 +55,9 @@ function runSetupUserAction -V dir
set -l sudoConfig "/etc/sudoers.d/PortValhalla" set -l sudoConfig "/etc/sudoers.d/PortValhalla"
begin begin
if id -u "$name" &>/dev/null
echo "Setup user already exists!"
else
echo "Creating setup user" echo "Creating setup user"
and useradd \ and useradd \
@ -64,6 +67,7 @@ function runSetupUserAction -V dir
--create-home \ --create-home \
--uid (getOSConfig setupUser.id --json) \ --uid (getOSConfig setupUser.id --json) \
"$name" "$name"
end
and begin and begin
echo "$name ALL=(ALL:ALL) NOPASSWD: ALL" echo "$name ALL=(ALL:ALL) NOPASSWD: ALL"