From: Stoiko Ivanov <s.ivanov@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH pve-kernel-meta 3/5] proxmox-boot: maintscript: change logic whether to add diversion
Date: Wed, 7 Jul 2021 23:09:52 +0200 [thread overview]
Message-ID: <20210707210954.765260-4-s.ivanov@proxmox.com> (raw)
In-Reply-To: <20210707210954.765260-1-s.ivanov@proxmox.com>
Deciding whether or not to add the diversion based on the version
alone fails quite hard in case pve-kernel-helper is in dpkg-state 'rc'
(removed not purged) as reported in our community forum[0]:
* removing pve-kernel-helper removes the diversion of grub-install
* if config-files are still present the preinst script gets called
with the version of the config-files (the version that got removed)
* if the version was newer than 6.4-1~ then no diversion is added
* unpacking fails, because grub-install would be overwritten leaving
pve-kernel-helper in state 'ic'
Explicitly checking whether the diversion is in place sounds like a
robust approach here.
downside: documentation on dpkg-divert in maintainer scripts [1] uses
the version approach.
[0] https://forum.proxmox.com/threads/pve-kernel-helper-wont-install.90029/
[1] https://www.debian.org/doc/debian-policy/ap-pkg-diversions.html
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
debian/pve-kernel-helper.preinst | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/debian/pve-kernel-helper.preinst b/debian/pve-kernel-helper.preinst
index 9ec726d..e2464c9 100644
--- a/debian/pve-kernel-helper.preinst
+++ b/debian/pve-kernel-helper.preinst
@@ -4,7 +4,7 @@ set -e
case "$1" in
install|upgrade)
- if dpkg --compare-versions "$2" lt "6.4-1~"; then
+ if ! dpkg -S /usr/sbin/grub-install|grep -q 'diversion by pve-kernel-helper'; then
dpkg-divert --package pve-kernel-helper --add --rename \
--divert /usr/sbin/grub-install.real /usr/sbin/grub-install
fi
--
2.30.2
next prev parent reply other threads:[~2021-07-07 21:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-07 21:09 [pve-devel] [PATCH pve-kernel-meta 0/5] proxmox-boot-tool improvements Stoiko Ivanov
2021-07-07 21:09 ` [pve-devel] [PATCH pve-kernel-meta 1/5] proxmox-boot: ignore call to grub-install from grub maintscripts Stoiko Ivanov
2021-07-07 21:09 ` [pve-devel] [PATCH pve-kernel-meta 2/5] proxmox-boot: divert call to grub-install to p-b-t init Stoiko Ivanov
2021-07-08 7:06 ` Fabian Grünbichler
2021-07-07 21:09 ` Stoiko Ivanov [this message]
2021-07-07 21:09 ` [pve-devel] [PATCH pve-kernel-meta 4/5] proxmox-boot: print current boot mode with status output Stoiko Ivanov
2021-07-07 21:09 ` [pve-devel] [PATCH pve-kernel-meta 5/5] proxmox-boot: status: print present kernel versions Stoiko Ivanov
2021-07-08 8:05 ` [pve-devel] applied-series: [PATCH pve-kernel-meta 0/5] proxmox-boot-tool improvements Thomas Lamprecht
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210707210954.765260-4-s.ivanov@proxmox.com \
--to=s.ivanov@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.