From 7806aa242099258ede96af14134a6e4dc5352cf4 Mon Sep 17 00:00:00 2001 From: Lucas Decrock Date: Sun, 3 Nov 2024 05:16:43 +0100 Subject: [PATCH] Update install.sh --- install.sh | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/install.sh b/install.sh index 468ba15..2d83a93 100644 --- a/install.sh +++ b/install.sh @@ -171,20 +171,17 @@ if [ -z "$(ps -Al | grep cron | grep -v grep)" ]; then fi fi -# Change to temp directory -cd /tmp || cd / - # Attempt to delete previous agent if [ -f "/etc/$NETWEAK/agent.sh" ]; then - # Remove cron entry and user - if id -u "$NETWEAK" >/dev/null 2>&1; then - (crontab -u "$NETWEAK" -l | grep -v "/etc/$NETWEAK/agent.sh") | crontab -u "$NETWEAK" - && userdel "$NETWEAK" - else - (crontab -u root -l | grep -v "/etc/$NETWEAK/agent.sh") | crontab -u root - - fi - - # Then remove the directory - rm -Rf "/etc/$NETWEAK" + # Remove agent dir + rm -Rf "/etc/$NETWEAK" + + # Remove cron entry and user + if id -u "$NETWEAK" > /dev/null 2>&1; then + (crontab -u "$NETWEAK" -l | grep -v "/etc/$NETWEAK/agent.sh") | crontab -u "$NETWEAK" - && userdel "$NETWEAK" + else + (crontab -u root -l | grep -v "/etc/$NETWEAK/agent.sh") | crontab -u root - + fi fi # Create agent dir