From 15bfed7f1f45b26f2e0f9afa32de4e7f314a422d Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Thu, 31 Oct 2024 21:52:01 +0100 Subject: [PATCH] Run the entire setup script in tmux --- scripts/Common/OS/install.fish | 40 +++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/scripts/Common/OS/install.fish b/scripts/Common/OS/install.fish index 33c62083..431b1718 100755 --- a/scripts/Common/OS/install.fish +++ b/scripts/Common/OS/install.fish @@ -8,26 +8,30 @@ if [ (id -u) -eq 0 ] set -l sudoConfig "/etc/sudoers.d/PortValhalla" rm ~/.bash_profile - begin - echo "Creating setup user" + if [ -z "$TMUX" ] + tmux new-session (cat /proc/$fish_pid/cmdline | string split0) + else + begin + echo "Creating setup user" - and useradd \ - --comment "PortValhalla Setup User" \ - --system \ - --no-user-group \ - --groups nix-users \ - --create-home \ - --uid (getOSConfig setupUser.id --json) \ - "$name" + and useradd \ + --comment "PortValhalla Setup User" \ + --system \ + --no-user-group \ + --groups nix-users \ + --create-home \ + --uid (getOSConfig setupUser.id --json) \ + "$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 - - 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 if not type -q getDeploymentScript function getDeploymentScript