From e46daf49c69b28c2bf704cc6fbf6a7dae143a1c9 Mon Sep 17 00:00:00 2001 From: "Igor B. Poretsky" Date: Wed, 26 Nov 2025 17:11:57 +0300 Subject: [PATCH] Initialize sudo reference before its first actual use --- docs/static/install.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/static/install.sh b/docs/static/install.sh index 503079305126..2f2ef5d8fcff 100755 --- a/docs/static/install.sh +++ b/docs/static/install.sh @@ -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