]> git.proxmox.com Git - pve-kernel-meta.git/commitdiff
proxmox-boot: ignore call to grub-install from grub maintscripts
authorStoiko Ivanov <s.ivanov@proxmox.com>
Wed, 7 Jul 2021 21:09:50 +0000 (23:09 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 8 Jul 2021 06:44:35 +0000 (08:44 +0200)
in certain cases the postinst script of grub-pc runs grub-install on
the disks it gets from debconf. Simply warn and exit with 0 if
grub-install is called by dpkg and from a grub related package

Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
bin/grub-install-wrapper

index a61e9849cf32b29260be057a1a1a56f2f6c2d5e8..35f03faf3068df11e5471efc09877990fb8a3665 100755 (executable)
@@ -4,6 +4,12 @@ set -e
 . /usr/share/pve-kernel-helper/scripts/functions
 
 if proxmox-boot-tool status --quiet; then
+       #detect when being called by dpkg (e.g. grub-pc.postinst
+       if [ -n "$DPKG_RUNNING_VERSION" ] && \
+       echo "$DPKG_MAINTSCRIPT_PACKAGE" | grep -sq "^grub-"; then
+               warn "This system is booted via proxmox-boot-tool, ignoring dpkg call to grub-install"
+               exit 0
+       fi
        warn "grub-install is disabled because this system is booted via proxmox-boot-tool, if you really need to run it, run /usr/sbin/grub-install.real"
        exit 1
 else