[pve-devel] applied: [PATCH kernel-meta 2/2] Add efiboot refresh hook to update-initramfs
Fabian Grünbichler
f.gruenbichler at proxmox.com
Mon Aug 5 13:29:51 CEST 2019
applied, thanks for finding this solution!
On August 1, 2019 1:01 pm, Stefan Reiter wrote:
> 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 at proxmox.com>
> ---
>
> Found a hook we can use :)
>
> Ignore the previous patch to docs then, since the ESP refresh now happens
> automatically. I'll send a new one later.
>
> debian/pve-kernel-helper.install | 1 +
> efiboot/Makefile | 4 ++++
> efiboot/pve-efiboot-sync | 11 +++++++++++
> 3 files changed, 16 insertions(+)
> create mode 100644 efiboot/pve-efiboot-sync
>
> diff --git a/debian/pve-kernel-helper.install b/debian/pve-kernel-helper.install
> index ad265a5..6f7f713 100644
> --- a/debian/pve-kernel-helper.install
> +++ b/debian/pve-kernel-helper.install
> @@ -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
> diff --git a/efiboot/Makefile b/efiboot/Makefile
> index 766faca..fc9e333 100644
> --- a/efiboot/Makefile
> +++ b/efiboot/Makefile
> @@ -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
> index 0000000..c3ccf8e
> --- /dev/null
> +++ b/efiboot/pve-efiboot-sync
> @@ -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
> --
> 2.20.1
>
>
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
>
>
More information about the pve-devel
mailing list