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"
begin
echo "Creating setup user"
and useradd \
--comment "PortValhalla Setup User" \
--system \
--groups nix-users \
--create-home \
--uid (getOSConfig setupUser.id --json) \
"$name"
if id -u "$name" &>/dev/null
echo "Setup user already exists!"
else
echo "Creating setup user"
and useradd \
--comment "PortValhalla Setup User" \
--system \
--groups nix-users \
--create-home \
--uid (getOSConfig setupUser.id --json) \
"$name"
end
and begin
echo "$name ALL=(ALL:ALL) NOPASSWD: ALL"