From 918a329fbe8d38593584799c7e611bd76a69c91e 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: use kernel minor in entries and allow vkpurge to function properly --- srcpkgs/efibootmgr/files/README.voidlinux | 4 --- .../files/kernel.d/efibootmgr.post-install | 25 +++---------------- .../files/kernel.d/efibootmgr.post-remove | 8 +++--- srcpkgs/efibootmgr/template | 2 +- 4 files changed, 7 insertions(+), 32 deletions(-) diff --git a/srcpkgs/efibootmgr/files/README.voidlinux b/srcpkgs/efibootmgr/files/README.voidlinux index 98844fd85a6580..d98ed98e0b95d3 100644 --- a/srcpkgs/efibootmgr/files/README.voidlinux +++ b/srcpkgs/efibootmgr/files/README.voidlinux @@ -13,7 +13,3 @@ but you always have to reconfigure the kernel: (or any other kernel version) This is also required after the first installation of this package. ------------------------------------------------------------------------ -The bootorder itself is not changed, so your previous boot loader will -stay enabled until you can edit the order in your firmware interface or -using "efibootmgr -o " 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"