X-Git-Url: http://git.grml.org/?p=grml2usb.git;a=blobdiff_plain;f=grml2usb;h=89c1f222c0a237828c29256ff56375f90aab2781;hp=9ac698833849c855c54dcbc2a1c514fd9c7ca465;hb=2a93d92c34ab16af395979b8e4546aa3aa6d5cc9;hpb=875b62bab2a04d2f105f28a5692edc514de04390 diff --git a/grml2usb b/grml2usb index 9ac6988..89c1f22 100755 --- a/grml2usb +++ b/grml2usb @@ -29,6 +29,7 @@ DATESTAMP = time.mktime(datetime.datetime.now().timetuple()) # unique identifier GRML_FLAVOURS = set() # which flavours are being installed? GRML_DEFAULT = None UUID = None +SYSLINUX_LIBS = "/usr/lib/syslinux/" def syslinux_warning(option, opt, value, opt_parser): """A helper function for printing a warning about deprecated option @@ -1123,19 +1124,22 @@ def update_grml_versions(iso_mount, target): logging.warn("Warning: %s could not be found - can not install it", iso_grml_version_file) return False try: - target_file = open(target_grml_version_file, 'a+') - target_flavours = [ get_flavour(l) for l in target_file.readlines() ] - + iso_versions = {} iso_file = open(iso_grml_version_file, 'r') - iso_lines = iso_file.readlines() - for line in iso_lines: - if not get_flavour(line) in target_flavours: - target_file.write(line) + for line in iso_file: + iso_versions[get_flavour(line)] = line.strip() + + for line in fileinput.input([target_grml_version_file], inplace=1): + flavour = get_flavour(line) + if flavour in iso_versions.keys(): + print iso_versions[flavour] + else: + print line.strip() except IOError: logging.warn("Warning: Could not write file") finally: - target_file.close() iso_file.close() + fileinput.close() return True else: return False @@ -1310,9 +1314,13 @@ def copy_bootloader_files(iso_mount, target, grml_flavour): for expr in name, 'distri.cfg', \ defaults_file, 'grml.png', 'hd.cfg', 'isolinux.cfg', 'isolinux.bin', \ 'isoprompt.cfg', 'options.cfg', \ - 'prompt.cfg', 'vesamenu.c32', 'vesamenu.cfg', 'grml.png', '*.c32': + 'prompt.cfg', 'vesamenu.cfg', 'grml.png', '*.c32': glob_and_copy(iso_mount + source_dir + expr, syslinux_target) + for filename in glob.glob1(syslinux_target, "*.c32"): + copy_if_exist(os.path.join(SYSLINUX_LIBS, filename), syslinux_target) + + # copy the addons_*.cfg file to the new syslinux directory glob_and_copy(iso_mount + source_dir + 'addon*.cfg', syslinux_target)