Last active
June 12, 2016 07:44
-
-
Save eladc/30c08a97663ff2c30fb12a7a8d95742d to your computer and use it in GitHub Desktop.
Download and install Latest NVIDIA driver on Debian based OS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
## this script is for Debian\Ubuntu. | |
## Check if root | |
if [ ! $UID = 0 ]; then | |
echo "This script needs super user privileges to run" | |
echo "run it againg using sudo or login as root" | |
exit 1 | |
fi | |
## Stop the DM: | |
service lightdm stop | |
service gdm stop | |
service kdm stop | |
## remove existing drivers, install dkms | |
apt-get update | |
apt-get purge nvidia* | |
apt-get install dkms | |
## Get file name | |
LATEST_FILE="ftp://download.nvidia.com/XFree86/Linux-x86_64/latest.txt" | |
BASE_URL="http://uk.download.nvidia.com/XFree86/Linux-x86_64" | |
## Check curl || wget | |
if [ -f /usr/bin/curl ]; then | |
function dl_name() { | |
curl -s "$1" | |
} | |
function dl() { | |
curl -o "$2" "$1" | |
} | |
elif [ -f /usr/bin/wget ]; then | |
function dl_name() { | |
wget -q -O - "$1" | |
} | |
function dl() { | |
wget -O $2 $1 | |
} | |
fi | |
PATH_LATEST="$(dl_name $LATEST_FILE | cut -d" " -f2)" | |
FILE_NAME="$(basename $PATH_LATEST)" | |
FILE_URL="$BASE_URL/$PATH_LATEST" | |
## Download | |
dl "$FILE_URL" "$FILE_NAME" | |
## Execute | |
chmod +x "$FILE_NAME" | |
sh "$FILE_NAME" | |
## Reboot | |
echo "Reboot your system.." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment