From: Michael Prokop Date: Wed, 24 May 2017 13:31:21 +0000 (+0200) Subject: Option --rw-blockdev: ensure to set device to rw between grub-install runs + don... X-Git-Tag: v0.15.1~1 X-Git-Url: https://git.grml.org/?p=grml2usb.git;a=commitdiff_plain;h=463068976531bda91d3fe79246bd58bc3f88031d;hp=e4a774796aafe18d465cc9d1891d56c3e8be5409 Option --rw-blockdev: ensure to set device to rw between grub-install runs + don't set rw on source If we're invoking set_rw on the source device this probably points to the source ISO which will fail. On the other side we invoke grub-intall with and without --force in a loop and have to unblock the underlying block device in between as well, otherwise failing to install. --- diff --git a/grml2usb b/grml2usb index f06ab9a..b0ee2b1 100755 --- a/grml2usb +++ b/grml2usb @@ -511,11 +511,10 @@ def install_grub(device): else: grub_device = device - set_rw(device) - set_rw(grub_device) - logging.info("Installing grub as bootloader") for opt in ["", "--force"]: + set_rw(device) + set_rw(grub_device) logging.debug("grub-install --recheck %s --no-floppy --root-directory=%s %s", opt, device_mountpoint, grub_device) proc = subprocess.Popen([GRUB_INSTALL, "--recheck", opt, @@ -715,8 +714,6 @@ def mount(source, target, mount_options): logging.debug("Source %s is not a device, therefore not mounting.", source) return 0 - set_rw(source) - logging.debug("mount %s %s %s", mount_options, source, target) proc = subprocess.Popen(["mount"] + list(mount_options) + [source, target]) proc.wait()