Increrased version number.
[grml2usb.git] / grml2usb
index 8fd6909..7591970 100755 (executable)
--- a/grml2usb
+++ b/grml2usb
@@ -20,7 +20,7 @@ import fileinput
 import glob
 
 # global variables
-PROG_VERSION = "0.9.17-pre1"
+PROG_VERSION = "0.9.19-pre1"
 MOUNTED = set()  # register mountpoints
 TMPFILES = set() # register tmpfiles
 DATESTAMP = time.mktime(datetime.datetime.now().timetuple()) # unique identifier for syslinux.cfg
@@ -32,6 +32,11 @@ def syslinux_warning(option, opt, value, parser):
             "is grml2usb's default. Continuing anyway.\n")
     setattr(parser.values, option.dest, True)
 
+# if grub option is set, unset syslinux option
+def grub_option(option, opt, value, parser):
+    setattr(parser.values, option.dest, True)
+    setattr(parser.values, 'syslinux', False)
+
 # cmdline parsing
 USAGE = "Usage: %prog [options] <[ISO[s] | /live/image]> </dev/sdX#>\n\
 \n\
@@ -56,7 +61,8 @@ parser.add_option("--fat16", dest="fat16", action="store_true",
                   help="format specified partition with FAT16")
 parser.add_option("--force", dest="force", action="store_true",
                   help="force any actions requiring manual interaction")
-parser.add_option("--grub", dest="grub", action="store_true",
+parser.add_option("--grub", dest="grub", action="callback",
+                  callback=grub_option,
                   help="install grub bootloader instead of (default) syslinux")
 parser.add_option("--grub-mbr", dest="grubmbr", action="store_true",
                   help="install grub into MBR instead of (default) PBR")
@@ -945,7 +951,7 @@ def check_for_fat(partition):
             raise CriticalException("Failed to read device %s"
                                     " (wrong UID/permissions or device/directory not present?)" % partition)
 
-        if options.syslinux and filesystem != "vfat":
+        if filesystem != "vfat":
             raise CriticalException("Partition %s does not contain a FAT16 filesystem. (Use --fat16 or run mkfs.vfat %s)" % (partition, partition))
 
     except OSError:
@@ -1708,11 +1714,15 @@ def handle_iso(iso, device):
         register_tmpfile(device_mountpoint)
         remove_device_mountpoint = True
         try:
-            mount(device, device_mountpoint, "")
+            check_for_fat(device)
+            mount(device, device_mountpoint, ['-o', 'utf8,iocharset=iso8859-1'])
         except CriticalException, error:
-            logging.critical("Fatal: %s", error)
-            cleanup()
-            sys.exit(1)
+            try:
+                mount(device, device_mountpoint, "")
+            except CriticalException, error:
+                logging.critical("Fatal: %s", error)
+                cleanup()
+                sys.exit(1)
 
     try:
         try:
@@ -1810,7 +1820,7 @@ def handle_vfat(device):
     # check for vfat filesystem
     if device is not None and not os.path.isdir(device):
         try:
-            check_for_fat(device)
+            if options.syslinux: check_for_fat(device)
         except CriticalException, error:
             logging.critical("Execution failed: %s", error)
             sys.exit(1)