if fn is not None:
self.parse()
+ def new_image(self, title, lines):
+ # ExtLinuxImage constructor doesn't have title but since path
+ # is being used by get_{kernel|initrd} functions we pass
+ # empty string rather than None (see lines above)
+ return ExtLinuxImage(lines, "")
+
def parse(self, buf = None):
if buf is None:
if self.filename is None:
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:
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:
def add_image(self, image):
self.images.append(image)
+ def new_image(self, title, lines):
+ # LiloImage constructor doesn't have title but since path
+ # is being used by get_{kernel|initrd} functions we pass
+ # empty string rather than None (see lines above)
+ return LiloImage(lines, "")
+
def _get_default(self):
for i in range(len(self.images)):
if self.images[i].title == self._default:
continue
# if we got boot, then we want to boot the entered image
- img = grub.GrubConf.GrubImage(lines)
+ img = self.cf.new_image("entered", lines)
self.cf.add_image(img)
self.selected_image = len(self.cf.images) - 1
self.isdone = True
if not fs:
# set the config file and parse it
- self.cf.filename = fn
- self.cf.parse()
- return
+ for f,parser in cfg_list:
+ self.cf = parser()
+ self.cf.filename = fn
+ self.cf.parse()
+ return
for f,parser in cfg_list:
if fs.file_exists(f):
if isconfig:
chosencfg = run_grub(file, entry, fs, incfg["args"])
print " kernel: %s" % chosencfg["kernel"]
- if img.initrd:
+ if chosencfg["ramdisk"]:
print " initrd: %s" % chosencfg["ramdisk"]
print " args: %s" % chosencfg["args"]
sys.exit(0)