xcp-1.6-updates/xen-4.1.hg

changeset 23207:95a0e0b47e95

pygrub: fix extlinux parsing

pygrub was unable to parse extlinux config files correctly, exactly
the ones like:

LABEL grsec
KERNEL vmlinuz-3.0.10-grsec
APPEND initrd=initramfs-3.0.10-grsec
root=UUID=cfd4a7b4-8c40-4025-b877-8205f1c622ee
modules=sd-mod,usb-storage,ext4 xen quiet

This patch fixes it, adding a new case when parsing the "append" line,
that searches for the initrd image.

Signed-off-by: Roger Pau Monne <roger.pau@entel.upc.edu>
Acked-by: Ian Campbell <ian.campbell.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>

xen-unstable changeset: 24460:ff0685e8419b
Backport-requested-by: Roger Pau Monne <roger.pau@entel.upc.edu>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
author Roger Pau Monne <roger.pau@entel.upc.edu>
date Tue Jan 10 16:10:00 2012 +0000 (2012-01-10)
parents 14dbd6be46c8
children ee80c2ef9400
files tools/pygrub/examples/alpine-linux-2.3.2.extlinux tools/pygrub/src/ExtLinuxConf.py
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/tools/pygrub/examples/alpine-linux-2.3.2.extlinux	Tue Jan 10 16:10:00 2012 +0000
     1.3 @@ -0,0 +1,11 @@
     1.4 +DEFAULT menu.c32
     1.5 +PROMPT 0
     1.6 +MENU TITLE Alpine/Linux Boot Menu
     1.7 +MENU HIDDEN
     1.8 +MENU AUTOBOOT Alpine will be booted automatically in # seconds.
     1.9 +TIMEOUT 30
    1.10 +LABEL grsec
    1.11 +  MENU DEFAULT
    1.12 +  MENU LABEL Linux 3.0.10-grsec
    1.13 +  KERNEL vmlinuz-3.0.10-grsec
    1.14 +  APPEND initrd=initramfs-3.0.10-grsec root=UUID=a97ffe64-430f-4fd3-830e-4736d9a27af0 modules=sd-mod,usb-storage,ext4 quiet
     2.1 --- a/tools/pygrub/src/ExtLinuxConf.py	Sun Dec 18 14:52:52 2011 +0000
     2.2 +++ b/tools/pygrub/src/ExtLinuxConf.py	Tue Jan 10 16:10:00 2012 +0000
     2.3 @@ -60,6 +60,13 @@ class ExtLinuxImage(object):
     2.4  
     2.5                  # Bypass regular self.commands handling
     2.6                  com = None
     2.7 +            elif arg.find("initrd="):
     2.8 +                # find initrd image in append line
     2.9 +                args = arg.strip().split(" ")
    2.10 +                for a in args:
    2.11 +                    if a.lower().startswith("initrd="):
    2.12 +                        setattr(self, "initrd", a.replace("initrd=", ""))
    2.13 +                        arg = arg.replace(a, "")
    2.14  
    2.15          if com is not None and self.commands.has_key(com):
    2.16              if self.commands[com] is not None:
    2.17 @@ -86,10 +93,12 @@ class ExtLinuxImage(object):
    2.18          self._args = args
    2.19      def get_kernel(self):
    2.20          return self._kernel
    2.21 +    def set_args(self, val):
    2.22 +        self._args = val
    2.23      def get_args(self):
    2.24          return self._args
    2.25      kernel = property(get_kernel, set_kernel)
    2.26 -    args = property(get_args)
    2.27 +    args = property(get_args, set_args)
    2.28  
    2.29      def set_initrd(self, val):
    2.30          self._initrd = (None,val)