]> git.proxmox.com Git - pmg-api.git/commitdiff
pmg7to8: Add check for dkms modules
authorStoiko Ivanov <s.ivanov@proxmox.com>
Fri, 15 Dec 2023 17:34:12 +0000 (18:34 +0100)
committerStoiko Ivanov <s.ivanov@proxmox.com>
Fri, 15 Dec 2023 18:04:43 +0000 (19:04 +0100)
... and warn if at least one is present and PMG is running not running
in a container.

follows commit 0329876ccf1d78b848897718bb0c2337c6a55fbb in pve-manager

with the change that the dkms check is skipped if
proxmox-mailgateway-container is the installed meta-package (as we do
for the kernel checks).

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
src/PMG/CLI/pmg7to8.pm

index 8cccde1f3cabf9d2243f3b44bd3fb70d073d54de..86ef9032b1fd371abcf4934934df33b4a9c9842a 100644 (file)
@@ -480,6 +480,32 @@ sub check_bootloader {
     }
 }
 
+sub check_dkms_modules {
+    if (defined($get_pkg->('proxmox-mailgateway-container'))) {
+       log_skip("Ignore dkms in containers.");
+       return;
+    }
+
+    log_info("Check for dkms modules...");
+
+    my $count;
+    my $set_count = sub {
+       $count = scalar @_;
+    };
+
+    my $exit_code = eval {
+       run_command(['dkms', 'status', '-k', '`uname -r`'], outfunc => $set_count, noerr => 1)
+    };
+
+    if ($exit_code != 0) {
+       log_skip("could not get dkms status");
+    } elsif (!$count) {
+       log_pass("no dkms modules found");
+    } else {
+       log_warn("dkms modules found, this might cause issues during upgrade.");
+    }
+}
+
 sub check_misc {
     print_header("MISCELLANEOUS CHECKS");
     my $ssh_config = eval { PVE::Tools::file_get_contents('/root/.ssh/config') };
@@ -552,6 +578,7 @@ sub check_misc {
 
     check_apt_repos();
     check_bootloader();
+    check_dkms_modules();
 
     my ($template_dir, $base_dir) = ('/etc/pmg/templates/', '/var/lib/pmg/templates');
     my @override_but_unmodified = ();