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 A4FC473DB6 for ; Wed, 7 Jul 2021 23:10:42 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 99E2EFC63 for ; Wed, 7 Jul 2021 23:10:12 +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 73D0CFC3C 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 4A87D40EE0 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:51 +0200 Message-Id: <20210707210954.765260-3-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.439 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 PROLO_LEO2 0.1 Meta Catches all Leo drug variations so far 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 2/5] proxmox-boot: divert call to grub-install to p-b-t init 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:42 -0000 This way all ESPs (in case of a legacy booted system) get an updated grub installation. running only once between reboots (the markerfile is in /tmp) should be enough. Sadly the environment does not provide a hint which version grub is installed to. Signed-off-by: Stoiko Ivanov --- bin/grub-install-wrapper | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/bin/grub-install-wrapper b/bin/grub-install-wrapper index 35f03fa..2e70789 100755 --- a/bin/grub-install-wrapper +++ b/bin/grub-install-wrapper @@ -3,12 +3,33 @@ set -e . /usr/share/pve-kernel-helper/scripts/functions +init_boot_disks() { + if ! (echo "${curr_uuid}" | grep -qE '[0-9a-fA-F]{4}-[0-9a-fA-F]{4}'); then + warn "WARN: ${curr_uuid} read from ${ESP_LIST} does not look like a VFAT-UUID - skipping" + return + fi + + path="/dev/disk/by-uuid/$curr_uuid" + if [ ! -e "${path}" ]; then + warn "WARN: ${path} does not exist - clean '${ESP_LIST}'! - skipping" + return + fi + proxmox-boot-tool init "$path" +} + 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 + MARKER_FILE="/tmp/proxmox-boot-tool.dpkg.marker" + if [ ! -e "$MARKER_FILE" ]; then + warn "This system is booted via proxmox-boot-tool, running proxmox-boot-tool init for all configured bootdisks" + loop_esp_list init_boot_disks + touch "$MARKER_FILE" + exit 0 + else + exit 0 + fi 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 -- 2.30.2