From 6d816bb074a032f85fa7bb68f985684f500c67ef Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Mon, 9 Nov 2009 11:14:11 +0000 Subject: use bootloader module to find kernel (gdium friendly) --- lib/MDV/Draklive/Live.pm | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'lib') 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 { -- cgit v1.2.1