[pve-devel] [PATCH kernel-meta 12/13] efiboot: call on kernel removal as well

Fabian Grünbichler f.gruenbichler at proxmox.com
Wed Jul 10 17:05:10 CEST 2019


but don't pass in newly 'installed' kernel version

Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
 efiboot/Makefile                 |  9 ++++++---
 debian/pve-kernel-helper.install |  1 +
 efiboot/zz-pve-efiboot           | 12 ++++++++----
 3 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/efiboot/Makefile b/efiboot/Makefile
index dfda9b4..766faca 100644
--- a/efiboot/Makefile
+++ b/efiboot/Makefile
@@ -1,15 +1,18 @@
 KERNEL_HOOKSCRIPTS = pve-auto-removal zz-pve-efiboot
 SHARE_FILES = functions
 
-HOOKDIR = ${DESTDIR}/etc/kernel/postinst.d
+POSTINSTHOOKDIR = ${DESTDIR}/etc/kernel/postinst.d
+POSTRMHOOKDIR = ${DESTDIR}/etc/kernel/postrm.d
 SHARE_SCRIPTDIR = ${DESTDIR}/usr/share/pve-kernel-helper/scripts
 
 .PHONY: all
 all:
 
 install:
-	install -d ${HOOKDIR}
-	install -m 0755 ${KERNEL_HOOKSCRIPTS} ${HOOKDIR}
+	install -d ${POSTINSTHOOKDIR}
+	install -m 0755 ${KERNEL_HOOKSCRIPTS} ${POSTINSTHOOKDIR}
+	install -d ${POSTRMHOOKDIR}
+	install -m 0755 ${KERNEL_HOOKSCRIPTS} ${POSTRMHOOKDIR}
 	install -d ${SHARE_SCRIPTDIR}
 	install -m 0755 ${SHARE_FILES} ${SHARE_SCRIPTDIR}
 
diff --git a/debian/pve-kernel-helper.install b/debian/pve-kernel-helper.install
index f79ab7f..283459d 100644
--- a/debian/pve-kernel-helper.install
+++ b/debian/pve-kernel-helper.install
@@ -1,3 +1,4 @@
 etc/kernel/postinst.d/*
+etc/kernel/postrm.d/*
 usr/sbin/pveesptool
 usr/share/pve-kernel-helper/scripts/functions
diff --git a/efiboot/zz-pve-efiboot b/efiboot/zz-pve-efiboot
index 06a1926..954dbec 100755
--- a/efiboot/zz-pve-efiboot
+++ b/efiboot/zz-pve-efiboot
@@ -31,8 +31,6 @@ trap cleanup EXIT INT TERM QUIT
 
 . /usr/share/pve-kernel-helper/scripts/functions
 
-BOOT_KVERS="$(boot_kernel_list "$@")"
-
 potential_esps(){
 	lsblk --list -o PATH,UUID,FSTYPE,PARTTYPE,MOUNTPOINT |
 	awk '$3 == "vfat" && $4 == "c12a7328-f81f-11d2-ba4b-00a0c93ec93b" && $5 == "" {print $1,$2}'
@@ -152,8 +150,14 @@ case $0:$mode in
 	# time by calling update-grub multiple times on upgrade and removal.
 	# Also run if we have no DEB_MAINT_PARAMS, in order to work with old
 	# kernel packages.
-	*/postinst.d/*:|*/postinst.d/*:configure|*/postrm.d/*:|*/postrm.d/*:remove)
-	update_esps
+	*/postinst.d/*:|*/postinst.d/*:configure)
+		BOOT_KVERS="$(boot_kernel_list "$@")"
+		update_esps
+	;;
+	 */postrm.d/*:|*/postrm.d/*:remove)
+		# no newly installed kernel
+		BOOT_KVERS="$(boot_kernel_list)"
+		update_esps
 	;;
 esac
 
-- 
2.20.1





More information about the pve-devel mailing list