feat(pveupgrade): adding a kernel update

Added removal of old kernels and installation of new kernel versions.'update-kernel' checks if the new kernel is installed correctly and displays a message asking to reboot the system.
This commit is contained in:
Константин Козориз 2024-11-08 12:09:29 +03:00
parent 2ab397b671
commit 3bc3c5d5bb

View File

@ -59,20 +59,13 @@ if (!$st || (time() - $st->mtime) > (3*24*3600)) {
print "Your System is up-to-date\n\n"; print "Your System is up-to-date\n\n";
} }
my $newkernel; print "Removing old kernels...\n";
foreach my $p (@$oldlist) { system('remove-old-kernels');
if (($p->{Package} =~ m/^(?:pve|proxmox)-kernel/) &&
!grep { $_->{Package} eq $p->{Package} } @$pkglist) {
$newkernel = 1;
last;
}
}
if ($newkernel) { print "Updating kernel and modules...\n";
print "\n";
print "Seems you installed a kernel update - Please consider rebooting\n" . # Inside checks for kernel installation and asks for a reboot
"this node to activate the new kernel.\n\n"; system('update-kernel');
}
} }