From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 0945A73DB8 for ; Wed, 7 Jul 2021 23:10:43 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 010ACFC65 for ; Wed, 7 Jul 2021 23:10:13 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id B9326FC4D for ; Wed, 7 Jul 2021 23:10:11 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 927E240ECD for ; Wed, 7 Jul 2021 23:10:11 +0200 (CEST) From: Stoiko Ivanov To: pve-devel@lists.proxmox.com Date: Wed, 7 Jul 2021 23:09:52 +0200 Message-Id: <20210707210954.765260-4-s.ivanov@proxmox.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210707210954.765260-1-s.ivanov@proxmox.com> References: <20210707210954.765260-1-s.ivanov@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.482 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pve-devel] [PATCH pve-kernel-meta 3/5] proxmox-boot: maintscript: change logic whether to add diversion X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Jul 2021 21:10:43 -0000 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 --- 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