Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] efibootmgr: have efibootmgr scripts behave more like grub with kernel…
@ 2024-11-11 20:25 ddmgh
  2024-11-21  0:12 ` [PR PATCH] [Updated] " ddmgh
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: ddmgh @ 2024-11-11 20:25 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1391 bytes --]

There is a new pull request by ddmgh against master on the void-packages repository

https://github.com/ddmgh/void-packages efibootmgr-with-minor
https://github.com/void-linux/void-packages/pull/53001

efibootmgr: have efibootmgr scripts behave more like grub with kernel…
… minor version entries, and allow vkpurge to function properly here

#### Testing the changes
- I tested the changes in this PR: **YES**

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)

efibootmgr.post-install only creates one boot entry for the latest kernel minor version of a major version; it removes the current boot entry and replaces it with the kernel that's been installed.  Additionally, efibootmgr.post-remove does nothing when called by vkpurge due to the "pkgname" that's passed to it.

This patch makes these scripts behave a little more like the related grub process in that you can easily boot from a previous kernel, as it simply adds a boot entry every time a kernel is installed.  In relation to this, efibootmgr.post-remove is also altered to allow vkpurge to do what one would expect, which is actually remove the related boot entry from EFI.

Please know this is my first commit on GitHub, so it's very possible something here is incorrect.

A patch file from https://github.com/void-linux/void-packages/pull/53001.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-efibootmgr-with-minor-53001.patch --]
[-- Type: text/x-diff, Size: 3393 bytes --]

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"

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PR PATCH] [Updated] efibootmgr: have efibootmgr scripts behave more like grub with kernel…
  2024-11-11 20:25 [PR PATCH] efibootmgr: have efibootmgr scripts behave more like grub with kernel… ddmgh
@ 2024-11-21  0:12 ` ddmgh
  2024-12-08 21:42 ` piekay
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ddmgh @ 2024-11-21  0:12 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1396 bytes --]

There is an updated pull request by ddmgh against master on the void-packages repository

https://github.com/ddmgh/void-packages efibootmgr-with-minor
https://github.com/void-linux/void-packages/pull/53001

efibootmgr: have efibootmgr scripts behave more like grub with kernel…
… minor version entries, and allow vkpurge to function properly here

#### Testing the changes
- I tested the changes in this PR: **YES**

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)

efibootmgr.post-install only creates one boot entry for the latest kernel minor version of a major version; it removes the current boot entry and replaces it with the kernel that's been installed.  Additionally, efibootmgr.post-remove does nothing when called by vkpurge due to the "pkgname" that's passed to it.

This patch makes these scripts behave a little more like the related grub process in that you can easily boot from a previous kernel, as it simply adds a boot entry every time a kernel is installed.  In relation to this, efibootmgr.post-remove is also altered to allow vkpurge to do what one would expect, which is actually remove the related boot entry from EFI.

Please know this is my first commit on GitHub, so it's very possible something here is incorrect.

A patch file from https://github.com/void-linux/void-packages/pull/53001.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-efibootmgr-with-minor-53001.patch --]
[-- Type: text/x-diff, Size: 4047 bytes --]

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 <hexnum>"
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"

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: efibootmgr: have efibootmgr scripts behave more like grub with kernel…
  2024-11-11 20:25 [PR PATCH] efibootmgr: have efibootmgr scripts behave more like grub with kernel… ddmgh
  2024-11-21  0:12 ` [PR PATCH] [Updated] " ddmgh
@ 2024-12-08 21:42 ` piekay
  2024-12-09 20:49 ` ddmgh
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: piekay @ 2024-12-08 21:42 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 284 bytes --]

New comment by piekay on void-packages repository

https://github.com/void-linux/void-packages/pull/53001#issuecomment-2526395418

Comment:
Maybe this should be made configurable. Efibootmgr already has a config file. I already did this for the target executable file. 

See #53301

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: efibootmgr: have efibootmgr scripts behave more like grub with kernel…
  2024-11-11 20:25 [PR PATCH] efibootmgr: have efibootmgr scripts behave more like grub with kernel… ddmgh
  2024-11-21  0:12 ` [PR PATCH] [Updated] " ddmgh
  2024-12-08 21:42 ` piekay
@ 2024-12-09 20:49 ` ddmgh
  2024-12-10  4:48 ` piekay
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ddmgh @ 2024-12-09 20:49 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 301 bytes --]

New comment by ddmgh on void-packages repository

https://github.com/void-linux/void-packages/pull/53001#issuecomment-2529416982

Comment:
@piekay Definitely doable, but I also happen to think the way the scripts currently handle this is less than ideal and partially broken, hence my larger changes.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: efibootmgr: have efibootmgr scripts behave more like grub with kernel…
  2024-11-11 20:25 [PR PATCH] efibootmgr: have efibootmgr scripts behave more like grub with kernel… ddmgh
                   ` (2 preceding siblings ...)
  2024-12-09 20:49 ` ddmgh
@ 2024-12-10  4:48 ` piekay
  2024-12-14  4:33 ` piekay
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: piekay @ 2024-12-10  4:48 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 303 bytes --]

