From b61602cd68dc593c53c51b6e42483aea944dbc00 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Sun, 8 Dec 2024 04:46:13 +0100 Subject: [PATCH] Normalize exit code of setup actions --- scripts/lib/action.fish | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/lib/action.fish b/scripts/lib/action.fish index 3e2fbd4b..fcdd351a 100644 --- a/scripts/lib/action.fish +++ b/scripts/lib/action.fish @@ -55,6 +55,8 @@ function runSetupUserAction -V dir set -l sudoConfig "/etc/sudoers.d/PortValhalla" begin + set success true + if id -u "$name" &>/dev/null echo "Setup user already exists!" else @@ -74,10 +76,15 @@ function runSetupUserAction -V dir end >"$sudoConfig" and sudo --preserve-env --set-home --user "$name" env "PATH=$PATH" $cmdline - or read -P "An error occurred! Press enter to continue: " + or begin + read -P "An error occurred! Press enter to continue: " + set success false + end + disposeAction rm "$sudoConfig" userdel -rf "$name" + success end end end