bsd4grml was not copied correctly to the target device.
[grml2usb.git] / grml2usb
index 6c74a52..092e34d 100755 (executable)
--- 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
@@ -649,12 +650,16 @@ def install_grub(device):
                     grub_device = device
 
                 logging.info("Installing grub as bootloader")
-                logging.debug("grub-install --recheck --force --no-floppy --root-directory=%s %s",
-                              device_mountpoint, grub_device)
-                proc = subprocess.Popen(["grub-install", "--recheck", "--force", "--no-floppy",
-                                         "--root-directory=%s" % device_mountpoint, grub_device],
-                                        stdout=file(os.devnull, "r+"))
-                proc.wait()
+                for opt in ["", "--force" ]:
+                    logging.debug("grub-install --recheck %s --no-floppy --root-directory=%s %s",
+                                  opt, device_mountpoint, grub_device)
+                    proc = subprocess.Popen(["grub-install", "--recheck", opt, "--no-floppy",
+                                             "--root-directory=%s" % device_mountpoint, grub_device],
+                                            stdout=file(os.devnull, "r+"))
+                    proc.wait()
+                    if proc.returncode == 0:
+                        break
+
                 if proc.returncode != 0:
                     # raise Exception("error executing grub-install")
                     logging.critical("Fatal: error executing grub-install "
@@ -1196,7 +1201,7 @@ def handle_addon_copy(filename, dst, iso_mount):
     if file_location is None:
         logging.warn("Warning: %s not found (that's fine if you don't need it)",  filename)
     else:
-        exec_rsync(file_location, dst + filename)
+        exec_rsync(file_location, dst)
 
 
 def copy_addons(iso_mount, target):
@@ -1313,9 +1318,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)