diff options
author | Guido Günther <agx@sigxcpu.org> | 2010-02-23 20:42:48 +0100 |
---|---|---|
committer | Richard Jones <rjones@redhat.com> | 2010-02-24 15:30:41 +0000 |
commit | d070a017f710244908617eaa8fa147bc335aa660 (patch) | |
tree | 9b3cd8ef68daf0567f54a280ca22ba4f8e7b8cc1 | |
parent | 4ff21ceb2561936fc2e204f0a02e6ca8fb8fd507 (diff) | |
download | libguestfs-d070a017f710244908617eaa8fa147bc335aa660.tar.gz libguestfs-d070a017f710244908617eaa8fa147bc335aa660.tar.xz libguestfs-d070a017f710244908617eaa8fa147bc335aa660.zip |
check for grub/menu.lst too
On Tue, Feb 23, 2010 at 08:07:14PM +0100, Guido Günther wrote:
> On Tue, Feb 23, 2010 at 07:52:43PM +0100, Guido Günther wrote:
> > Hi,
> > attached patch makes virt-inspector find the kernels on Debian systems.
> > Since there is no /etc/grub.conf it falls back to
> > $grubpartition/grub/menu.lst.
> Patch got somehow broken. New version fortchcoming. Sorry for the noise.
Attached now. No idea where the 'if' went in the first version ;)
-- Guido
>From d30b4946f017ff8bde9d4ff62f93c418a707d9e8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Guido=20G=C3=BCnther?= <agx@sigxcpu.org>
Date: Tue, 23 Feb 2010 19:50:40 +0100
Subject: [PATCH] Check for grub/menu.lst if /etc/grub.conf can't be found
-rw-r--r-- | perl/lib/Sys/Guestfs/Lib.pm | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/perl/lib/Sys/Guestfs/Lib.pm b/perl/lib/Sys/Guestfs/Lib.pm index e17728d5..2864bfa1 100644 --- a/perl/lib/Sys/Guestfs/Lib.pm +++ b/perl/lib/Sys/Guestfs/Lib.pm @@ -1525,6 +1525,12 @@ sub _check_for_kernels # For every kernel we find, inspect it and add to $os->{kernels} my $grub = _find_grub_prefix($g, $os); + my $grub_conf = "/etc/grub.conf"; + + # Debian and other's have no /etc/grub.conf: + if ( ! -f "$grub_conf" ) { + $grub_conf = "$grub/grub/menu.lst"; + } my @boot_configs; @@ -1544,7 +1550,7 @@ sub _check_for_kernels my @configs = (); # Get all configurations from grub foreach my $bootable - ($g->aug_match("/files/etc/grub.conf/title")) + ($g->aug_match("/files/$grub_conf/title")) { my %config = (); $config{title} = $g->aug_get($bootable); @@ -1617,7 +1623,7 @@ sub _check_for_kernels # Add the default configuration eval { - $boot{default} = $g->aug_get("/files/etc/grub.conf/default"); + $boot{default} = $g->aug_get("/files/$grub_conf/default"); }; if($@) { warn __"No grub default specified"; |