From 1a1f0f6d38f5a4c970d3c33d1ed16351d492189f Mon Sep 17 00:00:00 2001 From: Meo597 <197331664+Meo597@users.noreply.github.com> Date: Sat, 12 Apr 2025 00:40:41 +0800 Subject: [PATCH] Alpine: check root --- alpinelinux/install-release.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/alpinelinux/install-release.sh b/alpinelinux/install-release.sh index 5a492fe..753f0a2 100644 --- a/alpinelinux/install-release.sh +++ b/alpinelinux/install-release.sh @@ -66,6 +66,16 @@ check_alpine() { fi } +check_if_running_as_root() { + # If you want to run as another user, please modify $EUID to be owned by this user + if [ "$(id -u)" -eq 0 ]; then + return 0 + else + echo "error: You must run this script as root!" + return 1 + fi +} + install_software() { if [[ -n "$(command -v curl)" ]]; then return @@ -192,6 +202,7 @@ information() { main() { check_alpine || return 1 + check_if_running_as_root || return 1 install_software download_xray verification_xray