aboutsummaryrefslogtreecommitdiffstats
path: root/tools/pygrub/src/GrubConf.py
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2010-05-26 10:52:15 +0100
committerKeir Fraser <keir.fraser@citrix.com>2010-05-26 10:52:15 +0100
commite779c5d7a3731fe160755923c8428307aebcbfc6 (patch)
tree35ecbe342fa6189a47ab12cf17c2e935afda4a68 /tools/pygrub/src/GrubConf.py
parent221bac1943483d40500379d3b049552fd4314e66 (diff)
downloadxen-e779c5d7a3731fe160755923c8428307aebcbfc6.tar.gz
xen-e779c5d7a3731fe160755923c8428307aebcbfc6.tar.bz2
xen-e779c5d7a3731fe160755923c8428307aebcbfc6.zip
pyGrub: Use proper bootloader class when entering command manually
Use the proper bootloader class when entering the boot commands manually (i.e. using the 'c' option). Before this patch the bootloader was always treated to be Grub but when user is using Grub2/ExtLinux or Lilo it's rather confusing. After applying this patch the proper bootloader image class is being used, e.g. Grub2Image for Grub2 etc. when you define the boot commands manually using the 'c' command in pyGrub. Also, fix for using isconfig has been applied since if there is not fs set in the run_grub() method the read_config() would fail since it's trying to access undefined self.cf which is now being set to parser() from cfg_list. Signed-off-by: Michal Novotny <minovotn@redhat.com> Acked-by: Ian Campbell <ian.campbell@citrix.com>
Diffstat (limited to 'tools/pygrub/src/GrubConf.py')
-rw-r--r--tools/pygrub/src/GrubConf.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/pygrub/src/GrubConf.py b/tools/pygrub/src/GrubConf.py
index 51d0c17a4e..0b946d3e46 100644
--- a/tools/pygrub/src/GrubConf.py
+++ b/tools/pygrub/src/GrubConf.py
@@ -252,6 +252,9 @@ class GrubConfigFile(_GrubConfigFile):
def __init__(self, fn = None):
_GrubConfigFile.__init__(self,fn)
+ def new_image(self, title, lines):
+ return GrubImage(title, lines)
+
def parse(self, buf = None):
if buf is None:
if self.filename is None:
@@ -345,7 +348,10 @@ class Grub2Image(_GrubImage):
class Grub2ConfigFile(_GrubConfigFile):
def __init__(self, fn = None):
_GrubConfigFile.__init__(self, fn)
-
+
+ def new_image(self, title, lines):
+ return Grub2Image(title, lines)
+
def parse(self, buf = None):
if buf is None:
if self.filename is None: