From 5b3b5f7d12a5781ff3dbcfa233b693d22fd074ea Mon Sep 17 00:00:00 2001 From: dansan Date: Mon, 2 Jun 2014 11:19:13 +0200 Subject: [PATCH] allow grub-install to be called grub2-install (used in gentoo) --- grml2usb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/grml2usb b/grml2usb index 0fbf339..8c4277e 100755 --- a/grml2usb +++ b/grml2usb @@ -42,6 +42,7 @@ GRML_DEFAULT = None UUID = None SYSLINUX_LIBS = "/usr/lib/syslinux/" GPT_HEADER = "\x55\xaa\x45\x46\x49\x20\x50\x41\x52\x54" # original GPT header +GRUB_INSTALL = None RE_PARTITION = re.compile(r'([a-z/]*?)(\d+)$') RE_P_PARTITION = re.compile(r'(.*?\d+)p(\d+)$') @@ -470,7 +471,7 @@ def install_grub(device): 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", + proc = subprocess.Popen([GRUB_INSTALL, "--recheck", opt, "--no-floppy", "--root-directory=%s" % device_mountpoint, grub_device], stdout=file(os.devnull, "r+")) proc.wait() @@ -1725,7 +1726,8 @@ def check_options(opts): def check_programs(): """check if all needed programs are installed""" if options.grub: - if not which("grub-install"): + GRUB_INSTALL = which("grub-install") or which("grub2-install") + if not GRUB_INSTALL: logging.critical("Fatal: grub-install not available (please install the " + "grub package or drop the --grub option)") sys.exit(1) -- 2.1.4