From 5f345337faf953bc0cd3d6b0914ba9d0d281c6ca Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Sun, 3 Nov 2024 23:41:17 +0100 Subject: [PATCH] Prevent early disposal --- scripts/lib/action.fish | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/scripts/lib/action.fish b/scripts/lib/action.fish index d910301e..f9ab5cfa 100644 --- a/scripts/lib/action.fish +++ b/scripts/lib/action.fish @@ -28,14 +28,13 @@ end function runSetupUserAction -V dir source "$dir/nix.fish" - if [ (id -u) -eq 0 ] - set -l cmdline (cat /proc/$fish_pid/cmdline | string split0) + function setupUserAction -V dir -V sudoConfig + if [ (id -u) -eq 0 ] + set -l cmdline (cat /proc/$fish_pid/cmdline | string split0) - if [ -z "$TMUX" ] - tmux new-session $cmdline - else - - function setupUserAction -V dir -V sudoConfig -V cmdline + if [ -z "$TMUX" ] + tmux new-session $cmdline + else source "$dir/settings.fish" set -l sudoConfig "/etc/sudoers.d/PortValhalla" set -l name (getOSConfig setupUser.name) @@ -61,12 +60,11 @@ function runSetupUserAction -V dir rm "$sudoConfig" userdel -rf "$name" end - - runAction setupUserAction $argv + else + $argv uninstallNixPkgs - read -P "setup user action finished. press enter" end - else - $argv end + + runAction setupUserAction $argv end