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
This commit is contained in:
Guido Günther
2010-02-23 20:42:48 +01:00
committed by Richard Jones
parent 4ff21ceb25
commit d070a017f7

View File

@@ -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";