Use pre-existing setup user if existent

This commit is contained in:
Manuel Thalmann 2024-12-04 18:35:15 +01:00
parent 90ee796386
commit 260993c261

View file

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