New comment by piekay on void-packages repository

https://github.com/void-linux/void-packages/pull/53001#issuecomment-2530373237

Comment:
Fair. The way Void handels everything that isn't the default configuration (Grub + vmlinuz) seems broken tbh. That's why I made the target configurable at least. 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: efibootmgr: have efibootmgr scripts behave more like grub with kernel…
  2024-11-11 20:25 [PR PATCH] efibootmgr: have efibootmgr scripts behave more like grub with kernel… ddmgh
                   ` (3 preceding siblings ...)
  2024-12-10  4:48 ` piekay
@ 2024-12-14  4:33 ` piekay
  2024-12-15 18:25 ` ddmgh
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: piekay @ 2024-12-14  4:33 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 376 bytes --]

New comment by piekay on void-packages repository

https://github.com/void-linux/void-packages/pull/53001#issuecomment-2542810913

Comment:
Wouldn't your solution completely ignore version numbers, so if multiple kernel lines are installed (for example 6.8 and 6.10) it would boot into the last updated one by default instead of the release with the highest version number?


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: efibootmgr: have efibootmgr scripts behave more like grub with kernel…
  2024-11-11 20:25 [PR PATCH] efibootmgr: have efibootmgr scripts behave more like grub with kernel… ddmgh
                   ` (4 preceding siblings ...)
  2024-12-14  4:33 ` piekay
@ 2024-12-15 18:25 ` ddmgh
  2025-03-16  2:08 ` github-actions
  2025-03-30  2:10 ` [PR PATCH] [Closed]: " github-actions
  7 siblings, 0 replies; 9+ messages in thread
From: ddmgh @ 2024-12-15 18:25 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 408 bytes --]

New comment by ddmgh on void-packages repository

https://github.com/void-linux/void-packages/pull/53001#issuecomment-2543990579

Comment:
@piekay Yes, but the original code doesn't really take version numbers into account either. The original code does not allow you to easily boot into prior patch versions and, if you install a newer kernel minor version, it requires manual intervention to boot from it.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: efibootmgr: have efibootmgr scripts behave more like grub with kernel…
  2024-11-11 20:25 [PR PATCH] efibootmgr: have efibootmgr scripts behave more like grub with kernel… ddmgh
                   ` (5 preceding siblings ...)
  2024-12-15 18:25 ` ddmgh
@ 2025-03-16  2:08 ` github-actions
  2025-03-30  2:10 ` [PR PATCH] [Closed]: " github-actions
  7 siblings, 0 replies; 9+ messages in thread
From: github-actions @ 2025-03-16  2:08 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 305 bytes --]

New comment by github-actions[bot] on void-packages repository

https://github.com/void-linux/void-packages/pull/53001#issuecomment-2727127064

Comment:
Pull Requests become stale 90 days after last activity and are closed 14 days after that.  If this pull request is still relevant bump it or assign it.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PR PATCH] [Closed]: efibootmgr: have efibootmgr scripts behave more like grub with kernel…
  2024-11-11 20:25 [PR PATCH] efibootmgr: have efibootmgr scripts behave more like grub with kernel… ddmgh
                   ` (6 preceding siblings ...)
  2025-03-16  2:08 ` github-actions
@ 2025-03-30  2:10 ` github-actions
  7 siblings, 0 replies; 9+ messages in thread
From: github-actions @ 2025-03-30  2:10 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1230 bytes --]

There's a closed pull request on the void-packages repository

efibootmgr: have efibootmgr scripts behave more like grub with kernel…
https://github.com/void-linux/void-packages/pull/53001

Description:
… minor version entries, and allow vkpurge to function properly here

#### Testing the changes
- I tested the changes in this PR: **YES**

#### Local build testing
- I built this PR locally for my native architecture, (x86_64-glibc)

efibootmgr.post-install only creates one boot entry for the latest kernel minor version of a major version; it removes the current boot entry and replaces it with the kernel that's been installed.  Additionally, efibootmgr.post-remove does nothing when called by vkpurge due to the "pkgname" that's passed to it.

This patch makes these scripts behave a little more like the related grub process in that you can easily boot from a previous kernel, as it simply adds a boot entry every time a kernel is installed.  In relation to this, efibootmgr.post-remove is also altered to allow vkpurge to do what one would expect, which is actually remove the related boot entry from EFI.

Please know this is my first commit on GitHub, so it's very possible something here is incorrect.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-03-30  2:10 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-11 20:25 [PR PATCH] efibootmgr: have efibootmgr scripts behave more like grub with kernel… ddmgh
2024-11-21  0:12 ` [PR PATCH] [Updated] " ddmgh
2024-12-08 21:42 ` piekay
2024-12-09 20:49 ` ddmgh
2024-12-10  4:48 ` piekay
2024-12-14  4:33 ` piekay
2024-12-15 18:25 ` ddmgh
2025-03-16  2:08 ` github-actions
2025-03-30  2:10 ` [PR PATCH] [Closed]: " github-actions

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).