X-Git-Url: https://git.grml.org/?p=grml2usb.git;a=blobdiff_plain;f=grml2usb;h=867bea0a9f0e69cb2d2647fbd77108844fedab40;hp=846c799b46164078dee6c53700a4d3f472dce44e;hb=fcf63b74e77193db1cc5e797e79f20736de23222;hpb=17293ed9dd46744ef408385298a13b4766384034 diff --git a/grml2usb b/grml2usb index 846c799..867bea0 100755 --- a/grml2usb +++ b/grml2usb @@ -518,7 +518,7 @@ def check_boot_flag(device): else: logging.debug("boot flag is NOT enabled on %s" % device) raise VerifyException( - "Device %s does not have the bootflag set. " + "Device %s does not have the boot flag set. " "Please enable it to be able to boot." % device ) except ImportError: @@ -748,16 +748,14 @@ def install_mbr(mbrtemplate, device, partition, ismirbsdmbr=True): "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 @@ -875,6 +873,14 @@ def install_mbr(mbrtemplate, device, partition, ismirbsdmbr=True): 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)