From: Guido Günther Date: Tue, 23 Feb 2010 19:42:48 +0000 (+0100) Subject: check for grub/menu.lst too X-Git-Tag: 1.0.85~7 X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=d070a017f710244908617eaa8fa147bc335aa660;p=libguestfs.git 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?= Date: Tue, 23 Feb 2010 19:50:40 +0100 Subject: [PATCH] Check for grub/menu.lst if /etc/grub.conf can't be found --- diff --git a/perl/lib/Sys/Guestfs/Lib.pm b/perl/lib/Sys/Guestfs/Lib.pm index e17728d..2864bfa 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";