Use pre-existing setup user if existent
This commit is contained in:
parent
562c55b78f
commit
972de35629
1 changed files with 13 additions and 9 deletions
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue