From 65a022155741d39b210d568b75fb831d2dbb40f6 Mon Sep 17 00:00:00 2001 From: bruno Date: Sat, 25 Jul 2026 10:09:31 -0400 Subject: [PATCH] fix: add root privilege check to install-gitea-runner.sh - Exits early with clear error if not run as root - Suggests 'doas' on Alpine, 'sudo' on Debian/Arch - Prevents silent failure from apk add / apt-get requiring root --- scripts/install-gitea-runner.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/scripts/install-gitea-runner.sh b/scripts/install-gitea-runner.sh index bfa1b97..73cf870 100755 --- a/scripts/install-gitea-runner.sh +++ b/scripts/install-gitea-runner.sh @@ -26,6 +26,17 @@ if [ -z "$TOKEN" ] || [ -z "$NAME" ] || [ -z "$LABELS" ]; then exit 1 fi +# ── 0. Require root ──────────────────────────────────────────────── +if [ "$(id -u)" -ne 0 ]; then + echo "❌ This script must be run as root." + if [ -f /etc/alpine-release ]; then + echo " Use: doas $0 $*" + else + echo " Use: sudo $0 $*" + fi + exit 1 +fi + # ── 0. Detect OS + privilege elevation method ────────────────────── if [ -f /etc/alpine-release ]; then OS="alpine"