From 862d73b03afdc76103a733871c160371c42188b6 Mon Sep 17 00:00:00 2001 From: Darren 'Tadgy' Austin Date: Fri, 22 May 2026 13:41:48 +0100 Subject: [PATCH] Don't run the *-wrapper scripts as root. --- mirror-wrapper | 6 ++++++ sbosrcarch-wrapper | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/mirror-wrapper b/mirror-wrapper index 812479e..0048d49 100755 --- a/mirror-wrapper +++ b/mirror-wrapper @@ -22,6 +22,12 @@ notify() { return 0 } +# Don't run as root! +(( $(id -u) == 0 )) && { + printf "%s: %s\\n" "${0##*/}" "don't run me as root - it messes up permissions!" >&2 + exit 1 +} + # Only allow one copy of the script to run at any time. # shellcheck disable=SC2154 if [[ "$FLOCK" != "$0" ]]; then diff --git a/sbosrcarch-wrapper b/sbosrcarch-wrapper index 9f16a9d..ac0d79e 100755 --- a/sbosrcarch-wrapper +++ b/sbosrcarch-wrapper @@ -21,6 +21,12 @@ notify() { return 0 } +# Don't run as root! +(( $(id -u) == 0 )) && { + printf "%s: %s\\n" "${0##*/}" "don't run me as root - it messes up permissions!" >&2 + exit 1 +} + # Only allow one copy of the script to run at any time. # shellcheck disable=SC2154 if [[ "$FLOCK" != "$0" ]]; then