be167619bc
24000-pygrub-grub2.patch 24001-pygrub-grub2.patch 24002-pygrub-grub2.patch OBS-URL: https://build.opensuse.org/package/show/Virtualization/xen?expand=0&rev=191
56 lines
1.8 KiB
Diff
56 lines
1.8 KiB
Diff
# HG changeset patch
|
|
# User Michael Young <m.a.young@durham.ac.uk>
|
|
# Date 1319566806 -3600
|
|
# Node ID 152049468175f29a3792b3b60e09a841f9cd2c21
|
|
# Parent 65679fee01778aec2dbe9988959da6b57c52d6c9
|
|
pygrub: cope with configurations with submenus
|
|
|
|
The grub2 configuration file in Fedora 16 can have one or more
|
|
menuentrys in a submenu, with configuration of the form
|
|
submenu "Xen 4.1" {
|
|
menuentry ... {
|
|
...
|
|
}
|
|
}
|
|
(this example occurs when the xen hypervisor is installed on the
|
|
guest)
|
|
|
|
Ignore the submenu line and the corresponding }
|
|
|
|
Signed-off-by: Michael Young <m.a.young@durham.ac.uk>
|
|
Acked-by: Ian Campbell <ian.campbell@citrix.com>
|
|
|
|
Index: xen-4.1.2-testing/tools/pygrub/src/GrubConf.py
|
|
===================================================================
|
|
--- xen-4.1.2-testing.orig/tools/pygrub/src/GrubConf.py
|
|
+++ xen-4.1.2-testing/tools/pygrub/src/GrubConf.py
|
|
@@ -370,6 +370,7 @@ class Grub2ConfigFile(_GrubConfigFile):
|
|
in_function = False
|
|
img = None
|
|
title = ""
|
|
+ menu_level=0
|
|
for l in lines:
|
|
l = l.strip()
|
|
# skip blank lines
|
|
@@ -396,10 +397,18 @@ class Grub2ConfigFile(_GrubConfigFile):
|
|
img = []
|
|
title = title_match.group(1)
|
|
continue
|
|
-
|
|
+
|
|
+ if l.startswith("submenu"):
|
|
+ menu_level += 1
|
|
+ continue
|
|
+
|
|
if l.startswith("}"):
|
|
if img is None:
|
|
- raise RuntimeError, "syntax error: closing brace without menuentry"
|
|
+ if menu_level > 0:
|
|
+ menu_level -= 1
|
|
+ continue
|
|
+ else:
|
|
+ raise RuntimeError, "syntax error: closing brace without menuentry"
|
|
|
|
self.add_image(Grub2Image(title, img))
|
|
img = None
|