Created
September 4, 2017 06:23
-
-
Save thomasjo/6b6b200338f2cc4d2345cb224b12d10a to your computer and use it in GitHub Desktop.
Linux kernel post-installation script for re-installing the NVIDIA (CUDA) driver.
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 | |
set -eu | |
KERNEL_DRIVER="/lib/modules/$1/kernel/drivers/video/nvidia.ko" | |
INSTALLER="/usr/src/cuda-toolkit" | |
# Build new driver if it doesn't exist | |
if [ -e $KERNEL_DRIVER ] ; then | |
echo "NVIDIA driver already installed for this kernel" >&2 | |
exit 0 | |
fi | |
echo "Re-installing NVIDIA driver for kernel $1..." >&2 | |
sh $INSTALLER --silent --driver --no-opengl-libs 2>1 > /dev/null | |
if [ -e $KERNEL_DRIVER ] ; then | |
echo "Driver succesfully installed for kernel $1" >&2 | |
else | |
echo "Driver installation failed! See /var/log/nvidia-installer.log" >&2 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment