Properly sort kernel versions

This commit is contained in:
Zach Dykstra 2020-01-18 22:01:22 -06:00
parent 615c89e412
commit 0ca82033e9
2 changed files with 7 additions and 2 deletions

View File

@ -13,6 +13,7 @@ use Config::IniFiles;
use File::Temp qw(tempfile tempdir);
use File::Copy;
use File::Path qw(make_path remove_tree);
use Sort::Versions;
use Data::Dumper;
$Data::Dumper::Indent = 1;
@ -246,9 +247,11 @@ sub latestKernel {
my @prefixes = ( "vmlinux*", "vmlinuz*", "linux*", "kernel*" );
for my $prefix (@prefixes) {
my $glob = join( '/', ( $runConf{bootdir}, $prefix ) );
my @kernels = sort glob($glob);
my @kernels = glob($glob);
next if !@kernels;
return pop @kernels;
for (sort { versioncmp($b, $a) } @kernels ) {
return $_;
};
}
}

2
cpanfile Normal file
View File

@ -0,0 +1,2 @@
requires 'Config::IniFiles';
requires 'Sort::Versions';