fix: Initialize sudo reference before its first actual use (#7360)

This commit is contained in:
Igor B. Poretsky
2025-11-26 18:03:42 +03:00
committed by GitHub
parent f617bec686
commit c0d1d0211f

View File

@@ -877,6 +877,16 @@ if [ "$OS" = "Darwin" ]; then
exit 0
fi
SUDO=
if [ "$(id -u)" -ne 0 ]; then
# Running as root, no need for sudo
if ! available sudo; then
fatal "This script requires superuser permissions. Please re-run as root."
fi
SUDO="sudo"
fi
if check_gpu lspci amdgpu || check_gpu lshw amdgpu; then
HAS_AMD=true
fi
@@ -889,16 +899,6 @@ if check_gpu lspci intel || check_gpu lshw intel; then
HAS_INTEL=true
fi
SUDO=
if [ "$(id -u)" -ne 0 ]; then
# Running as root, no need for sudo
if ! available sudo; then
fatal "This script requires superuser permissions. Please re-run as root."
fi
SUDO="sudo"
fi
PACKAGE_MANAGER=
for PACKAGE_MANAGER in dnf yum apt-get; do
if available $PACKAGE_MANAGER; then