[PATCH] Warn instead of dying if grub refers to non-existent kernel
--- .gnulib | 2 +- perl/lib/Sys/Guestfs/Lib.pm | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.gnulib b/.gnulib index e2843e3..6d28070 160000 --- a/.gnulib +++ b/.gnulib @@ -1 +1 @@ -Subproject commit e2843e30e8c2885eb8cbc77e20c4e0f4d562d44d +Subproject commit 6d28070c3cc7a02107bf66402983b9fe4c6f8f6f 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.6.6.1
On Fri, May 07, 2010 at 02:58:32PM +0100, Matthew Booth wrote:
--- .gnulib | 2 +- perl/lib/Sys/Guestfs/Lib.pm | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/.gnulib b/.gnulib index e2843e3..6d28070 160000 --- a/.gnulib +++ b/.gnulib @@ -1 +1 @@ -Subproject commit e2843e30e8c2885eb8cbc77e20c4e0f4d562d44d +Subproject commit 6d28070c3cc7a02107bf66402983b9fe4c6f8f6f
Don't wanna revert to the old gnulib here ...
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); + }
ACK. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://et.redhat.com/~rjones/libguestfs/ See what it can do: http://et.redhat.com/~rjones/libguestfs/recipes.html
On 07/05/10 15:17, Richard W.M. Jones wrote:
On Fri, May 07, 2010 at 02:58:32PM +0100, Matthew Booth wrote:
--- .gnulib | 2 +- perl/lib/Sys/Guestfs/Lib.pm | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/.gnulib b/.gnulib index e2843e3..6d28070 160000 --- a/.gnulib +++ b/.gnulib @@ -1 +1 @@ -Subproject commit e2843e30e8c2885eb8cbc77e20c4e0f4d562d44d +Subproject commit 6d28070c3cc7a02107bf66402983b9fe4c6f8f6f
Don't wanna revert to the old gnulib here ...
Eurgh. Why doesn't gnulib get updated with everything else? With the complexity it adds to the build, it's way more hassle than it's worth. Matt -- Matthew Booth, RHCA, RHCSS Red Hat Engineering, Virtualisation Team M: +44 (0)7977 267231 GPG ID: D33C3490 GPG FPR: 3733 612D 2D05 5458 8A8A 1600 3441 EA19 D33C 3490
participants (2)
-
Matthew Booth -
Richard W.M. Jones