From 2b25626c77a31be041d7ead531c0e7b1da082098 Mon Sep 17 00:00:00 2001 From: ram/haidar <49301219+ramhaidar@users.noreply.github.com> Date: Sat, 14 Nov 2026 17:41:50 +0700 Subject: [PATCH] linux: skip nvidia-smi lookup when driver version is given with -d (#1150) patch_common() looked up nvidia-smi and exited with "nvidia-smi utility not found" before checking the manually entered driver version, so -d could not be used on systems without nvidia-smi (e.g. Batocera). Move the lookup into the branch that detects the version, so -d never touches nvidia-smi. Apply the same change to patch.sh and patch-fbc.sh. Behaviour without -d is unchanged, including the error message when nvidia-smi is missing. Based on #876 by DTJW92, whose patch.sh change could not be merged as-is. Co-authored-by: DTJW92 <96082560+DTJW92@users.noreply.github.com> --- patch-fbc.sh | 12 ++++++------ patch.sh | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/patch-fbc.sh b/patch-fbc.sh index 0f25f72..545a65a 100755 --- a/patch-fbc.sh +++ b/patch-fbc.sh @@ -306,17 +306,17 @@ get_supported_versions () { } patch_common () { - NVIDIA_SMI="$(command -v nvidia-smi || true)" - if [[ ! "$NVIDIA_SMI" ]] ; then - echo 'nvidia-smi utility not found. Probably driver is not installed.' - exit 1 - fi - if [[ "$manual_driver_version" ]]; then driver_version="$manual_driver_version" echo "Using manually entered nvidia driver version: $driver_version" else + NVIDIA_SMI="$(command -v nvidia-smi || true)" + if [[ ! "$NVIDIA_SMI" ]] ; then + echo 'nvidia-smi utility not found. Probably driver is not installed.' + exit 1 + fi + cmd="$NVIDIA_SMI --query-gpu=driver_version --format=csv,noheader,nounits" driver_versions_list=$($cmd) || ( ret_code=$? diff --git a/patch.sh b/patch.sh index ff2e564..c2d9c34 100755 --- a/patch.sh +++ b/patch.sh @@ -345,17 +345,17 @@ get_supported_versions () { } patch_common () { - NVIDIA_SMI="$(command -v nvidia-smi || true)" - if [[ ! "$NVIDIA_SMI" ]] ; then - echo 'nvidia-smi utility not found. Probably driver is not installed.' - exit 1 - fi - if [[ "$manual_driver_version" ]]; then driver_version="$manual_driver_version" echo "Using manually entered nvidia driver version: $driver_version" else + NVIDIA_SMI="$(command -v nvidia-smi || true)" + if [[ ! "$NVIDIA_SMI" ]] ; then + echo 'nvidia-smi utility not found. Probably driver is not installed.' + exit 1 + fi + cmd="$NVIDIA_SMI --query-gpu=driver_version --format=csv,noheader,nounits" driver_versions_list=$($cmd) || ( ret_code=$?