From 36d936aa0a97f9b63cee1609654a7e32a2ebd236 Mon Sep 17 00:00:00 2001 From: ddmgh <26882569+ddmgh@users.noreply.github.com> Date: Mon, 11 Nov 2024 13:03:45 -0700 Subject: [PATCH] efibootmgr: have efibootmgr scripts behave more like grub with kernel minor version entries, and allow vkpurge to function properly here --- .../files/kernel.d/efibootmgr.post-install | 25 +++---------------- .../files/kernel.d/efibootmgr.post-remove | 8 +++--- srcpkgs/efibootmgr/template | 2 +- 3 files changed, 7 insertions(+), 28 deletions(-) diff --git a/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install b/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install index adf523e7b1fae3..00698b5016b8e8 100644 --- a/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install +++ b/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install @@ -4,7 +4,7 @@ # # Arguments passed to this script: $1 pkgname, $2 version. # -PKGNAME="$1" +# PKGNAME="$1" VERSION="$2" . "${ROOTDIR}/etc/default/efibootmgr-kernel-hook" @@ -22,24 +22,5 @@ if [ "x${PART}" != x ]; then args="$args -p $PART" fi -# get major version, e.g. "4.8" for "linux4.8" -major_version=$(echo $PKGNAME | cut -c 6-) - -# look for previous entry for this major kernel version -existing_entry=$(efibootmgr | grep "Void Linux with kernel ${major_version}") - -# get the boot order -# this is required because when in the next step the existing entry is removed, -# it is also removed from the order so it needs to be restored later -bootorder=$(efibootmgr |grep "BootOrder: " |cut -c 12-) - -# if existing, remove it -if [ "$existing_entry" != "" ]; then - /etc/kernel.d/post-remove/50-efibootmgr $PKGNAME -fi - -# create the new entry -efibootmgr -qc $args -L "Void Linux with kernel ${major_version}" -l /vmlinuz-${VERSION} -u "${OPTIONS}" - -# restore the boot order -efibootmgr -qo $bootorder +# create new entry (new bootnum will be added to the start of bootorder) +efibootmgr -qc $args -L "Void Linux with kernel ${VERSION}" -l /vmlinuz-${VERSION} -u "${OPTIONS}" diff --git a/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-remove b/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-remove index 54557e5cb7920c..1da7c9b7aba2ed 100644 --- a/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-remove +++ b/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-remove @@ -4,18 +4,16 @@ # # Arguments passed to this script: $1 pkgname, $2 version. # -PKGNAME="$1" +# PKGNAME="$1" +VERSION="$2" . "${ROOTDIR}/etc/default/efibootmgr-kernel-hook" if [ "x${MODIFY_EFI_ENTRIES}" != x1 ]; then exit 0 fi -# get major version, e.g. "4.8" for "linux4.8" -major_version=$(echo $PKGNAME | cut -c 6-) - # get hex number of the matching entry -hexnum=$(efibootmgr | grep "Void Linux with kernel ${major_version}" | cut -c "5-8") +hexnum=$(efibootmgr | grep "Void Linux with kernel ${VERSION}" | cut -c "5-8") # delete it [ "$hexnum" ] && efibootmgr -Bq -b $hexnum diff --git a/srcpkgs/efibootmgr/template b/srcpkgs/efibootmgr/template index 2f636914a56695..8db1f68fd3f633 100644 --- a/srcpkgs/efibootmgr/template +++ b/srcpkgs/efibootmgr/template @@ -1,7 +1,7 @@ # Template file for 'efibootmgr' pkgname=efibootmgr version=18 -revision=1 +revision=2 hostmakedepends="pkg-config" makedepends="libefivar-devel popt-devel" short_desc="Tool to modify UEFI Firmware Boot Manager Variables"