+ handle_grub2_config(grml_flavour, grub_target, bootopt)
+
+
+def initial_syslinux_config(target):
+ """Generates intial syslinux configuration
+
+ @target path of syslinux's configuration files"""
+
+ target = target + "/"
+ filename = target + "grmlmain.cfg"
+ if os.path.isfile(target + "grmlmain.cfg"):
+ return
+ data = open(filename, "w")
+ data.write(generate_main_syslinux_config())
+ data.close
+
+def adjust_syslinux_bootoptions(src_name, dst_name, flavour):
+ append_re = re.compile("^(\s*append.*)$", re.I)
+ boot_re = re.compile("/boot/([a-zA-Z0-9_]+/)+(\w+)")
+ flavour_re = re.compile("(label.*)(grml\w+)")
+ default_re = re.compile("(default.cfg)")
+ src = open(src_name, "r")
+ dst = open(dst_name, "w")
+
+ for line in src:
+ line = boot_re.sub(r'/boot/release/%s/\2 ' % flavour, line)
+ line = flavour_re.sub(r'\1 %s-\2' % flavour, line)
+ line = default_re.sub(r'%s-\1' % flavour, line)
+ line = append_re.sub(r'\1 live-media-path=/live/%s/ ' % flavour, line)
+ dst.write(line)
+ src.close()
+ dst.close()
+
+
+def add_syslinux_entry(filename, grml_flavour):
+ data = open(filename, "a+")
+ entry_filename = "option-%s.cfg" % grml_flavour
+ entry = "include %s\n" % entry_filename
+ path = os.path.dirname(filename)
+ for line in data:
+ if line == entry:
+ break
+ else:
+ data.write(entry)
+
+ data.close()
+ data = open(path + "/" + entry_filename, "w")
+ data.write(generate_flavour_specific_syslinux_config(grml_flavour))
+ data.close()
+
+