summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/MDV/Draklive/Live.pm14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/MDV/Draklive/Live.pm b/lib/MDV/Draklive/Live.pm
index 35fbf03..f356b33 100644
--- a/lib/MDV/Draklive/Live.pm
+++ b/lib/MDV/Draklive/Live.pm
@@ -30,13 +30,15 @@ sub get_media_prefix {
sub find_kernel {
my ($live) = @_;
- my $kernel = $live->{system}{kernel};
- unless ($kernel) {
- my $vmlinuz = readlink($live->get_system_root . '/boot/vmlinuz');
- $vmlinuz ||= find { -e $_ && ! -l $_ } glob_($live->get_system_root . '/boot/vmlinuz-*');
- ($kernel) = $vmlinuz =~ /\bvmlinuz-(.*)$/ or die "no kernel can be found\n";
+ require bootloader;
+ local $::prefix = $live->get_system_root;
+ my @kernels = bootloader::get_kernels_and_labels();
+ my $kernel;
+ if ($live->{system}{kernel}) {
+ $kernel = find { $_->{version} eq $live->{system}{kernel} } @kernels;
+ $kernel or die "kernel $live->{system}{kernel} can not be found\n";
}
- { version => $kernel };
+ $kernel ||= first(@kernels) or die "no kernel can be found\n";
}
sub get_lib_prefix {