install.sh: prevent user from running this script as root

This commit is contained in:
krolxon 2026-01-01 18:12:58 +05:30
parent b1341a67b1
commit 177845352d
1 changed files with 7 additions and 0 deletions

View File

@ -15,6 +15,13 @@ log() {
"$color" "$(date '+%H:%M:%S')" "$level" '\033[0m' "$*" "$color" "$(date '+%H:%M:%S')" "$level" '\033[0m' "$*"
} }
# Prevent user from running this script as root
if [[ "$EUID" -eq 0 ]]; then
log ERROR "This script must NOT be run as root."
log INFO "If you need elevated privileges, the script will ask for sudo when required."
exit 1
fi
currentDir="$(dirname "$(readlink -f "$0")")" currentDir="$(dirname "$(readlink -f "$0")")"
cd "$currentDir" cd "$currentDir"