ia64/xen-unstable

changeset 15714:fd20c1333e3e

pygrub: LiloConf.py supports root and read-only

LiloConf.py ignores the following options: root and read-only.
This patch fixes the issue.

Signed-off-by: KUWAMURA Shin'ya <kuwa@jp.fujitsu.com>
author kfraser@localhost.localdomain
date Mon Aug 06 10:13:34 2007 +0100 (2007-08-06)
parents f8d5c509f156
children e1435c1f3382
files tools/pygrub/src/LiloConf.py
line diff
     1.1 --- a/tools/pygrub/src/LiloConf.py	Mon Aug 06 10:12:34 2007 +0100
     1.2 +++ b/tools/pygrub/src/LiloConf.py	Mon Aug 06 10:13:34 2007 +0100
     1.3 @@ -18,12 +18,13 @@ class LiloImage(object):
     1.4                  "  initrd: %s\n" %(self.title, self.root, self.kernel,
     1.5                                     self.args, self.initrd))
     1.6      def reset(self, lines, path):
     1.7 -        self._root = self._initrd = self._kernel = self._args = None
     1.8 +        self._initrd = self._kernel = self._readonly = None
     1.9 +        self._args = ""
    1.10          self.title = ""
    1.11          self.lines = []
    1.12          self.path = path
    1.13 +        self.root = ""
    1.14          map(self.set_from_line, lines)
    1.15 -        self.root = "" # dummy
    1.16  
    1.17      def set_from_line(self, line, replace = None):
    1.18          (com, arg) = GrubConf.grub_exact_split(line, 2)
    1.19 @@ -55,6 +56,23 @@ class LiloImage(object):
    1.20          return self._initrd
    1.21      initrd = property(get_initrd, set_initrd)
    1.22  
    1.23 +    def set_args(self, val):
    1.24 +        self._args = val
    1.25 +    def get_args(self):
    1.26 +        args = self._args
    1.27 +        if self.root:
    1.28 +            args += " root=" + self.root
    1.29 +        if self.readonly:
    1.30 +            args += " ro"
    1.31 +        return args
    1.32 +    args = property(get_args, set_args)
    1.33 +
    1.34 +    def set_readonly(self, val):
    1.35 +        self._readonly = 1
    1.36 +    def get_readonly(self):
    1.37 +        return self._readonly
    1.38 +    readonly = property(get_readonly, set_readonly)
    1.39 +
    1.40      # set up command handlers
    1.41      commands = { "label": "self.title",
    1.42                   "root": "self.root",
    1.43 @@ -62,7 +80,7 @@ class LiloImage(object):
    1.44                   "image": "self.kernel",
    1.45                   "initrd": "self.initrd",
    1.46                   "append": "self.args",
    1.47 -                 "read-only": None,
    1.48 +                 "read-only": "self.readonly",
    1.49                   "chainloader": None,
    1.50                   "module": None}
    1.51