Commit f7b822eb authored by Samir Noir's avatar Samir Noir 🧀

Merge branch 'bugs/#12482' into 'master'

Correctly set the kernel to use when creating Debian images

See merge request !70
parents 98aa56d6 26bab2b0
Facter.add(:installed_kernelreleases) do
setcode do
kernels = Dir.glob('/boot/{vmlinuz,vmlinux}-*')
kernels.sort_by! do |k|
m = /^\/boot\/vmlinu[zx]-(\d+)\.(\d+)\.(\d+)(_|-)(\d+).*$/.match(k)
[m[1].to_i, m[2].to_i, m[3].to_i, m[5].to_i]
end
kernels.map { |k| k.gsub(/\/boot\/vmlinu[zx]-(\d+\.\d+\.\d+(_|-)\d+.*)/, '\1') }
end
end
......@@ -29,7 +29,7 @@ class env::big::configure_nvidia_gpu::drivers () {
user => root,
require => Package['module-assistant'];
'install_nvidia_driver':
command => "/tmp/NVIDIA-Linux.run -qa --no-cc-version-check --ui=none --dkms; /bin/rm /tmp/NVIDIA-Linux.run",
command => "/tmp/NVIDIA-Linux.run -qa --no-cc-version-check --ui=none --dkms -k ${installed_kernelreleases[-1]}; /bin/rm /tmp/NVIDIA-Linux.run",
timeout => 1200, # 20 min,
user => root,
require => [Exec['prepare_kernel_module_build'], File['/tmp/NVIDIA-Linux.run'], Package['dkms']];
......
......@@ -2,6 +2,10 @@
class env::min ( $variant = "min", $parent_parameters = {} ) {
stage { 'last':
require => Stage['main'],
}
$min_parameters = {
misc_root_pwd => '$1$qzZwnZXQ$Ak1xs7Oma6HUHw/xDJ8q91',
}
......
......@@ -11,4 +11,8 @@ class env::min::configure_kernel_and_blacklist_some_modules {
# initramfs regeneration declaration
include env::min::kernel::initramfs
# Remove old kernel if exist: it can happen that the running kernel (the installer's one) is not the most recent (installed after upgrade)
class { 'env::min::kernel::remove_old':
stage => last,
}
}
class env::min::kernel::remove_old {
# Remove the current kernel if it's not the last one
if $kernelrelease != $installed_kernelreleases[-1] {
package { "linux-image-$kernelrelease":
ensure => 'purged'
}
file {
"/lib/modules/$kernelrelease":
ensure => absent,
force => true;
"/usr/lib/modules/$kernelrelease":
ensure => absent,
force => true;
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment