From 4839d5142ca50818965866287932f9ded14729e6 Mon Sep 17 00:00:00 2001 From: Matthew Booth Date: Fri, 7 May 2010 14:58:32 +0100 Subject: [PATCH] Warn instead of dying if grub refers to non-existent kernel --- perl/lib/Sys/Guestfs/Lib.pm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) 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)) { -- 1.8.3.1