]> git.proxmox.com Git - proxmox-kernel-helper.git/commitdiff
Add efiboot refresh hook to update-initramfs
authorStefan Reiter <s.reiter@proxmox.com>
Thu, 1 Aug 2019 11:01:03 +0000 (13:01 +0200)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Mon, 5 Aug 2019 11:26:08 +0000 (13:26 +0200)
As explained in [0], we can add a hook script that will be called after
update-initramfs did its job (and thus, a new initrd has been created).

We can use this to automatically sync the ESPs using 'pve-efiboot-tool
refresh', if update-initramfs was called manually (on kernel upgrade we
already have a hook that does this).

[0]: https://kernel-team.pages.debian.net/kernel-handbook/ch-update-hooks.html

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
debian/pve-kernel-helper.install
efiboot/Makefile
efiboot/pve-efiboot-sync [new file with mode: 0644]

index ad265a5712c919a02b712f8fd002f174e1692c65..6f7f7133e326824d1840ed7fd3234546e7b7294c 100644 (file)
@@ -1,4 +1,5 @@
 etc/kernel/postinst.d/*
 etc/kernel/postrm.d/*
+etc/initramfs/post-update.d/pve-efiboot-sync
 usr/sbin/pve-efiboot-tool
 usr/share/pve-kernel-helper/scripts/functions
index 766faca3840818ce053b50091718a23d3aff7b7b..fc9e3332e9f578e94ca9d131104ebbac21784bb9 100644 (file)
@@ -1,8 +1,10 @@
 KERNEL_HOOKSCRIPTS = pve-auto-removal zz-pve-efiboot
+INITRAMFS_HOOKSCRIPTS = pve-efiboot-sync
 SHARE_FILES = functions
 
 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
 
 .PHONY: all
@@ -13,6 +15,8 @@ install:
        install -m 0755 ${KERNEL_HOOKSCRIPTS} ${POSTINSTHOOKDIR}
        install -d ${POSTRMHOOKDIR}
        install -m 0755 ${KERNEL_HOOKSCRIPTS} ${POSTRMHOOKDIR}
+       install -d ${POSTINITRAMFSHOOKDIR}
+       install -m 0755 ${INITRAMFS_HOOKSCRIPTS} ${POSTINITRAMFSHOOKDIR}
        install -d ${SHARE_SCRIPTDIR}
        install -m 0755 ${SHARE_FILES} ${SHARE_SCRIPTDIR}
 
diff --git a/efiboot/pve-efiboot-sync b/efiboot/pve-efiboot-sync
new file mode 100644 (file)
index 0000000..c3ccf8e
--- /dev/null
@@ -0,0 +1,11 @@
+#! /bin/sh
+
+set -e
+
+# Only run the refresh if update-initramfs has been called manually.
+# If this script is being run as part of a post-kernel-install hook,
+# this variable will be set to 1 and we do nothing, since our pve-kernel
+# hooks will update the ESPs all at once anyway.
+if [ -z "$INITRAMFS_TOOLS_KERNEL_HOOK" ]; then
+       /usr/sbin/pve-efiboot-tool refresh --hook 'zz-pve-efiboot'
+fi