From: Stoiko Ivanov <s.ivanov@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH pve-kernel-meta v2 6/8] proxmox-boot: add grub.cfg header snippet
Date: Fri, 23 Apr 2021 11:04:48 +0200 [thread overview]
Message-ID: <20210423090451.2279-7-s.ivanov@proxmox.com> (raw)
In-Reply-To: <20210423090451.2279-1-s.ivanov@proxmox.com>
If the system seems to be booted using proxmox-boot, write a header at
the beginning of the grub.cfg generated when running `update-grub`
Additionally print a warning in case the script is run interactively.
This is determined by checking for DPKG_VERSION, which is set when
running as post-inst task (after a kernel install/removal)
and for PVE_EFIBOOT_UNSHARED, which is set by proxmox-boot-tool when
running `proxmox-boot-tool refresh.`
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
---
v1->v2:
* replace DPKG_VERSION by DPKG_RUNNING_VERSION (the latter actually is
set during 'zz_update_grub' execution
debian/pve-kernel-helper.install | 1 +
| 22 ++++++++++++++++++++++
proxmox-boot/Makefile | 4 ++++
3 files changed, 27 insertions(+)
create mode 100755 proxmox-boot/000_proxmox_boot_header
diff --git a/debian/pve-kernel-helper.install b/debian/pve-kernel-helper.install
index aae9494..f03b05a 100644
--- a/debian/pve-kernel-helper.install
+++ b/debian/pve-kernel-helper.install
@@ -1,3 +1,4 @@
+etc/grub.d/000_proxmox_boot_header
etc/kernel/postinst.d/*
etc/kernel/postrm.d/*
etc/initramfs/post-update.d/proxmox-boot-sync
--git a/proxmox-boot/000_proxmox_boot_header b/proxmox-boot/000_proxmox_boot_header
new file mode 100755
index 0000000..e230aef
--- /dev/null
+++ b/proxmox-boot/000_proxmox_boot_header
@@ -0,0 +1,22 @@
+#! /bin/sh
+set -e
+
+. /usr/share/pve-kernel-helper/scripts/functions
+
+if proxmox-boot-tool status --quiet; then
+ cat <<- EOF
+ #
+ # This system is booted via proxmox-boot-tool! The grub-config used when
+ # booting from the disks configured with proxmox-boot-tool resides on the vfat
+ # partitions with UUIDs listed in ${ESP_LIST}.
+ # /boot/grub/grub.cfg is NOT read when booting from those disk!
+ EOF
+
+ if [ -z "$DPKG_RUNNING_VERSION" ] && [ -z "$PVE_EFIBOOT_UNSHARED" ]; then
+ warn "W: This system is booted via proxmox-boot-tool:"
+ warn "W: Running update-grub does not update the correct config!"
+ warn "W: Run 'proxmox-boot-tool refresh' instead."
+ warn ""
+ fi
+fi
+
diff --git a/proxmox-boot/Makefile b/proxmox-boot/Makefile
index 3a36cb7..effd726 100644
--- a/proxmox-boot/Makefile
+++ b/proxmox-boot/Makefile
@@ -1,11 +1,13 @@
KERNEL_HOOKSCRIPTS = proxmox-auto-removal zz-proxmox-boot
INITRAMFS_HOOKSCRIPTS = proxmox-boot-sync
SHARE_FILES = functions
+GRUB_CFG_SNIPPET = 000_proxmox_boot_header
POSTINSTHOOKDIR = ${DESTDIR}/etc/kernel/postinst.d
POSTRMHOOKDIR = ${DESTDIR}/etc/kernel/postrm.d
POSTINITRAMFSHOOKDIR = ${DESTDIR}/etc/initramfs/post-update.d
SHARE_SCRIPTDIR = ${DESTDIR}/usr/share/pve-kernel-helper/scripts
+GRUB_CFG_DIR = ${DESTDIR}/etc/grub.d
.PHONY: all
all:
@@ -19,6 +21,8 @@ install:
install -m 0755 ${INITRAMFS_HOOKSCRIPTS} ${POSTINITRAMFSHOOKDIR}
install -d ${SHARE_SCRIPTDIR}
install -m 0755 ${SHARE_FILES} ${SHARE_SCRIPTDIR}
+ install -d ${GRUB_CFG_DIR}
+ install -m 0755 ${GRUB_CFG_SNIPPET} ${GRUB_CFG_DIR}
.PHONY: clean distclean
distclean:
--
2.20.1
next prev parent reply other threads:[~2021-04-23 9:05 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-23 9:04 [pve-devel] [PATCH pve-kernel-meta/pve-installer v2] boot ZFS on legacy BIOS systems from vfat Stoiko Ivanov
2021-04-23 9:04 ` [pve-devel] [PATCH pve-kernel-meta v2 1/8] proxmox-boot-tool: rename from pve-efiboot-tool Stoiko Ivanov
2021-04-23 9:04 ` [pve-devel] [PATCH pve-kernel-meta v2 2/8] proxmox-boot-tool: add status command Stoiko Ivanov
2021-04-23 9:04 ` [pve-devel] [PATCH pve-kernel-meta v2 3/8] proxmox-boot-tool: sort and remove duplicates on clean Stoiko Ivanov
2021-04-23 9:04 ` [pve-devel] [PATCH pve-kernel-meta v2 4/8] proxmox-boot: rename uuid list file Stoiko Ivanov
2021-04-23 9:04 ` [pve-devel] [PATCH pve-kernel-meta v2 5/8] proxmox-boot-tool: handle legacy boot zfs installs Stoiko Ivanov
2021-04-23 9:04 ` Stoiko Ivanov [this message]
2021-04-23 9:04 ` [pve-devel] [PATCH pve-kernel-meta v2 7/8] proxmox-boot: add grub-install wrapper Stoiko Ivanov
2021-04-23 9:04 ` [pve-devel] [PATCH pve-kernel-meta v2 8/8] proxmox-boot: run p-b-t refresh on update-grub Stoiko Ivanov
2021-04-23 9:04 ` [pve-devel] [PATCH installer v2 1/1] always boot zfs with proxmox-boot-tool Stoiko Ivanov
2021-04-23 11:30 ` [pve-devel] applied: [PATCH pve-kernel-meta/pve-installer v2] boot ZFS on legacy BIOS systems from vfat 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=20210423090451.2279-7-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.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal