Fix NVIDIA driver download for TrueNAS Scale Dragonfish
The previous fix had a few bugs. Because this is executed with `set -e`, the wget will cause the init process to fail if the url does not exist. Also, the github path was looking at an aarch64 download Closes #156
This commit is contained in:
@@ -30,22 +30,29 @@ export amd_gpu_model="$(lspci | grep -i vga | grep -i amd)"
|
||||
|
||||
|
||||
function download_driver {
|
||||
local driver_url
|
||||
local stripped_version
|
||||
|
||||
mkdir -p "${USER_HOME:?}/Downloads"
|
||||
chown -R ${USER:?} "${USER_HOME:?}/Downloads"
|
||||
|
||||
if [[ ! -f "${USER_HOME:?}/Downloads/NVIDIA_${nvidia_host_driver_version:?}.run" ]]; then
|
||||
print_step_header "Downloading driver v${nvidia_host_driver_version:?}"
|
||||
wget -q --show-progress --progress=bar:force:noscroll \
|
||||
-O /tmp/NVIDIA.run \
|
||||
"http://download.nvidia.com/XFree86/Linux-x86_64/${nvidia_host_driver_version:?}/NVIDIA-Linux-x86_64-${nvidia_host_driver_version:?}.run"
|
||||
if [[ $? -gt 0 ]]; then
|
||||
print_error "Unable to download driver from NVIDIA. Trying GitHub..."
|
||||
# Strip the 'v' from the version if present (v545.23.08 -> 545.23.08)
|
||||
local stripped_version="${nvidia_host_driver_version#v}"
|
||||
driver_url="http://download.nvidia.com/XFree86/Linux-x86_64/${nvidia_host_driver_version:?}/NVIDIA-Linux-x86_64-${nvidia_host_driver_version:?}.run"
|
||||
if wget --spider --quiet "${driver_url:?}"; then
|
||||
wget -q --show-progress --progress=bar:force:noscroll \
|
||||
-O /tmp/NVIDIA.run \
|
||||
"https://github.com/flathub/org.freedesktop.Platform.GL.nvidia/releases/download/cuda/NVIDIA-Linux-aarch64-${stripped_version}.run"
|
||||
if [[ $? -gt 0 ]]; then
|
||||
"${driver_url:?}"
|
||||
else
|
||||
print_warning "Unable to download driver from NVIDIA. Trying GitHub..."
|
||||
# Strip the 'v' from the version if present (v545.23.08 -> 545.23.08)
|
||||
stripped_version="${nvidia_host_driver_version#v}"
|
||||
driver_url="https://github.com/flathub/org.freedesktop.Platform.GL.nvidia/releases/download/cuda/NVIDIA-Linux-x86_64-${stripped_version:?}.run"
|
||||
if wget --spider --quiet "${driver_url:?}"; then
|
||||
wget -q --show-progress --progress=bar:force:noscroll \
|
||||
-O /tmp/NVIDIA.run \
|
||||
"${driver_url:?}"
|
||||
else
|
||||
print_error "Unable to download driver from GitHub. Exit!"
|
||||
return 1
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user