grml2usb docs: drop references to deprecated grml-medium
[grml2usb.git] / grml2usb
index 9a989e3..5ac6e76 100755 (executable)
--- a/grml2usb
+++ b/grml2usb
@@ -64,9 +64,8 @@ RE_P_PARTITION = re.compile(r"(.*?\d+)p(\d+)$")
 RE_LOOP_DEVICE = re.compile(r"/dev/loop\d+$")
 
 
-def syslinux_warning(option, opt, opt_parser):
-    """A helper function for printing a warning about deprecated option
-    """
+def syslinux_warning(option, opt, _value, opt_parser):
+    """A helper function for printing a warning about deprecated option"""
     # pylint: disable-msg=W0613
     sys.stderr.write(
         "Note: the --syslinux option is deprecated as syslinux "
@@ -76,9 +75,8 @@ def syslinux_warning(option, opt, opt_parser):
 
 
 # if grub option is set, unset syslinux option
-def grub_option(option, opt, opt_parser):
-    """A helper function adjusting other option values
-    """
+def grub_option(option, opt, _value, opt_parser):
+    """A helper function adjusting other option values"""
     # pylint: disable-msg=W0613
     setattr(opt_parser.values, option.dest, True)
     setattr(opt_parser.values, "syslinux", False)
@@ -267,8 +265,7 @@ class VerifyException(Exception):
 
 
 def cleanup():
-    """Cleanup function to make sure there aren't any mounted devices left behind.
-    """
+    """Cleanup function to make sure there aren't any mounted devices left behind."""
 
     def del_failed(_fn, path, _exc):
         logging.warning("Deletion of %s failed in temporary folder", path)
@@ -403,8 +400,7 @@ def which(program):
 
 
 def get_defaults_file(iso_mount, flavour, name):
-    """get the default file for syslinux
-    """
+    """get the default file for syslinux"""
     bootloader_dirs = ["/boot/isolinux/", "/boot/syslinux/"]
     for directory in bootloader_dirs:
         for name in name, "%s_%s" % (get_flavour_filename(flavour), name):
@@ -810,7 +806,9 @@ def install_mbr(mbrtemplate, device, partition, ismirbsdmbr=True):
     set_rw(device)
 
     logging.debug(
-        "executing: dd if='%s' of='%s' bs=512 count=1 conv=notrunc", tmpf.name, device
+        "executing: dd if='%s' of='%s' bs=512 count=1 conv=notrunc,fsync",
+        tmpf.name,
+        device,
     )
     proc = subprocess.Popen(
         [
@@ -819,7 +817,7 @@ def install_mbr(mbrtemplate, device, partition, ismirbsdmbr=True):
             "of=%s" % device,
             "bs=512",
             "count=1",
-            "conv=notrunc",
+            "conv=notrunc,fsync",
         ],
         stderr=open(os.devnull, "r+"),
     )
@@ -828,11 +826,6 @@ def install_mbr(mbrtemplate, device, partition, ismirbsdmbr=True):
         raise Exception("error executing dd (third run)")
     del tmpf
 
-    # make sure we sync filesystems before returning
-    logging.debug("executing: sync")
-    proc = subprocess.Popen(["sync"])
-    proc.wait()
-
     logging.debug("Probing device via 'blockdev --rereadpt %s'", device)
     proc = subprocess.Popen(["blockdev", "--rereadpt", device])
     proc.wait()
@@ -1330,8 +1323,7 @@ def get_device_from_partition(partition):
 
 
 def get_flavour(flavour_str):
-    """Returns the flavour of a grml version string
-    """
+    """Returns the flavour of a grml version string"""
     return re.match(r"[\w-]*", flavour_str).group()
 
 
@@ -1622,7 +1614,6 @@ def handle_syslinux_config(grml_flavour, target):
     new_grml_cfg = "%s/%s_grml.cfg" % (syslinux_target, flavour_filename)
 
     if os.path.isfile(defaults_file):
-
         # remove default menu entry in menu
         remove_default_entry(new_default_with_path)
 
@@ -1807,8 +1798,7 @@ def install_grml(mountpoint, device):
 
 
 def remove_mountpoint(mountpoint):
-    """remove a registered mountpoint
-    """
+    """remove a registered mountpoint"""
 
     try:
         unmount(mountpoint, "")