Run the entire setup script in tmux

This commit is contained in:
Manuel Thalmann 2024-10-31 21:52:01 +01:00
parent fd5fc86b1b
commit 15bfed7f1f

View file

@ -8,26 +8,30 @@ if [ (id -u) -eq 0 ]
set -l sudoConfig "/etc/sudoers.d/PortValhalla" set -l sudoConfig "/etc/sudoers.d/PortValhalla"
rm ~/.bash_profile rm ~/.bash_profile
begin if [ -z "$TMUX" ]
echo "Creating setup user" tmux new-session (cat /proc/$fish_pid/cmdline | string split0)
else
begin
echo "Creating setup user"
and useradd \ and useradd \
--comment "PortValhalla Setup User" \ --comment "PortValhalla Setup User" \
--system \ --system \
--no-user-group \ --no-user-group \
--groups nix-users \ --groups nix-users \
--create-home \ --create-home \
--uid (getOSConfig setupUser.id --json) \ --uid (getOSConfig setupUser.id --json) \
"$name" "$name"
end
and begin
echo "$name ALL=(ALL:ALL) NOPASSWD: ALL"
end >"$sudoConfig"
and sudo --preserve-env --set-home --user "$name" "$INSTALLER_SCRIPT"
rm "$sudoConfig"
userdel -rf "$name"
end end
and begin
echo "$name ALL=(ALL:ALL) NOPASSWD: ALL"
end >"$sudoConfig"
and sudo --preserve-env --set-home --user "$name" "$INSTALLER_SCRIPT"
rm "$sudoConfig"
userdel -rf "$name"
else else
if not type -q getDeploymentScript if not type -q getDeploymentScript
function getDeploymentScript function getDeploymentScript