From: Matthew Booth Date: Fri, 7 May 2010 13:58:32 +0000 (+0100) Subject: Warn instead of dying if grub refers to non-existent kernel X-Git-Tag: 1.3.10~10 X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=4839d5142ca50818965866287932f9ded14729e6;p=libguestfs.git Warn instead of dying if grub refers to non-existent kernel --- diff --git a/perl/lib/Sys/Guestfs/Lib.pm b/perl/lib/Sys/Guestfs/Lib.pm index b6c4a31..8ec487d 100644 --- a/perl/lib/Sys/Guestfs/Lib.pm +++ b/perl/lib/Sys/Guestfs/Lib.pm @@ -1643,8 +1643,14 @@ sub _check_for_kernels } $config{cmdline} = join(' ', @args) if(scalar(@args) > 0); - my $kernel = - inspect_linux_kernel($g, $path, $os->{package_format}); + my $kernel; + if ($g->exists($path)) { + $kernel = + inspect_linux_kernel($g, $path, $os->{package_format}); + } else { + warn __x("grub refers to {path}, which doesn't exist\n", + path => $path); + } # Check the kernel was recognised if(defined($kernel)) {