[CentOS] DKMS and new(er) Nvidia-drivers
Alfred von Campe
alfred at von-campe.com
Tue Apr 14 17:50:37 UTC 2009
FWIW, I don't use DKMS but this homegrown script instead. I put
whatever version of the driver I want to deploy (currently NVIDIA-
Linux-x86-180.44-pkg1.run) in a network accessible location and
create a link named NVIDIA-Linux-x86-latest to it. The script then
handles the rest.
Alfred
#!/bin/sh
#
# This script checks to ensure that the NVIDIA driver has been
# installed (it's needed for every new kernel)
# chkconfig: 345 50 98
# description: Runs the NVIDIA installer if needed
# Source function library.
. /etc/init.d/functions
script=/tmp/nvidia-config-$$.sh
installer=/network/path/to/NVIDIA-Linux-x86-latest
# Function to check if NVIDIA card is present on this system
nvidia_card_present() {
/sbin/lspci | grep -qi nvidia
return $?
}
# Function to check if NVIDIA kernel module has been installed
nvidia_module_installed() {
if [ -r /lib/modules/`uname -r`/kernel/drivers/video/nvidia.ko ];
then
return 0
else
return 1
fi
}
# See how we were called.
case "$1" in
start|restart)
if nvidia_card_present; then
if nvidia_module_installed; then
action "Configuring NVIDIA driver: " /bin/true
else
if [ -x $installer ]; then
/bin/echo "#!/bin/sh" > $script
/bin/echo "$installer -s -X &> /tmp/nvidia-install-\$\$.log
2>&1" >> $script
/bin/chmod +x $script
action "Configuring NVIDIA driver: " $script
/bin/rm -f $script
else
action "Configuring NVIDIA driver: " /bin/false
fi
fi
else
action "Configuring NVIDIA driver: " /bin/true
fi
;;
stop)
# Nothing to do
;;
status)
if nvidia_card_present; then
if nvidia_module_installed; then
/bin/echo "The NVIDIA driver has been installed successfully"
else
/bin/echo "The NVIDIA driver has not been installed successfully"
fi
else
/bin/echo "The NVIDIA driver is not required on this system"
fi
;;
*)
/bin/echo "Usage: `basename "$0"` {start|stop|status|restart}"
exit 1
esac
exit 0
More information about the CentOS
mailing list