From d23b6c290961bbc3198306254dec5fa8a78b539d Mon Sep 17 00:00:00 2001 From: cclohmar Date: Sat, 11 Jul 2026 00:14:55 +0100 Subject: [PATCH] nextwks.sh: auto-escalate to root via sudo instead of erroring out --- tools/nextwks.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tools/nextwks.sh b/tools/nextwks.sh index 1ca5b32..af717ff 100755 --- a/tools/nextwks.sh +++ b/tools/nextwks.sh @@ -21,11 +21,10 @@ usage() { MODE="${1#--}" case "$MODE" in install|update|destroy) ;; *) usage ;; esac -# --- Must be root --- +# --- Auto-escalate to root if not already --- if [ "$(id -u)" -ne 0 ]; then - echo "ERROR: This script must be run as root (use sudo)." - echo " sudo bash ~/nextwks.sh --$MODE" - exit 1 + echo "[*] Escalating to root..." + exec sudo bash "$(realpath "$0")" "$@" fi # --- Load existing env (if any) ---