From 6e95c088e443b7027ffccdfb3db8236a31ae3124 Mon Sep 17 00:00:00 2001 From: cclohmar Date: Sat, 11 Jul 2026 00:13:01 +0100 Subject: [PATCH] nextwks.sh: add root check with clear error message --- tools/nextwks.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/nextwks.sh b/tools/nextwks.sh index 86473d0..1ca5b32 100755 --- a/tools/nextwks.sh +++ b/tools/nextwks.sh @@ -21,6 +21,13 @@ usage() { MODE="${1#--}" case "$MODE" in install|update|destroy) ;; *) usage ;; esac +# --- Must be root --- +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 +fi + # --- Load existing env (if any) --- if [ -f "$BACKUP_DIR/.env" ]; then set -a; source "$BACKUP_DIR/.env"; set +a