From: Ulrich Dangel Date: Mon, 20 Sep 2010 12:56:49 +0000 (+0200) Subject: Run grub-install without and with --force option. X-Git-Tag: v0.9.28~3 X-Git-Url: http://git.grml.org/?p=grml2usb.git;a=commitdiff_plain;h=c0fd54ed8049b7a6b6bf3bdf346c02f19990818a Run grub-install without and with --force option. --- diff --git a/grml2usb b/grml2usb index 89c1f22..161aae0 100755 --- a/grml2usb +++ b/grml2usb @@ -650,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 "