Release new version 0.9.29.
[grml2usb.git] / grml2usb
index b84165e..a06ddc3 100755 (executable)
--- a/grml2usb
+++ b/grml2usb
@@ -22,7 +22,7 @@ import uuid
 import struct
 
 # global variables
-PROG_VERSION = "0.9.28"
+PROG_VERSION = "0.9.29"
 MOUNTED = set()  # register mountpoints
 TMPFILES = set() # register tmpfiles
 DATESTAMP = time.mktime(datetime.datetime.now().timetuple()) # unique identifier for syslinux.cfg
@@ -1102,7 +1102,8 @@ def copy_system_files(grml_flavour, iso_mount, target):
 
     squashfs = search_file(grml_flavour + '.squashfs', iso_mount)
     if squashfs is None:
-        logging.critical("Fatal: squashfs file not found")
+        logging.critical("Fatal: squashfs file not found"
+        ", please check that your iso is not corrupt")
         raise CriticalException("error locating squashfs file")
     else:
         squashfs_target = target + '/live/' + grml_flavour + '/'
@@ -1159,22 +1160,30 @@ 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:
+            # read the flavours from the iso image
             iso_versions = {}
             iso_file = open(iso_grml_version_file, 'r')
             for line in iso_file:
                 iso_versions[get_flavour(line)] = line.strip()
 
+            # update the existing flavours on the target
             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]
+                    print iso_versions.pop(flavour)
                 else:
                     print line.strip()
+            fileinput.close()
+
+            target_file = open(target_grml_version_file, 'a')
+            # add the new flavours from the current iso
+            for flavour in iso_versions:
+                target_file.write("%s\n" % iso_versions[flavour])
         except IOError:
             logging.warn("Warning: Could not write file")
         finally:
             iso_file.close()
-            fileinput.close()
+            target_file.close()
         return True
     else:
         return False
@@ -1914,6 +1923,8 @@ def install_grml(mountpoint, device):
     try:
         grml_flavours = identify_grml_flavour(mountpoint)
         for flavour in set(grml_flavours):
+            if not flavour:
+                logging.warning("No valid flavour found, please check your iso")
             logging.info("Identified grml flavour \"%s\".", flavour)
             install_iso_files(flavour, mountpoint, device, device_mountpoint)
             GRML_FLAVOURS.add(flavour)