From 30b787fc5ff6bcd4d5f1fa6ceb2990fedce48fc7 Mon Sep 17 00:00:00 2001 From: Zygmunt Krynicki Date: Fri, 15 Oct 2021 14:17:00 +0200 Subject: grub_plugin.py: detect grub-install --no-extra-removable This makes the vmdb2 compatible with Ubuntu's modified grub-install by interrogating grub-install --help to check which of the options to pass: --no-extra-removable or --force-extra-removable. Closes: https://gitlab.com/larswirzenius/vmdb2/-/issues/36 Signed-off-by: Zygmunt Krynicki --- vmdb/plugins/grub_plugin.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vmdb/plugins/grub_plugin.py b/vmdb/plugins/grub_plugin.py index 469bd50..7206cd5 100644 --- a/vmdb/plugins/grub_plugin.py +++ b/vmdb/plugins/grub_plugin.py @@ -225,13 +225,14 @@ class GrubStepRunner(vmdb.StepRunnerInterface): self.add_grub_serial_console(chroot) vmdb.runcmd_chroot(chroot, ["grub-mkconfig", "-o", "/boot/grub/grub.cfg"]) + help_out = vmdb.runcmd_chroot(chroot, ["grub-install", "--help"]) vmdb.runcmd_chroot( chroot, [ "grub-install", "--target=" + grub_target, "--no-nvram", - "--force-extra-removable", + "--no-extra-removable" if b"--no-extra-removable" in help_out else "--force-extra-removable", "--no-floppy", "--modules=part_msdos part_gpt", "--grub-mkdevicemap=/boot/grub/device.map", -- cgit v1.2.1