mirror of
https://github.com/keylase/nvidia-patch.git
synced 2024-12-26 22:43:34 +00:00
Merge pull request #80 from Snawoot/drv_path_list
Introduce search list for driver location
This commit is contained in:
commit
62a8c89bbe
20
patch.sh
20
patch.sh
@ -7,7 +7,6 @@ set -euo pipefail ; # <- this semicolon and comment make options apply
|
||||
backup_path="/opt/nvidia/libnvidia-encode-backup"
|
||||
silent_flag=''
|
||||
rollback_flag=''
|
||||
driver_dir='/usr/lib/x86_64-linux-gnu'
|
||||
|
||||
print_usage() { printf '
|
||||
SYNOPSIS
|
||||
@ -36,9 +35,6 @@ if [[ $silent_flag ]]; then
|
||||
exec 1> /dev/null
|
||||
fi
|
||||
|
||||
test -d "$driver_dir" || driver_dir="/usr/lib64" # ..centos
|
||||
test -d "$driver_dir" || { echo "ERROR: cannot detect driver directory"; exit 1; }
|
||||
|
||||
declare -A patch_list=(
|
||||
["375.39"]='s/\x85\xC0\x89\xC5\x75\x18/\x29\xC0\x89\xC5\x90\x90/g'
|
||||
["390.77"]='s/\x85\xC0\x89\xC5\x75\x18/\x29\xC0\x89\xC5\x90\x90/g'
|
||||
@ -106,6 +102,22 @@ fi
|
||||
patch="${patch_list[$driver_version]}"
|
||||
object="${object_list[$driver_version]}"
|
||||
|
||||
declare -a driver_locations=(
|
||||
'/usr/lib/x86_64-linux-gnu'
|
||||
'/usr/lib64'
|
||||
"/usr/lib/nvidia-${driver_version%%.*}"
|
||||
)
|
||||
|
||||
dir_found=''
|
||||
for driver_dir in "${driver_locations[@]}" ; do
|
||||
if [[ -e "$driver_dir/$object.$driver_version" ]]; then
|
||||
dir_found='true'
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
[[ "$dir_found" ]] || { echo "ERROR: cannot detect driver directory"; exit 1; }
|
||||
|
||||
if [[ $rollback_flag ]]; then
|
||||
if [[ -f "$backup_path/$object.$driver_version" ]]; then
|
||||
cp -p "$backup_path/$object.$driver_version" \
|
||||
|
Loading…
Reference in New Issue
Block a user