fix: add root privilege check to install-gitea-runner.sh
CI / lint (push) Successful in 25s
CI / security (push) Successful in 13s
CI / test (push) Successful in 27s
CI / build (push) Successful in 10s
CI / e2e (push) Failing after 20s

- 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
This commit is contained in:
2026-07-25 10:09:31 -04:00
parent b2e9b8aecc
commit 65a0221557
+11
View File
@@ -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"