Merge remote-tracking branch 'origin/pr/35'
authorMichael Prokop <mika@grml.org>
Wed, 3 Jun 2020 13:11:37 +0000 (15:11 +0200)
committerMichael Prokop <mika@grml.org>
Wed, 3 Jun 2020 13:11:37 +0000 (15:11 +0200)
1  2 
grml2usb

diff --combined grml2usb
+++ b/grml2usb
@@@ -748,16 -748,14 +748,14 @@@ def install_mbr(mbrtemplate, device, pa
      "mbrtemplate" file, set the "partition" (0..3) active, and install the
      result back to "device".
  
-     @mbrtemplate: default MBR file
+     @mbrtemplate: default MBR file (must be a valid MBR file of at least 440
+     (or 439 if ismirbsdmbr) bytes)
  
      @device: name of a file assumed to be a hard disc (or USB stick) image, or
      something like "/dev/sdb"
  
      @partition: must be a number between 0 and 3, inclusive
  
-     @mbrtemplate: must be a valid MBR file of at least 440 (or 439 if
-     ismirbsdmbr) bytes.
      @ismirbsdmbr: if true then ignore the active flag, set the mirbsdmbr
      specific flag to 0/1/2/3 and set the MBR's default value accordingly. If
      false then leave the mirbsdmbr specific flag set to FFh, set all
      proc = subprocess.Popen(["sync"])
      proc.wait()
  
+     logging.debug("Probing device via 'blockdev --rereadpt %s'", device)
+     proc = subprocess.Popen(["blockdev", "--rereadpt", device])
+     proc.wait()
+     if proc.returncode != 0:
+         raise Exception(
+             "Couldn't execute blockdev on '%s' (install util-linux?)", device
+         )
      set_rw(device)
  
  
@@@ -1875,6 -1881,10 +1881,6 @@@ def install_grml(mountpoint, device)
          register_tmpfile(device_mountpoint)
          remove_device_mountpoint = True
          try:
 -            check_for_fat(device)
 -            if not options.skipbootflag:
 -                check_boot_flag(device)
 -
              set_rw(device)
              mount(device, device_mountpoint, ["-o", "utf8,iocharset=iso8859-1"])
          except CriticalException:
@@@ -2159,9 -2169,6 +2165,9 @@@ def main()
          # provide upgrade path
          handle_compat_warning(device)
  
 +        if not options.skipbootflag:
 +            check_boot_flag(device)
 +
          # check for vfat partition
          handle_vfat(device)