Skip to content

Instantly share code, notes, and snippets.

@smaugfm
Last active June 22, 2024 10:24
Show Gist options
  • Save smaugfm/cb017b23087dfb44a69cf16766cd8191 to your computer and use it in GitHub Desktop.
Save smaugfm/cb017b23087dfb44a69cf16766cd8191 to your computer and use it in GitHub Desktop.
Download and run latest NVIDIA Ubuntu-x64 driver for 10xx series cards
#!/bin/bash
tmpfile=$(mktemp /tmp/abc-script.XXXXXX)
echo "#!/usr/bin/expect" >> $tmpfile
echo "set timeout 3" >> $tmpfile
echo "spawn curl https://www.nvidia.com/download/processFind.aspx?psid=101&pfid=859&osid=12&lid=1&whql=1&lang=en-us&ctk=0&qnfslb=01" >> $tmpfile
echo "expect {" >> $tmpfile
echo "\"</tr>\" { exp_continue }" >> $tmpfile
echo "\"</tr>\" { send \"\\r\" }" >> $tmpfile
echo "}" >> $tmpfile
chmod +x $tmpfile
go install github.com/ericchiang/pup@latest > /dev/null 2>&1
sudo apt -y install expect > /dev/null 2>&1
DRIVER_VERSION=$(expect $tmpfile | pup '#driverList > td:nth-child(3) text{}' | head -n 1)
rm -f tmpfile
echo "Downloading latest NVIDIA driver version: $DRIVER_VERSION"
BASE_URL=https://us.download.nvidia.com/XFree86/Linux-x86_64
FILENAME=NVIDIA-Linux-x86_64-$DRIVER_VERSION.run
curl -fSsl -O $BASE_URL/$DRIVER_VERSION/$FILENAME
chmod +x $FILENAME
sudo ./$FILENAME --dkms
rm -f $FILENAME
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment