From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Subject: Re: [pve-devel] [PATCH pve-kernel-meta 2/5] proxmox-boot: divert call to grub-install to p-b-t init
Date: Thu, 08 Jul 2021 09:06:41 +0200 [thread overview]
Message-ID: <1625727759.xarzr6e8sn.astroid@nora.none> (raw)
In-Reply-To: <20210707210954.765260-3-s.ivanov@proxmox.com>
On July 7, 2021 11:09 pm, Stoiko Ivanov wrote:
> 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 <s.ivanov@proxmox.com>
> ---
> 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
this could have another guard for whether the system is even booted with
grub (as if the system was booted using EFI, re-initing all ESPs is just
busy-work), but the current iteration is better than what we currently
have so that can be a follow-up..
> - 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
this else branch could also have some output - it will be rarely hit
(basically only with repeated reinstalls of grub-pc or systems that are
never rebooted), but we still ignore the grub-install call here..
> + 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
>
>
>
> _______________________________________________
> pve-devel mailing list
> pve-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
>
>
>
next prev parent reply other threads:[~2021-07-08 7:06 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 [this message]
2021-07-07 21:09 ` [pve-devel] [PATCH pve-kernel-meta 3/5] proxmox-boot: maintscript: change logic whether to add diversion Stoiko Ivanov
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=1625727759.xarzr6e8sn.astroid@nora.none \
--to=f.gruenbichler@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox