summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZygmunt Krynicki <zygmunt.krynicki@huawei.com>2021-10-15 14:17:00 +0200
committerZygmunt Krynicki <zygmunt.krynicki@huawei.com>2021-10-15 14:17:00 +0200
commit30b787fc5ff6bcd4d5f1fa6ceb2990fedce48fc7 (patch)
treee7eeed96c1b8e6bf6f9ef4653845996154102750
parentc117a1fdda0824456c5018b12da1eb77e8a1b461 (diff)
downloadvmdb2-30b787fc5ff6bcd4d5f1fa6ceb2990fedce48fc7.tar.gz
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 <zygmunt.krynicki@huawei.com>
-rw-r--r--vmdb/plugins/grub_plugin.py3
1 files changed, 2 insertions, 1 deletions
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",