]> git.proxmox.com Git - pve-installer.git/commitdiff
detect kernel api version dynamically
authorDietmar Maurer <dietmar@proxmox.com>
Tue, 21 Nov 2017 06:56:54 +0000 (07:56 +0100)
committerDietmar Maurer <dietmar@proxmox.com>
Tue, 21 Nov 2017 06:56:54 +0000 (07:56 +0100)
proxinstall

index c4b506c1be5b7ba489e4f94c6c35cc9b57466a91..a1c3dc6967fbdb98f0fa2e5be435163e4300267d 100755 (executable)
@@ -24,10 +24,6 @@ use ProxmoxInstallerSetup;
 
 my $setup = ProxmoxInstallerSetup::setup();
 
-
-my $kapi = `uname -r`;
-chomp $kapi;
-
 my $opt_testmode;
 
 if (!$ENV{G_SLICE} ||  $ENV{G_SLICE} ne "always-malloc") {
@@ -1539,6 +1535,15 @@ _EOD
        diversion_remove ($targetdir, "/usr/sbin/update-grub");
        diversion_remove ($targetdir, "/usr/sbin/update-initramfs");
 
+       my $kapi;
+       foreach my $fn (<$targetdir/lib/modules/*>) {
+           if ($fn =~ m!/(\d+\.\d+\.\d+-\d+-pve)$!) {
+               die "found multiple kernels\n" if defined($kapi);
+               $kapi = $1;
+           }
+       }
+       die "unable to detect kernel version\n" if !defined($kapi);
+
        if (!$opt_testmode) {
 
            unlink ("$targetdir/etc/mtab");