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>
This commit is contained in:
ram/haidar
2026-11-14 17:41:50 +07:00
committed by GitHub
parent 97341d3e60
commit 2b25626c77
2 changed files with 12 additions and 12 deletions

View File

@@ -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=$?

View File

@@ -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=$?