Update patch.sh

This commit is contained in:
DTJW92 2024-12-14 04:06:34 +00:00 committed by GitHub
parent ff838cf887
commit be27a30dff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -289,26 +289,28 @@ patch_common () {
driver_version="$manual_driver_version"
echo "Using manually entered nvidia driver version: $driver_version"
fi
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
else
cmd="$NVIDIA_SMI --query-gpu=driver_version --format=csv,noheader,nounits"
driver_versions_list=$($cmd) || (
ret_code=$?
echo "Can not detect nvidia driver version."
echo "CMD: \"$cmd\""
echo "Result: \"$driver_versions_list\""
echo "nvidia-smi retcode: $ret_code"
# Try to detect nvidia-smi, but don't exit if it's not found
NVIDIA_SMI="$(command -v nvidia-smi || true)"
if [[ ! "$NVIDIA_SMI" ]] ; then
echo 'nvidia-smi utility not found. Probably driver is not installed.'
exit 1
)
driver_version=$(echo "$driver_versions_list" | head -n 1)
else
cmd="$NVIDIA_SMI --query-gpu=driver_version --format=csv,noheader,nounits"
driver_versions_list=$($cmd) || (
ret_code=$?
echo "Can not detect nvidia driver version."
echo "CMD: \"$cmd\""
echo "Result: \"$driver_versions_list\""
echo "nvidia-smi retcode: $ret_code"
exit 1
)
driver_version=$(echo "$driver_versions_list" | head -n 1)
echo "Detected nvidia driver version: $driver_version"
echo "Detected nvidia driver version: $driver_version"
fi
fi
if ! check_version_supported "$driver_version" ; then
@ -357,9 +359,9 @@ patch_common () {
done
[[ "$dir_found" ]] || { echo "ERROR: cannot detect driver directory"; exit 1; }
}
ensure_bytes_are_valid () {
driver_file="$driver_dir/$object.$driver_version"
original_bytes=$(awk -F / '$2 { print $2 }' <<< "$patch")