blob: 95981e3199cb00542672eb54b6cc78d3892a9520 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#!/bin/bash
# Copyright 2025 Christoph Willing, Sydney Australia
# All rights reserved
# If an nvidia module has been installed for a previous kernel version,
# update the nvidia kernel module for the new kernel.
#
# Requires: dkms
[ -z $KERNEL_VERSION ] && {
echo " No KERNEL_VERSION provided. Exiting now."
exit
}
echo "Checking status of nvidia kernel module ..."
if [ -x /usr/sbin/dkms ]; then
# Find existing nvidia module
NVIDIA_MODULE=$(dkms status |grep nvidia |tail -1|cut -d',' -f1)
# If there is a previously installed nvidia module
if [ x"$NVIDIA_MODULE" = "x" ]; then
echo "No DKMS installed Nvidia kernel module found."
else
echo " Found NVIDIA_MODULE = $NVIDIA_MODULE"
# Is it already installed for this kernel version?
if [ "$(dkms status -m nvidia -k $KERNEL_VERSION |cut -d' ' -f 4)" = "installed" ]; then
# Nothing to do
echo " Module $NVIDIA_MODULE is already installed for kernel $KERNEL_VERSION"
else
# Update Nvidia kernel module for new kernel version
echo " Installing NVIDIA_MODULE $NVIDIA_MODULE for kernel version $KERNEL_VERSION"
dkms install $NVIDIA_MODULE -k $KERNEL_VERSION
fi
fi
fi
|