Skip to content

Commit

Permalink
Make gpu dkms autoinstall only nvidia and for the current kernel
Browse files Browse the repository at this point in the history
Also fix the onlyif, so if the kernel is upgraded, DKMS will run
again.
  • Loading branch information
cmd-ntrf committed Mar 14, 2024
1 parent f6ea1c4 commit 84c07b9
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions site/profile/manifests/gpu.pp
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,20 @@

if ! $facts['nvidia_grid_vgpu'] {
include profile::gpu::install::passthrough
Class['profile::gpu::install::passthrough'] -> Exec['dkms autoinstall']
Class['profile::gpu::install::passthrough'] -> Exec['dkms_nvidia']
} else {
include profile::gpu::install::vgpu
Class['profile::gpu::install::vgpu'] -> Exec['dkms autoinstall']
Class['profile::gpu::install::vgpu'] -> Exec['dkms_nvidia']
}

# Binary installer do not build drivers with DKMS
$installer = lookup('profile::gpu::install::vgpu::installer', undef, undef, '')
$nvidia_kmod = ['nvidia', 'nvidia_drm', 'nvidia_modeset', 'nvidia_uvm']
if ! $facts['nvidia_grid_vgpu'] or $installer != 'bin' {
exec { 'dkms autoinstall':
exec { 'dkms_nvidia':
command => "dkms autoinstall -m nvidia -k ${facts['kernelrelease']}",
path => ['/usr/bin', '/usr/sbin'],
onlyif => 'dkms status | grep -v -q \'nvidia.*installed\'',
onlyif => "dkms status -m nvidia -k ${facts['kernelrelease']} | grep -v -q installed",
timeout => 0,
before => Kmod::Load[$nvidia_kmod],
require => [
Expand Down

0 comments on commit 84c07b9

Please sign in to comment.