Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic
@ 2021-03-27 12:25 Dko1905
  2021-03-27 12:46 ` [PR REVIEW] " prez
                   ` (66 more replies)
  0 siblings, 67 replies; 68+ messages in thread
From: Dko1905 @ 2021-03-27 12:25 UTC (permalink / raw)
  To: ml

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

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

https://github.com/Dko1905/void-packages master
https://github.com/void-linux/void-packages/pull/29780

efibootmgr: Add strict EFI support & remove broken restore logic
#### General
- [ ] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements)

#### Have the results of the proposed changes been tested?
- [X] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me
- [ ] I generally don't use the affected packages but briefly tested this PR

<!--
If GitHub CI cannot be used to validate the build result (for example, if the
build is likely to take several hours), make sure to
[skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration).
When skipping CI, uncomment and fill out the following section.
Note: for builds that are likely to complete in less than 2 hours, it is not
acceptable to skip CI.
-->
<!-- 
#### Does it build and run successfully? 
(Please choose at least one native build and, if supported, at least one cross build. More are better.)
- [ ] I built this PR locally for my native architecture, (ARCH-LIBC)
- [ ] I built this PR locally for these architectures (if supported. mark crossbuilds):
  - [ ] aarch64-musl
  - [ ] armv7l
  - [ ] armv6l-musl
-->

I've just added a new option for using ".efi" suffixes, because some vendors don't support booting from non ".efi" files.
There are also small tab/space changes to make tabs more consistent.
The boot order "restore" functionality has been completely removed.

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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-master-29780.patch --]
[-- Type: text/x-diff, Size: 6143 bytes --]

From 938735b97ce548b606c5cb6b641dd9fcf7cadcb2 Mon Sep 17 00:00:00 2001
From: Daniel Florescu <Daniel.florescu1905@protonmail.ch>
Date: Sat, 27 Mar 2021 10:16:45 +0100
Subject: [PATCH 1/2] efibootmgr: Add new option to EFI hook

- Add new option "USE_STRICT_EFI_SUFFIX" to post-install hook.
- Update README.voidlinux to show info about the new hook.
- Fix inconsistent use of spaces and tabs in post-install hook.
---
 srcpkgs/efibootmgr/files/README.voidlinux                | 8 ++++++--
 srcpkgs/efibootmgr/files/efibootmgr-kernel-hook.confd    | 2 ++
 .../efibootmgr/files/kernel.d/efibootmgr.post-install    | 9 +++++++--
 3 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/efibootmgr/files/README.voidlinux b/srcpkgs/efibootmgr/files/README.voidlinux
index 98844fd85a65..b7904be2be64 100644
--- a/srcpkgs/efibootmgr/files/README.voidlinux
+++ b/srcpkgs/efibootmgr/files/README.voidlinux
@@ -2,8 +2,8 @@ efibootmgr can automatically generate EFI boot entries to
 directly boot the kernel after every kernel update or installation.
 Enable this by editing /etc/default/efibootmgr-kernel-hook.
 
-The EFI variables need to be accessible in order for this to work, so
-add this line to your fstab and reboot or mount manually:
+The EFI variables need to be accessible in order for this to work, either
+boot into EFI mode or add this line to your fstab and reboot or mount:
   efivarfs /sys/firmware/efi/efivars efivarfs defaults 0 0
 -----------------------------------------------------------------------
 Kernel cmd options can be configured in /etc/default/efibootmgr-kernel-hook,
@@ -17,3 +17,7 @@ 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>"
+-----------------------------------------------------------------------
+Some EFI implementations require the stub to end with a .efi suffix. If
+your implementation requires this, edit /etc/default/efibootmgr-kernel-hook
+and enable "USE_STRICT_EFI_SUFFIX=1".
diff --git a/srcpkgs/efibootmgr/files/efibootmgr-kernel-hook.confd b/srcpkgs/efibootmgr/files/efibootmgr-kernel-hook.confd
index 42adfc0da400..a6acde6a0d23 100644
--- a/srcpkgs/efibootmgr/files/efibootmgr-kernel-hook.confd
+++ b/srcpkgs/efibootmgr/files/efibootmgr-kernel-hook.confd
@@ -2,6 +2,8 @@
 MODIFY_EFI_ENTRIES=0
 # To allow efibootmgr to modify boot entries, set
 # MODIFY_EFI_ENTRIES=1
+# Use strict EFI file name spec. Default is 0
+# USE_STRICT_EFI_SUFFIX=0
 # Kernel command-line options.  Example:
 # OPTIONS="root=/dev/sda3 loglevel=4"
 # Disk where EFI Partition is.  Default is /dev/sda
diff --git a/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install b/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
index adf523e7b1fa..cbbc318aa58d 100644
--- a/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
+++ b/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
@@ -35,11 +35,16 @@ bootorder=$(efibootmgr |grep "BootOrder: " |cut -c 12-)
 
 # if existing, remove it
 if [ "$existing_entry" != "" ]; then
-  /etc/kernel.d/post-remove/50-efibootmgr $PKGNAME
+	/etc/kernel.d/post-remove/50-efibootmgr $PKGNAME
+fi
+
+# if using strict efi suffix, rename vmlinuz
+if [ "x${USE_STRICT_EFI_SUFFIX}" = x1 -a -f /boot/vmlinuz-${VERSION} ]; then
+	mv -f /boot/vmlinuz-${VERSION} /boot/vmlinuz-${VERSION}.efi
 fi
 
 # create the new entry
-efibootmgr -qc $args -L "Void Linux with kernel ${major_version}" -l /vmlinuz-${VERSION} -u "${OPTIONS}"
+efibootmgr -qc $args -L "Void Linux with kernel ${major_version}" -l /vmlinuz-${VERSION}.efi -u "${OPTIONS}"
 
 # restore the boot order
 efibootmgr -qo $bootorder

From cb1dd884526c04f3b3534d8ed03e0825ed6b4c1d Mon Sep 17 00:00:00 2001
From: Daniel Florescu <Daniel.florescu1905@protonmail.ch>
Date: Sat, 27 Mar 2021 12:55:26 +0100
Subject: [PATCH 2/2] efibootmgr: Remove the half broken boot order restore
 logic.

---
 srcpkgs/efibootmgr/files/README.voidlinux                 | 4 ----
 srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install | 7 -------
 2 files changed, 11 deletions(-)

diff --git a/srcpkgs/efibootmgr/files/README.voidlinux b/srcpkgs/efibootmgr/files/README.voidlinux
index b7904be2be64..7dfb5c05c7ba 100644
--- a/srcpkgs/efibootmgr/files/README.voidlinux
+++ b/srcpkgs/efibootmgr/files/README.voidlinux
@@ -14,10 +14,6 @@ but you always have to reconfigure the kernel:
 
 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>"
------------------------------------------------------------------------
 Some EFI implementations require the stub to end with a .efi suffix. If
 your implementation requires this, edit /etc/default/efibootmgr-kernel-hook
 and enable "USE_STRICT_EFI_SUFFIX=1".
diff --git a/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install b/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
index cbbc318aa58d..7653d2db9ff3 100644
--- a/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
+++ b/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
@@ -28,11 +28,6 @@ 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
@@ -46,5 +41,3 @@ fi
 # create the new entry
 efibootmgr -qc $args -L "Void Linux with kernel ${major_version}" -l /vmlinuz-${VERSION}.efi -u "${OPTIONS}"
 
-# restore the boot order
-efibootmgr -qo $bootorder

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

* Re: [PR REVIEW] efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
@ 2021-03-27 12:46 ` prez
  2021-03-27 12:46 ` prez
                   ` (65 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: prez @ 2021-03-27 12:46 UTC (permalink / raw)
  To: ml

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

New review comment by prez on void-packages repository

https://github.com/void-linux/void-packages/pull/29780#discussion_r602714709

Comment:
`-n`. And this file is tracked by xbps, so this won't work anyway. 

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

* Re: [PR REVIEW] efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
  2021-03-27 12:46 ` [PR REVIEW] " prez
@ 2021-03-27 12:46 ` prez
  2021-03-27 13:14 ` Dko1905
                   ` (64 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: prez @ 2021-03-27 12:46 UTC (permalink / raw)
  To: ml

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

New review comment by prez on void-packages repository

https://github.com/void-linux/void-packages/pull/29780#discussion_r602714765

Comment:
breaks when `USE_STRICT_EFI_SUFFIX` is not set.

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

* Re: efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
  2021-03-27 12:46 ` [PR REVIEW] " prez
  2021-03-27 12:46 ` prez
@ 2021-03-27 13:14 ` Dko1905
  2021-03-27 13:48 ` [PR PATCH] [Updated] " Dko1905
                   ` (63 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: Dko1905 @ 2021-03-27 13:14 UTC (permalink / raw)
  To: ml

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

New comment by Dko1905 on void-packages repository

https://github.com/void-linux/void-packages/pull/29780#issuecomment-808731274

Comment:
I disagree, what you are suggesting could break other packages or systems. My PR only adds the possibility to use .efi instead the normal filenames. And the "restore" functionality was already broken, so I removed it.

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

* Re: [PR PATCH] [Updated] efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (2 preceding siblings ...)
  2021-03-27 13:14 ` Dko1905
@ 2021-03-27 13:48 ` Dko1905
  2021-03-27 13:49 ` [PR REVIEW] " Dko1905
                   ` (62 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: Dko1905 @ 2021-03-27 13:48 UTC (permalink / raw)
  To: ml

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

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

https://github.com/Dko1905/void-packages master
https://github.com/void-linux/void-packages/pull/29780

efibootmgr: Add strict EFI support & remove broken restore logic
#### General
- [ ] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements)

#### Have the results of the proposed changes been tested?
- [X] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me
- [ ] I generally don't use the affected packages but briefly tested this PR

<!--
If GitHub CI cannot be used to validate the build result (for example, if the
build is likely to take several hours), make sure to
[skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration).
When skipping CI, uncomment and fill out the following section.
Note: for builds that are likely to complete in less than 2 hours, it is not
acceptable to skip CI.
-->
<!-- 
#### Does it build and run successfully? 
(Please choose at least one native build and, if supported, at least one cross build. More are better.)
- [ ] I built this PR locally for my native architecture, (ARCH-LIBC)
- [ ] I built this PR locally for these architectures (if supported. mark crossbuilds):
  - [ ] aarch64-musl
  - [ ] armv7l
  - [ ] armv6l-musl
-->

I've just added a new option for using ".efi" suffixes, because some vendors don't support booting from non ".efi" files.
There are also small tab/space changes to make tabs more consistent.
The boot order "restore" functionality has been completely removed.

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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-master-29780.patch --]
[-- Type: text/x-diff, Size: 8014 bytes --]

From 938735b97ce548b606c5cb6b641dd9fcf7cadcb2 Mon Sep 17 00:00:00 2001
From: Daniel Florescu <Daniel.florescu1905@protonmail.ch>
Date: Sat, 27 Mar 2021 10:16:45 +0100
Subject: [PATCH 1/3] efibootmgr: Add new option to EFI hook

- Add new option "USE_STRICT_EFI_SUFFIX" to post-install hook.
- Update README.voidlinux to show info about the new hook.
- Fix inconsistent use of spaces and tabs in post-install hook.
---
 srcpkgs/efibootmgr/files/README.voidlinux                | 8 ++++++--
 srcpkgs/efibootmgr/files/efibootmgr-kernel-hook.confd    | 2 ++
 .../efibootmgr/files/kernel.d/efibootmgr.post-install    | 9 +++++++--
 3 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/efibootmgr/files/README.voidlinux b/srcpkgs/efibootmgr/files/README.voidlinux
index 98844fd85a65..b7904be2be64 100644
--- a/srcpkgs/efibootmgr/files/README.voidlinux
+++ b/srcpkgs/efibootmgr/files/README.voidlinux
@@ -2,8 +2,8 @@ efibootmgr can automatically generate EFI boot entries to
 directly boot the kernel after every kernel update or installation.
 Enable this by editing /etc/default/efibootmgr-kernel-hook.
 
-The EFI variables need to be accessible in order for this to work, so
-add this line to your fstab and reboot or mount manually:
+The EFI variables need to be accessible in order for this to work, either
+boot into EFI mode or add this line to your fstab and reboot or mount:
   efivarfs /sys/firmware/efi/efivars efivarfs defaults 0 0
 -----------------------------------------------------------------------
 Kernel cmd options can be configured in /etc/default/efibootmgr-kernel-hook,
@@ -17,3 +17,7 @@ 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>"
+-----------------------------------------------------------------------
+Some EFI implementations require the stub to end with a .efi suffix. If
+your implementation requires this, edit /etc/default/efibootmgr-kernel-hook
+and enable "USE_STRICT_EFI_SUFFIX=1".
diff --git a/srcpkgs/efibootmgr/files/efibootmgr-kernel-hook.confd b/srcpkgs/efibootmgr/files/efibootmgr-kernel-hook.confd
index 42adfc0da400..a6acde6a0d23 100644
--- a/srcpkgs/efibootmgr/files/efibootmgr-kernel-hook.confd
+++ b/srcpkgs/efibootmgr/files/efibootmgr-kernel-hook.confd
@@ -2,6 +2,8 @@
 MODIFY_EFI_ENTRIES=0
 # To allow efibootmgr to modify boot entries, set
 # MODIFY_EFI_ENTRIES=1
+# Use strict EFI file name spec. Default is 0
+# USE_STRICT_EFI_SUFFIX=0
 # Kernel command-line options.  Example:
 # OPTIONS="root=/dev/sda3 loglevel=4"
 # Disk where EFI Partition is.  Default is /dev/sda
diff --git a/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install b/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
index adf523e7b1fa..cbbc318aa58d 100644
--- a/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
+++ b/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
@@ -35,11 +35,16 @@ bootorder=$(efibootmgr |grep "BootOrder: " |cut -c 12-)
 
 # if existing, remove it
 if [ "$existing_entry" != "" ]; then
-  /etc/kernel.d/post-remove/50-efibootmgr $PKGNAME
+	/etc/kernel.d/post-remove/50-efibootmgr $PKGNAME
+fi
+
+# if using strict efi suffix, rename vmlinuz
+if [ "x${USE_STRICT_EFI_SUFFIX}" = x1 -a -f /boot/vmlinuz-${VERSION} ]; then
+	mv -f /boot/vmlinuz-${VERSION} /boot/vmlinuz-${VERSION}.efi
 fi
 
 # create the new entry
-efibootmgr -qc $args -L "Void Linux with kernel ${major_version}" -l /vmlinuz-${VERSION} -u "${OPTIONS}"
+efibootmgr -qc $args -L "Void Linux with kernel ${major_version}" -l /vmlinuz-${VERSION}.efi -u "${OPTIONS}"
 
 # restore the boot order
 efibootmgr -qo $bootorder

From cb1dd884526c04f3b3534d8ed03e0825ed6b4c1d Mon Sep 17 00:00:00 2001
From: Daniel Florescu <Daniel.florescu1905@protonmail.ch>
Date: Sat, 27 Mar 2021 12:55:26 +0100
Subject: [PATCH 2/3] efibootmgr: Remove the half broken boot order restore
 logic.

---
 srcpkgs/efibootmgr/files/README.voidlinux                 | 4 ----
 srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install | 7 -------
 2 files changed, 11 deletions(-)

diff --git a/srcpkgs/efibootmgr/files/README.voidlinux b/srcpkgs/efibootmgr/files/README.voidlinux
index b7904be2be64..7dfb5c05c7ba 100644
--- a/srcpkgs/efibootmgr/files/README.voidlinux
+++ b/srcpkgs/efibootmgr/files/README.voidlinux
@@ -14,10 +14,6 @@ but you always have to reconfigure the kernel:
 
 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>"
------------------------------------------------------------------------
 Some EFI implementations require the stub to end with a .efi suffix. If
 your implementation requires this, edit /etc/default/efibootmgr-kernel-hook
 and enable "USE_STRICT_EFI_SUFFIX=1".
diff --git a/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install b/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
index cbbc318aa58d..7653d2db9ff3 100644
--- a/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
+++ b/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
@@ -28,11 +28,6 @@ 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
@@ -46,5 +41,3 @@ fi
 # create the new entry
 efibootmgr -qc $args -L "Void Linux with kernel ${major_version}" -l /vmlinuz-${VERSION}.efi -u "${OPTIONS}"
 
-# restore the boot order
-efibootmgr -qo $bootorder

From d0ad886b2506837b9d4f9f1ed1d1917d6a5ee6f3 Mon Sep 17 00:00:00 2001
From: Daniel Florescu <Daniel.florescu1905@protonmail.ch>
Date: Sat, 27 Mar 2021 14:47:17 +0100
Subject: [PATCH 3/3] efibootmgr: Fix logic in efibootmgr post install script

There were some quite obvious bugs and issues that I should have seen,
but they are now fixed.
---
 .../files/kernel.d/efibootmgr.post-install    | 23 +++++++++++++------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install b/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
index 7653d2db9ff3..6739f3ba17f8 100644
--- a/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
+++ b/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
@@ -33,11 +33,20 @@ if [ "$existing_entry" != "" ]; then
 	/etc/kernel.d/post-remove/50-efibootmgr $PKGNAME
 fi
 
-# if using strict efi suffix, rename vmlinuz
-if [ "x${USE_STRICT_EFI_SUFFIX}" = x1 -a -f /boot/vmlinuz-${VERSION} ]; then
-	mv -f /boot/vmlinuz-${VERSION} /boot/vmlinuz-${VERSION}.efi
+# if using strict efi suffix
+if [ "x${USE_STRICT_EFI_SUFFIX}" = x1 ]; then
+	# rename vmlinuz
+	if [ -f /boot/vmlinuz-${VERSION} ]; then
+		mv -f /boot/vmlinuz-${VERSION} /boot/vmlinuz-${VERSION}.efi
+	fi
+	# create the new entry
+	efibootmgr -qc $args -L "Void Linux with kernel ${major_version}" -l /vmlinuz-${VERSION}.efi -u "${OPTIONS}"
+else
+	# remove efi
+	if [ -f /boot/vmlinuz-${VERSION}.efi ]; then
+		# vmlinuz is not generated on every reconfigure
+		mv -f /boot/vmlinuz-${VERSION}.efi /boot/vmlinuz-${VERSION}
+	fi
+	# create the new entry
+	efibootmgr -qc $args -L "Void Linux with kernel ${major_version}" -l /vmlinuz-${VERSION} -u "${OPTIONS}"
 fi
-
-# create the new entry
-efibootmgr -qc $args -L "Void Linux with kernel ${major_version}" -l /vmlinuz-${VERSION}.efi -u "${OPTIONS}"
-

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

* Re: [PR REVIEW] efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (3 preceding siblings ...)
  2021-03-27 13:48 ` [PR PATCH] [Updated] " Dko1905
@ 2021-03-27 13:49 ` Dko1905
  2021-03-27 13:50 ` Dko1905
                   ` (61 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: Dko1905 @ 2021-03-27 13:49 UTC (permalink / raw)
  To: ml

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

New review comment by Dko1905 on void-packages repository

https://github.com/void-linux/void-packages/pull/29780#discussion_r602721763

Comment:
I am not quite sure how I didn't catch this.

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

* Re: [PR REVIEW] efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (4 preceding siblings ...)
  2021-03-27 13:49 ` [PR REVIEW] " Dko1905
@ 2021-03-27 13:50 ` Dko1905
  2021-03-27 13:59 ` Dko1905
                   ` (60 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: Dko1905 @ 2021-03-27 13:50 UTC (permalink / raw)
  To: ml

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

New review comment by Dko1905 on void-packages repository

https://github.com/void-linux/void-packages/pull/29780#discussion_r602721838

Comment:
What do you mean? Where is it tracked?

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

* Re: [PR REVIEW] efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (5 preceding siblings ...)
  2021-03-27 13:50 ` Dko1905
@ 2021-03-27 13:59 ` Dko1905
  2021-03-27 16:20 ` Dko1905
                   ` (59 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: Dko1905 @ 2021-03-27 13:59 UTC (permalink / raw)
  To: ml

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

New review comment by Dko1905 on void-packages repository

https://github.com/void-linux/void-packages/pull/29780#discussion_r602722754

Comment:
This should now be fixed.

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

* Re: [PR REVIEW] efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (6 preceding siblings ...)
  2021-03-27 13:59 ` Dko1905
@ 2021-03-27 16:20 ` Dko1905
  2021-03-28  7:54 ` Dko1905
                   ` (58 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: Dko1905 @ 2021-03-27 16:20 UTC (permalink / raw)
  To: ml

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

New review comment by Dko1905 on void-packages repository

https://github.com/void-linux/void-packages/pull/29780#discussion_r602721838

Comment:
@prez What do you mean? Where is it tracked?

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

* Re: efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (7 preceding siblings ...)
  2021-03-27 16:20 ` Dko1905
@ 2021-03-28  7:54 ` Dko1905
  2021-04-11  2:59 ` ericonr
                   ` (57 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: Dko1905 @ 2021-03-28  7:54 UTC (permalink / raw)
  To: ml

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

New comment by Dko1905 on void-packages repository

https://github.com/void-linux/void-packages/pull/29780#issuecomment-808861628

Comment:
I forgot to mention, this pr resolves #12499

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

* Re: efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (8 preceding siblings ...)
  2021-03-28  7:54 ` Dko1905
@ 2021-04-11  2:59 ` ericonr
  2021-04-11 14:01 ` [PR REVIEW] " sgn
                   ` (56 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: ericonr @ 2021-04-11  2:59 UTC (permalink / raw)
  To: ml

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

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/29780#issuecomment-817238741

Comment:
@sgn maybe? or @Duncaen 

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

* Re: [PR REVIEW] efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (9 preceding siblings ...)
  2021-04-11  2:59 ` ericonr
@ 2021-04-11 14:01 ` sgn
  2021-04-11 14:01 ` sgn
                   ` (55 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: sgn @ 2021-04-11 14:01 UTC (permalink / raw)
  To: ml

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

New review comment by sgn on void-packages repository

https://github.com/void-linux/void-packages/pull/29780#discussion_r611192548

Comment:
I would use `USE_STRICT_EFI_SUFFIX=yes` instead. The old `0` and `1` is not so good, me think.

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

* Re: [PR REVIEW] efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (10 preceding siblings ...)
  2021-04-11 14:01 ` [PR REVIEW] " sgn
@ 2021-04-11 14:01 ` sgn
  2021-04-11 14:01 ` sgn
                   ` (54 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: sgn @ 2021-04-11 14:01 UTC (permalink / raw)
  To: ml

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

New review comment by sgn on void-packages repository

https://github.com/void-linux/void-packages/pull/29780#discussion_r611192706

Comment:
And we will write something like:

```sh
if [ "${USE_STRICT_EFI_SUFFIX}" ]; then
   : do something
fi
```


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

* Re: [PR REVIEW] efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (11 preceding siblings ...)
  2021-04-11 14:01 ` sgn
@ 2021-04-11 14:01 ` sgn
  2021-04-11 14:21 ` Duncaen
                   ` (53 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: sgn @ 2021-04-11 14:01 UTC (permalink / raw)
  To: ml

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

New review comment by sgn on void-packages repository

https://github.com/void-linux/void-packages/pull/29780#discussion_r611193100

Comment:
For the new codepath, I would expect we will have an entry for each version, instead of single entry for the whole major version. The current hook only allows 1 version for the whole major version, which is bad if the new version is broken.

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

* Re: efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (12 preceding siblings ...)
  2021-04-11 14:01 ` sgn
@ 2021-04-11 14:21 ` Duncaen
  2021-04-11 14:23 ` Duncaen
                   ` (52 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: Duncaen @ 2021-04-11 14:21 UTC (permalink / raw)
  To: ml

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

New comment by Duncaen on void-packages repository

https://github.com/void-linux/void-packages/pull/29780#issuecomment-817315821

Comment:
changing the file name makes `vkpurge` think the kernel is not owned by any package and would allow removal even though the kernel package is still installed or booted.

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

* Re: efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (13 preceding siblings ...)
  2021-04-11 14:21 ` Duncaen
@ 2021-04-11 14:23 ` Duncaen
  2021-04-11 18:06 ` [PR REVIEW] " Dko1905
                   ` (51 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: Duncaen @ 2021-04-11 14:23 UTC (permalink / raw)
  To: ml

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

New comment by Duncaen on void-packages repository

https://github.com/void-linux/void-packages/pull/29780#issuecomment-817315821

Comment:
changing the file name makes `vkpurge` think the kernel is not owned by any package and would allow removal even though the kernel package is still installed. It also allows to remove the booted kernel as it currently relies on splitting the kernel file at the first `-` and then comparing the suffix to `uname -r`.

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

* Re: [PR REVIEW] efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (14 preceding siblings ...)
  2021-04-11 14:23 ` Duncaen
@ 2021-04-11 18:06 ` Dko1905
  2021-04-11 18:07 ` Dko1905
                   ` (50 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: Dko1905 @ 2021-04-11 18:06 UTC (permalink / raw)
  To: ml

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

New review comment by Dko1905 on void-packages repository

https://github.com/void-linux/void-packages/pull/29780#discussion_r611225002

Comment:
I'm just being consistent with the rest of the file.

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

* Re: [PR REVIEW] efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (15 preceding siblings ...)
  2021-04-11 18:06 ` [PR REVIEW] " Dko1905
@ 2021-04-11 18:07 ` Dko1905
  2021-04-11 18:07 ` Dko1905
                   ` (49 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: Dko1905 @ 2021-04-11 18:07 UTC (permalink / raw)
  To: ml

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

New review comment by Dko1905 on void-packages repository

https://github.com/void-linux/void-packages/pull/29780#discussion_r611225117

Comment:
Same answer, consistently

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

* Re: [PR REVIEW] efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (16 preceding siblings ...)
  2021-04-11 18:07 ` Dko1905
@ 2021-04-11 18:07 ` Dko1905
  2021-04-11 18:09 ` Dko1905
                   ` (48 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: Dko1905 @ 2021-04-11 18:07 UTC (permalink / raw)
  To: ml

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

New review comment by Dko1905 on void-packages repository

https://github.com/void-linux/void-packages/pull/29780#discussion_r611225117

Comment:
Same answer, consistency

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

* Re: [PR REVIEW] efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (17 preceding siblings ...)
  2021-04-11 18:07 ` Dko1905
@ 2021-04-11 18:09 ` Dko1905
  2021-04-11 18:12 ` Dko1905
                   ` (47 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: Dko1905 @ 2021-04-11 18:09 UTC (permalink / raw)
  To: ml

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

New review comment by Dko1905 on void-packages repository

https://github.com/void-linux/void-packages/pull/29780#discussion_r611225368

Comment:
I'm not here to fix the hook, I just want to make it work on certain laptops, including mine.

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

* Re: efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (18 preceding siblings ...)
  2021-04-11 18:09 ` Dko1905
@ 2021-04-11 18:12 ` Dko1905
  2021-04-27 12:27 ` [PR PATCH] [Updated] " Dko1905
                   ` (46 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: Dko1905 @ 2021-04-11 18:12 UTC (permalink / raw)
  To: ml

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

New comment by Dko1905 on void-packages repository

https://github.com/void-linux/void-packages/pull/29780#issuecomment-817348955

Comment:
It sounds like it requires a lot of changes to make it work as you want it, I just want this one change. I could write a warning about `vkpurge` not working as intended, but is it necessary?

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

* Re: [PR PATCH] [Updated] efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (19 preceding siblings ...)
  2021-04-11 18:12 ` Dko1905
@ 2021-04-27 12:27 ` Dko1905
  2021-06-16  9:21 ` Dko1905
                   ` (45 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: Dko1905 @ 2021-04-27 12:27 UTC (permalink / raw)
  To: ml

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

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

https://github.com/Dko1905/void-packages master
https://github.com/void-linux/void-packages/pull/29780

efibootmgr: Add strict EFI support & remove broken restore logic
#### General
- [ ] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements)

#### Have the results of the proposed changes been tested?
- [X] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me
- [ ] I generally don't use the affected packages but briefly tested this PR

<!--
If GitHub CI cannot be used to validate the build result (for example, if the
build is likely to take several hours), make sure to
[skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration).
When skipping CI, uncomment and fill out the following section.
Note: for builds that are likely to complete in less than 2 hours, it is not
acceptable to skip CI.
-->
<!-- 
#### Does it build and run successfully? 
(Please choose at least one native build and, if supported, at least one cross build. More are better.)
- [ ] I built this PR locally for my native architecture, (ARCH-LIBC)
- [ ] I built this PR locally for these architectures (if supported. mark crossbuilds):
  - [ ] aarch64-musl
  - [ ] armv7l
  - [ ] armv6l-musl
-->

I've just added a new option for using ".efi" suffixes, because some vendors don't support booting from non ".efi" files.
There are also small tab/space changes to make tabs more consistent.
The boot order "restore" functionality has been completely removed.

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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-master-29780.patch --]
[-- Type: text/x-diff, Size: 8761 bytes --]

From 938735b97ce548b606c5cb6b641dd9fcf7cadcb2 Mon Sep 17 00:00:00 2001
From: Daniel Florescu <Daniel.florescu1905@protonmail.ch>
Date: Sat, 27 Mar 2021 10:16:45 +0100
Subject: [PATCH 1/4] efibootmgr: Add new option to EFI hook

- Add new option "USE_STRICT_EFI_SUFFIX" to post-install hook.
- Update README.voidlinux to show info about the new hook.
- Fix inconsistent use of spaces and tabs in post-install hook.
---
 srcpkgs/efibootmgr/files/README.voidlinux                | 8 ++++++--
 srcpkgs/efibootmgr/files/efibootmgr-kernel-hook.confd    | 2 ++
 .../efibootmgr/files/kernel.d/efibootmgr.post-install    | 9 +++++++--
 3 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/efibootmgr/files/README.voidlinux b/srcpkgs/efibootmgr/files/README.voidlinux
index 98844fd85a65..b7904be2be64 100644
--- a/srcpkgs/efibootmgr/files/README.voidlinux
+++ b/srcpkgs/efibootmgr/files/README.voidlinux
@@ -2,8 +2,8 @@ efibootmgr can automatically generate EFI boot entries to
 directly boot the kernel after every kernel update or installation.
 Enable this by editing /etc/default/efibootmgr-kernel-hook.
 
-The EFI variables need to be accessible in order for this to work, so
-add this line to your fstab and reboot or mount manually:
+The EFI variables need to be accessible in order for this to work, either
+boot into EFI mode or add this line to your fstab and reboot or mount:
   efivarfs /sys/firmware/efi/efivars efivarfs defaults 0 0
 -----------------------------------------------------------------------
 Kernel cmd options can be configured in /etc/default/efibootmgr-kernel-hook,
@@ -17,3 +17,7 @@ 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>"
+-----------------------------------------------------------------------
+Some EFI implementations require the stub to end with a .efi suffix. If
+your implementation requires this, edit /etc/default/efibootmgr-kernel-hook
+and enable "USE_STRICT_EFI_SUFFIX=1".
diff --git a/srcpkgs/efibootmgr/files/efibootmgr-kernel-hook.confd b/srcpkgs/efibootmgr/files/efibootmgr-kernel-hook.confd
index 42adfc0da400..a6acde6a0d23 100644
--- a/srcpkgs/efibootmgr/files/efibootmgr-kernel-hook.confd
+++ b/srcpkgs/efibootmgr/files/efibootmgr-kernel-hook.confd
@@ -2,6 +2,8 @@
 MODIFY_EFI_ENTRIES=0
 # To allow efibootmgr to modify boot entries, set
 # MODIFY_EFI_ENTRIES=1
+# Use strict EFI file name spec. Default is 0
+# USE_STRICT_EFI_SUFFIX=0
 # Kernel command-line options.  Example:
 # OPTIONS="root=/dev/sda3 loglevel=4"
 # Disk where EFI Partition is.  Default is /dev/sda
diff --git a/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install b/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
index adf523e7b1fa..cbbc318aa58d 100644
--- a/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
+++ b/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
@@ -35,11 +35,16 @@ bootorder=$(efibootmgr |grep "BootOrder: " |cut -c 12-)
 
 # if existing, remove it
 if [ "$existing_entry" != "" ]; then
-  /etc/kernel.d/post-remove/50-efibootmgr $PKGNAME
+	/etc/kernel.d/post-remove/50-efibootmgr $PKGNAME
+fi
+
+# if using strict efi suffix, rename vmlinuz
+if [ "x${USE_STRICT_EFI_SUFFIX}" = x1 -a -f /boot/vmlinuz-${VERSION} ]; then
+	mv -f /boot/vmlinuz-${VERSION} /boot/vmlinuz-${VERSION}.efi
 fi
 
 # create the new entry
-efibootmgr -qc $args -L "Void Linux with kernel ${major_version}" -l /vmlinuz-${VERSION} -u "${OPTIONS}"
+efibootmgr -qc $args -L "Void Linux with kernel ${major_version}" -l /vmlinuz-${VERSION}.efi -u "${OPTIONS}"
 
 # restore the boot order
 efibootmgr -qo $bootorder

From cb1dd884526c04f3b3534d8ed03e0825ed6b4c1d Mon Sep 17 00:00:00 2001
From: Daniel Florescu <Daniel.florescu1905@protonmail.ch>
Date: Sat, 27 Mar 2021 12:55:26 +0100
Subject: [PATCH 2/4] efibootmgr: Remove the half broken boot order restore
 logic.

---
 srcpkgs/efibootmgr/files/README.voidlinux                 | 4 ----
 srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install | 7 -------
 2 files changed, 11 deletions(-)

diff --git a/srcpkgs/efibootmgr/files/README.voidlinux b/srcpkgs/efibootmgr/files/README.voidlinux
index b7904be2be64..7dfb5c05c7ba 100644
--- a/srcpkgs/efibootmgr/files/README.voidlinux
+++ b/srcpkgs/efibootmgr/files/README.voidlinux
@@ -14,10 +14,6 @@ but you always have to reconfigure the kernel:
 
 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>"
------------------------------------------------------------------------
 Some EFI implementations require the stub to end with a .efi suffix. If
 your implementation requires this, edit /etc/default/efibootmgr-kernel-hook
 and enable "USE_STRICT_EFI_SUFFIX=1".
diff --git a/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install b/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
index cbbc318aa58d..7653d2db9ff3 100644
--- a/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
+++ b/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
@@ -28,11 +28,6 @@ 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
@@ -46,5 +41,3 @@ fi
 # create the new entry
 efibootmgr -qc $args -L "Void Linux with kernel ${major_version}" -l /vmlinuz-${VERSION}.efi -u "${OPTIONS}"
 
-# restore the boot order
-efibootmgr -qo $bootorder

From d0ad886b2506837b9d4f9f1ed1d1917d6a5ee6f3 Mon Sep 17 00:00:00 2001
From: Daniel Florescu <Daniel.florescu1905@protonmail.ch>
Date: Sat, 27 Mar 2021 14:47:17 +0100
Subject: [PATCH 3/4] efibootmgr: Fix logic in efibootmgr post install script

There were some quite obvious bugs and issues that I should have seen,
but they are now fixed.
---
 .../files/kernel.d/efibootmgr.post-install    | 23 +++++++++++++------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install b/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
index 7653d2db9ff3..6739f3ba17f8 100644
--- a/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
+++ b/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
@@ -33,11 +33,20 @@ if [ "$existing_entry" != "" ]; then
 	/etc/kernel.d/post-remove/50-efibootmgr $PKGNAME
 fi
 
-# if using strict efi suffix, rename vmlinuz
-if [ "x${USE_STRICT_EFI_SUFFIX}" = x1 -a -f /boot/vmlinuz-${VERSION} ]; then
-	mv -f /boot/vmlinuz-${VERSION} /boot/vmlinuz-${VERSION}.efi
+# if using strict efi suffix
+if [ "x${USE_STRICT_EFI_SUFFIX}" = x1 ]; then
+	# rename vmlinuz
+	if [ -f /boot/vmlinuz-${VERSION} ]; then
+		mv -f /boot/vmlinuz-${VERSION} /boot/vmlinuz-${VERSION}.efi
+	fi
+	# create the new entry
+	efibootmgr -qc $args -L "Void Linux with kernel ${major_version}" -l /vmlinuz-${VERSION}.efi -u "${OPTIONS}"
+else
+	# remove efi
+	if [ -f /boot/vmlinuz-${VERSION}.efi ]; then
+		# vmlinuz is not generated on every reconfigure
+		mv -f /boot/vmlinuz-${VERSION}.efi /boot/vmlinuz-${VERSION}
+	fi
+	# create the new entry
+	efibootmgr -qc $args -L "Void Linux with kernel ${major_version}" -l /vmlinuz-${VERSION} -u "${OPTIONS}"
 fi
-
-# create the new entry
-efibootmgr -qc $args -L "Void Linux with kernel ${major_version}" -l /vmlinuz-${VERSION}.efi -u "${OPTIONS}"
-

From 17c069e80a8101b514188057ea562d192f462d16 Mon Sep 17 00:00:00 2001
From: Daniel Florescu <Daniel.florescu1905@protonmail.ch>
Date: Tue, 27 Apr 2021 14:26:34 +0200
Subject: [PATCH 4/4] efibootmgr: Bump revision number in template.

---
 srcpkgs/efibootmgr/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/efibootmgr/template b/srcpkgs/efibootmgr/template
index bd2e88bbbeac..deeb8dffc583 100644
--- a/srcpkgs/efibootmgr/template
+++ b/srcpkgs/efibootmgr/template
@@ -1,7 +1,7 @@
 # Template file for 'efibootmgr'
 pkgname=efibootmgr
 version=17
-revision=6
+revision=7
 hostmakedepends="pkg-config"
 makedepends="libefivar-devel popt-devel"
 short_desc="Tool to modify UEFI Firmware Boot Manager Variables"

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

* Re: [PR PATCH] [Updated] efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (20 preceding siblings ...)
  2021-04-27 12:27 ` [PR PATCH] [Updated] " Dko1905
@ 2021-06-16  9:21 ` Dko1905
  2021-08-25 20:03 ` Dko1905
                   ` (44 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: Dko1905 @ 2021-06-16  9:21 UTC (permalink / raw)
  To: ml

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

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

https://github.com/Dko1905/void-packages master
https://github.com/void-linux/void-packages/pull/29780

efibootmgr: Add strict EFI support & remove broken restore logic
#### General
- [ ] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements)

#### Have the results of the proposed changes been tested?
- [X] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me
- [ ] I generally don't use the affected packages but briefly tested this PR

<!--
If GitHub CI cannot be used to validate the build result (for example, if the
build is likely to take several hours), make sure to
[skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration).
When skipping CI, uncomment and fill out the following section.
Note: for builds that are likely to complete in less than 2 hours, it is not
acceptable to skip CI.
-->
<!-- 
#### Does it build and run successfully? 
(Please choose at least one native build and, if supported, at least one cross build. More are better.)
- [ ] I built this PR locally for my native architecture, (ARCH-LIBC)
- [ ] I built this PR locally for these architectures (if supported. mark crossbuilds):
  - [ ] aarch64-musl
  - [ ] armv7l
  - [ ] armv6l-musl
-->

I've just added a new option for using ".efi" suffixes, because some vendors don't support booting from non ".efi" files.
There are also small tab/space changes to make tabs more consistent.
The boot order "restore" functionality has been completely removed.

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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-master-29780.patch --]
[-- Type: text/x-diff, Size: 8761 bytes --]

From c38735d7db83433632c0e60b108643927a103ee5 Mon Sep 17 00:00:00 2001
From: Daniel Florescu <Daniel.florescu1905@protonmail.ch>
Date: Sat, 27 Mar 2021 10:16:45 +0100
Subject: [PATCH 1/4] efibootmgr: Add new option to EFI hook

- Add new option "USE_STRICT_EFI_SUFFIX" to post-install hook.
- Update README.voidlinux to show info about the new hook.
- Fix inconsistent use of spaces and tabs in post-install hook.
---
 srcpkgs/efibootmgr/files/README.voidlinux                | 8 ++++++--
 srcpkgs/efibootmgr/files/efibootmgr-kernel-hook.confd    | 2 ++
 .../efibootmgr/files/kernel.d/efibootmgr.post-install    | 9 +++++++--
 3 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/srcpkgs/efibootmgr/files/README.voidlinux b/srcpkgs/efibootmgr/files/README.voidlinux
index 98844fd85a65..b7904be2be64 100644
--- a/srcpkgs/efibootmgr/files/README.voidlinux
+++ b/srcpkgs/efibootmgr/files/README.voidlinux
@@ -2,8 +2,8 @@ efibootmgr can automatically generate EFI boot entries to
 directly boot the kernel after every kernel update or installation.
 Enable this by editing /etc/default/efibootmgr-kernel-hook.
 
-The EFI variables need to be accessible in order for this to work, so
-add this line to your fstab and reboot or mount manually:
+The EFI variables need to be accessible in order for this to work, either
+boot into EFI mode or add this line to your fstab and reboot or mount:
   efivarfs /sys/firmware/efi/efivars efivarfs defaults 0 0
 -----------------------------------------------------------------------
 Kernel cmd options can be configured in /etc/default/efibootmgr-kernel-hook,
@@ -17,3 +17,7 @@ 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>"
+-----------------------------------------------------------------------
+Some EFI implementations require the stub to end with a .efi suffix. If
+your implementation requires this, edit /etc/default/efibootmgr-kernel-hook
+and enable "USE_STRICT_EFI_SUFFIX=1".
diff --git a/srcpkgs/efibootmgr/files/efibootmgr-kernel-hook.confd b/srcpkgs/efibootmgr/files/efibootmgr-kernel-hook.confd
index 42adfc0da400..a6acde6a0d23 100644
--- a/srcpkgs/efibootmgr/files/efibootmgr-kernel-hook.confd
+++ b/srcpkgs/efibootmgr/files/efibootmgr-kernel-hook.confd
@@ -2,6 +2,8 @@
 MODIFY_EFI_ENTRIES=0
 # To allow efibootmgr to modify boot entries, set
 # MODIFY_EFI_ENTRIES=1
+# Use strict EFI file name spec. Default is 0
+# USE_STRICT_EFI_SUFFIX=0
 # Kernel command-line options.  Example:
 # OPTIONS="root=/dev/sda3 loglevel=4"
 # Disk where EFI Partition is.  Default is /dev/sda
diff --git a/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install b/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
index adf523e7b1fa..cbbc318aa58d 100644
--- a/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
+++ b/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
@@ -35,11 +35,16 @@ bootorder=$(efibootmgr |grep "BootOrder: " |cut -c 12-)
 
 # if existing, remove it
 if [ "$existing_entry" != "" ]; then
-  /etc/kernel.d/post-remove/50-efibootmgr $PKGNAME
+	/etc/kernel.d/post-remove/50-efibootmgr $PKGNAME
+fi
+
+# if using strict efi suffix, rename vmlinuz
+if [ "x${USE_STRICT_EFI_SUFFIX}" = x1 -a -f /boot/vmlinuz-${VERSION} ]; then
+	mv -f /boot/vmlinuz-${VERSION} /boot/vmlinuz-${VERSION}.efi
 fi
 
 # create the new entry
-efibootmgr -qc $args -L "Void Linux with kernel ${major_version}" -l /vmlinuz-${VERSION} -u "${OPTIONS}"
+efibootmgr -qc $args -L "Void Linux with kernel ${major_version}" -l /vmlinuz-${VERSION}.efi -u "${OPTIONS}"
 
 # restore the boot order
 efibootmgr -qo $bootorder

From 70ba33a0437077513736329fd823f3a9beabe386 Mon Sep 17 00:00:00 2001
From: Daniel Florescu <Daniel.florescu1905@protonmail.ch>
Date: Sat, 27 Mar 2021 12:55:26 +0100
Subject: [PATCH 2/4] efibootmgr: Remove the half broken boot order restore
 logic.

---
 srcpkgs/efibootmgr/files/README.voidlinux                 | 4 ----
 srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install | 7 -------
 2 files changed, 11 deletions(-)

diff --git a/srcpkgs/efibootmgr/files/README.voidlinux b/srcpkgs/efibootmgr/files/README.voidlinux
index b7904be2be64..7dfb5c05c7ba 100644
--- a/srcpkgs/efibootmgr/files/README.voidlinux
+++ b/srcpkgs/efibootmgr/files/README.voidlinux
@@ -14,10 +14,6 @@ but you always have to reconfigure the kernel:
 
 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>"
------------------------------------------------------------------------
 Some EFI implementations require the stub to end with a .efi suffix. If
 your implementation requires this, edit /etc/default/efibootmgr-kernel-hook
 and enable "USE_STRICT_EFI_SUFFIX=1".
diff --git a/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install b/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
index cbbc318aa58d..7653d2db9ff3 100644
--- a/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
+++ b/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
@@ -28,11 +28,6 @@ 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
@@ -46,5 +41,3 @@ fi
 # create the new entry
 efibootmgr -qc $args -L "Void Linux with kernel ${major_version}" -l /vmlinuz-${VERSION}.efi -u "${OPTIONS}"
 
-# restore the boot order
-efibootmgr -qo $bootorder

From 533fa0d08da83b2c4a30af8fce2682eaec49ed89 Mon Sep 17 00:00:00 2001
From: Daniel Florescu <Daniel.florescu1905@protonmail.ch>
Date: Sat, 27 Mar 2021 14:47:17 +0100
Subject: [PATCH 3/4] efibootmgr: Fix logic in efibootmgr post install script

There were some quite obvious bugs and issues that I should have seen,
but they are now fixed.
---
 .../files/kernel.d/efibootmgr.post-install    | 23 +++++++++++++------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install b/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
index 7653d2db9ff3..6739f3ba17f8 100644
--- a/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
+++ b/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
@@ -33,11 +33,20 @@ if [ "$existing_entry" != "" ]; then
 	/etc/kernel.d/post-remove/50-efibootmgr $PKGNAME
 fi
 
-# if using strict efi suffix, rename vmlinuz
-if [ "x${USE_STRICT_EFI_SUFFIX}" = x1 -a -f /boot/vmlinuz-${VERSION} ]; then
-	mv -f /boot/vmlinuz-${VERSION} /boot/vmlinuz-${VERSION}.efi
+# if using strict efi suffix
+if [ "x${USE_STRICT_EFI_SUFFIX}" = x1 ]; then
+	# rename vmlinuz
+	if [ -f /boot/vmlinuz-${VERSION} ]; then
+		mv -f /boot/vmlinuz-${VERSION} /boot/vmlinuz-${VERSION}.efi
+	fi
+	# create the new entry
+	efibootmgr -qc $args -L "Void Linux with kernel ${major_version}" -l /vmlinuz-${VERSION}.efi -u "${OPTIONS}"
+else
+	# remove efi
+	if [ -f /boot/vmlinuz-${VERSION}.efi ]; then
+		# vmlinuz is not generated on every reconfigure
+		mv -f /boot/vmlinuz-${VERSION}.efi /boot/vmlinuz-${VERSION}
+	fi
+	# create the new entry
+	efibootmgr -qc $args -L "Void Linux with kernel ${major_version}" -l /vmlinuz-${VERSION} -u "${OPTIONS}"
 fi
-
-# create the new entry
-efibootmgr -qc $args -L "Void Linux with kernel ${major_version}" -l /vmlinuz-${VERSION}.efi -u "${OPTIONS}"
-

From 2825c13095e46b5e90c48702e10a0d9a2d6386fc Mon Sep 17 00:00:00 2001
From: Daniel Florescu <Daniel.florescu1905@protonmail.ch>
Date: Tue, 27 Apr 2021 14:26:34 +0200
Subject: [PATCH 4/4] efibootmgr: Bump revision number in template.

---
 srcpkgs/efibootmgr/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/efibootmgr/template b/srcpkgs/efibootmgr/template
index bd2e88bbbeac..deeb8dffc583 100644
--- a/srcpkgs/efibootmgr/template
+++ b/srcpkgs/efibootmgr/template
@@ -1,7 +1,7 @@
 # Template file for 'efibootmgr'
 pkgname=efibootmgr
 version=17
-revision=6
+revision=7
 hostmakedepends="pkg-config"
 makedepends="libefivar-devel popt-devel"
 short_desc="Tool to modify UEFI Firmware Boot Manager Variables"

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

* Re: efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (21 preceding siblings ...)
  2021-06-16  9:21 ` Dko1905
@ 2021-08-25 20:03 ` Dko1905
  2021-08-25 20:13 ` [PR REVIEW] " ericonr
                   ` (43 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: Dko1905 @ 2021-08-25 20:03 UTC (permalink / raw)
  To: ml

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

New comment by Dko1905 on void-packages repository

https://github.com/void-linux/void-packages/pull/29780#issuecomment-905834496

Comment:
Should I "bump" this pr or something?
It's getting quite old, and the bug it fixes is quite irritating.

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

* Re: [PR REVIEW] efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (22 preceding siblings ...)
  2021-08-25 20:03 ` Dko1905
@ 2021-08-25 20:13 ` ericonr
  2021-08-25 20:13 ` ericonr
                   ` (42 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: ericonr @ 2021-08-25 20:13 UTC (permalink / raw)
  To: ml

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

New review comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/29780#discussion_r696079147

Comment:
Why is there a change here?

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

* Re: [PR REVIEW] efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (23 preceding siblings ...)
  2021-08-25 20:13 ` [PR REVIEW] " ericonr
@ 2021-08-25 20:13 ` ericonr
  2021-08-26  6:29 ` Dko1905
                   ` (41 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: ericonr @ 2021-08-25 20:13 UTC (permalink / raw)
  To: ml

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

New review comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/29780#discussion_r696079660

Comment:
Let's leave it clean :)

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

* Re: [PR REVIEW] efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (24 preceding siblings ...)
  2021-08-25 20:13 ` ericonr
@ 2021-08-26  6:29 ` Dko1905
  2021-08-26  6:35 ` Dko1905
                   ` (40 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: Dko1905 @ 2021-08-26  6:29 UTC (permalink / raw)
  To: ml

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

New review comment by Dko1905 on void-packages repository

https://github.com/void-linux/void-packages/pull/29780#discussion_r696328938

Comment:
I changed from spaces to tabs, since both where used in the file. Now the file only uses tabs.

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

* Re: [PR REVIEW] efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (25 preceding siblings ...)
  2021-08-26  6:29 ` Dko1905
@ 2021-08-26  6:35 ` Dko1905
  2021-08-28 14:52 ` Dko1905
                   ` (39 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: Dko1905 @ 2021-08-26  6:35 UTC (permalink / raw)
  To: ml

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

New review comment by Dko1905 on void-packages repository

https://github.com/void-linux/void-packages/pull/29780#discussion_r696331864

Comment:
I'm not quite sure what you mean.
Do you want all `if`s changed, or only this one?
I would personally prefer not changing them.

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

* Re: [PR REVIEW] efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (26 preceding siblings ...)
  2021-08-26  6:35 ` Dko1905
@ 2021-08-28 14:52 ` Dko1905
  2021-08-28 14:59 ` Dko1905
                   ` (38 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: Dko1905 @ 2021-08-28 14:52 UTC (permalink / raw)
  To: ml

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

New review comment by Dko1905 on void-packages repository

https://github.com/void-linux/void-packages/pull/29780#discussion_r697879560

Comment:
@sgn Your code executes `do something` even if `USE_STRICT_EFI_SUFFIX` is set to `0`, and the previous code used the same way of checking a variable for `1`.
I will resolve the conversation, if you have more to add, open it again.

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

* Re: [PR REVIEW] efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (27 preceding siblings ...)
  2021-08-28 14:52 ` Dko1905
@ 2021-08-28 14:59 ` Dko1905
  2021-08-28 15:00 ` Dko1905
                   ` (37 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: Dko1905 @ 2021-08-28 14:59 UTC (permalink / raw)
  To: ml

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

New review comment by Dko1905 on void-packages repository

https://github.com/void-linux/void-packages/pull/29780#discussion_r697880196

Comment:
More accurately, the file used tabs everywhere except there, I fixed that.

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

* Re: efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (28 preceding siblings ...)
  2021-08-28 14:59 ` Dko1905
@ 2021-08-28 15:00 ` Dko1905
  2021-08-28 17:46 ` ericonr
                   ` (36 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: Dko1905 @ 2021-08-28 15:00 UTC (permalink / raw)
  To: ml

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

New comment by Dko1905 on void-packages repository

https://github.com/void-linux/void-packages/pull/29780#issuecomment-907638298

Comment:
Should I squash all the commits into one commit, or would that require reviewing the code again?

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

* Re: efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (29 preceding siblings ...)
  2021-08-28 15:00 ` Dko1905
@ 2021-08-28 17:46 ` ericonr
  2021-08-29 16:15 ` [PR PATCH] [Updated] " Dko1905
                   ` (35 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: ericonr @ 2021-08-28 17:46 UTC (permalink / raw)
  To: ml

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

New comment by ericonr on void-packages repository

https://github.com/void-linux/void-packages/pull/29780#issuecomment-907662603

Comment:
Please squash into a single commit.

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

* Re: [PR PATCH] [Updated] efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (30 preceding siblings ...)
  2021-08-28 17:46 ` ericonr
@ 2021-08-29 16:15 ` Dko1905
  2021-08-29 16:17 ` Dko1905
                   ` (34 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: Dko1905 @ 2021-08-29 16:15 UTC (permalink / raw)
  To: ml

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

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

https://github.com/Dko1905/void-packages master
https://github.com/void-linux/void-packages/pull/29780

efibootmgr: Add strict EFI support & remove broken restore logic
#### General
- [ ] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements)

#### Have the results of the proposed changes been tested?
- [X] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me
- [ ] I generally don't use the affected packages but briefly tested this PR

<!--
If GitHub CI cannot be used to validate the build result (for example, if the
build is likely to take several hours), make sure to
[skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration).
When skipping CI, uncomment and fill out the following section.
Note: for builds that are likely to complete in less than 2 hours, it is not
acceptable to skip CI.
-->
<!-- 
#### Does it build and run successfully? 
(Please choose at least one native build and, if supported, at least one cross build. More are better.)
- [ ] I built this PR locally for my native architecture, (ARCH-LIBC)
- [ ] I built this PR locally for these architectures (if supported. mark crossbuilds):
  - [ ] aarch64-musl
  - [ ] armv7l
  - [ ] armv6l-musl
-->

I've just added a new option for using ".efi" suffixes, because some vendors don't support booting from non ".efi" files.
There are also small tab/space changes to make tabs more consistent.
The boot order "restore" functionality has been completely removed.

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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-master-29780.patch --]
[-- Type: text/x-diff, Size: 5032 bytes --]

From 9b3daae57a1ef95bc8361b4697a3441298a4a1a4 Mon Sep 17 00:00:00 2001
From: Daniel Florescu <Daniel.florescu1905@protonmail.ch>
Date: Sat, 27 Mar 2021 10:16:45 +0100
Subject: [PATCH] efibootmgr: Add new option to EFI hook

- Add new option "USE_STRICT_EFI_SUFFIX" to post-install hook.
- Update README.voidlinux to show info about the new hook.
- Fix inconsistent use of spaces and tabs in post-install hook.
- Bump revision number in template.
---
 srcpkgs/efibootmgr/files/README.voidlinux     | 10 +++----
 .../files/efibootmgr-kernel-hook.confd        |  2 ++
 .../files/kernel.d/efibootmgr.post-install    | 29 ++++++++++++-------
 srcpkgs/efibootmgr/template                   |  2 +-
 4 files changed, 26 insertions(+), 17 deletions(-)

diff --git a/srcpkgs/efibootmgr/files/README.voidlinux b/srcpkgs/efibootmgr/files/README.voidlinux
index 98844fd85a65..7dfb5c05c7ba 100644
--- a/srcpkgs/efibootmgr/files/README.voidlinux
+++ b/srcpkgs/efibootmgr/files/README.voidlinux
@@ -2,8 +2,8 @@ efibootmgr can automatically generate EFI boot entries to
 directly boot the kernel after every kernel update or installation.
 Enable this by editing /etc/default/efibootmgr-kernel-hook.
 
-The EFI variables need to be accessible in order for this to work, so
-add this line to your fstab and reboot or mount manually:
+The EFI variables need to be accessible in order for this to work, either
+boot into EFI mode or add this line to your fstab and reboot or mount:
   efivarfs /sys/firmware/efi/efivars efivarfs defaults 0 0
 -----------------------------------------------------------------------
 Kernel cmd options can be configured in /etc/default/efibootmgr-kernel-hook,
@@ -14,6 +14,6 @@ but you always have to reconfigure the kernel:
 
 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>"
+Some EFI implementations require the stub to end with a .efi suffix. If
+your implementation requires this, edit /etc/default/efibootmgr-kernel-hook
+and enable "USE_STRICT_EFI_SUFFIX=1".
diff --git a/srcpkgs/efibootmgr/files/efibootmgr-kernel-hook.confd b/srcpkgs/efibootmgr/files/efibootmgr-kernel-hook.confd
index 42adfc0da400..a6acde6a0d23 100644
--- a/srcpkgs/efibootmgr/files/efibootmgr-kernel-hook.confd
+++ b/srcpkgs/efibootmgr/files/efibootmgr-kernel-hook.confd
@@ -2,6 +2,8 @@
 MODIFY_EFI_ENTRIES=0
 # To allow efibootmgr to modify boot entries, set
 # MODIFY_EFI_ENTRIES=1
+# Use strict EFI file name spec. Default is 0
+# USE_STRICT_EFI_SUFFIX=0
 # Kernel command-line options.  Example:
 # OPTIONS="root=/dev/sda3 loglevel=4"
 # Disk where EFI Partition is.  Default is /dev/sda
diff --git a/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install b/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
index adf523e7b1fa..6739f3ba17f8 100644
--- a/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
+++ b/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
@@ -28,18 +28,25 @@ 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
+	/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
+# if using strict efi suffix
+if [ "x${USE_STRICT_EFI_SUFFIX}" = x1 ]; then
+	# rename vmlinuz
+	if [ -f /boot/vmlinuz-${VERSION} ]; then
+		mv -f /boot/vmlinuz-${VERSION} /boot/vmlinuz-${VERSION}.efi
+	fi
+	# create the new entry
+	efibootmgr -qc $args -L "Void Linux with kernel ${major_version}" -l /vmlinuz-${VERSION}.efi -u "${OPTIONS}"
+else
+	# remove efi
+	if [ -f /boot/vmlinuz-${VERSION}.efi ]; then
+		# vmlinuz is not generated on every reconfigure
+		mv -f /boot/vmlinuz-${VERSION}.efi /boot/vmlinuz-${VERSION}
+	fi
+	# create the new entry
+	efibootmgr -qc $args -L "Void Linux with kernel ${major_version}" -l /vmlinuz-${VERSION} -u "${OPTIONS}"
+fi
diff --git a/srcpkgs/efibootmgr/template b/srcpkgs/efibootmgr/template
index bd2e88bbbeac..deeb8dffc583 100644
--- a/srcpkgs/efibootmgr/template
+++ b/srcpkgs/efibootmgr/template
@@ -1,7 +1,7 @@
 # Template file for 'efibootmgr'
 pkgname=efibootmgr
 version=17
-revision=6
+revision=7
 hostmakedepends="pkg-config"
 makedepends="libefivar-devel popt-devel"
 short_desc="Tool to modify UEFI Firmware Boot Manager Variables"

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

* Re: efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (31 preceding siblings ...)
  2021-08-29 16:15 ` [PR PATCH] [Updated] " Dko1905
@ 2021-08-29 16:17 ` Dko1905
  2021-09-04 15:15 ` Dko1905
                   ` (33 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: Dko1905 @ 2021-08-29 16:17 UTC (permalink / raw)
  To: ml

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

New comment by Dko1905 on void-packages repository

https://github.com/void-linux/void-packages/pull/29780#issuecomment-907819823

Comment:
Done :)

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

* Re: efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (32 preceding siblings ...)
  2021-08-29 16:17 ` Dko1905
@ 2021-09-04 15:15 ` Dko1905
  2021-09-05 10:42 ` [PR PATCH] [Updated] " Dko1905
                   ` (32 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: Dko1905 @ 2021-09-04 15:15 UTC (permalink / raw)
  To: ml

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

New comment by Dko1905 on void-packages repository

https://github.com/void-linux/void-packages/pull/29780#issuecomment-912990137

Comment:
@ericonr Let's continue, I will not allow this pr become stale again.

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

* Re: [PR PATCH] [Updated] efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (33 preceding siblings ...)
  2021-09-04 15:15 ` Dko1905
@ 2021-09-05 10:42 ` Dko1905
  2021-09-05 10:42 ` Dko1905
                   ` (31 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: Dko1905 @ 2021-09-05 10:42 UTC (permalink / raw)
  To: ml

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

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

https://github.com/Dko1905/void-packages master
https://github.com/void-linux/void-packages/pull/29780

efibootmgr: Add strict EFI support & remove broken restore logic
#### General
- [ ] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements)

#### Have the results of the proposed changes been tested?
- [X] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me
- [ ] I generally don't use the affected packages but briefly tested this PR

<!--
If GitHub CI cannot be used to validate the build result (for example, if the
build is likely to take several hours), make sure to
[skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration).
When skipping CI, uncomment and fill out the following section.
Note: for builds that are likely to complete in less than 2 hours, it is not
acceptable to skip CI.
-->
<!-- 
#### Does it build and run successfully? 
(Please choose at least one native build and, if supported, at least one cross build. More are better.)
- [ ] I built this PR locally for my native architecture, (ARCH-LIBC)
- [ ] I built this PR locally for these architectures (if supported. mark crossbuilds):
  - [ ] aarch64-musl
  - [ ] armv7l
  - [ ] armv6l-musl
-->

I've just added a new option for using ".efi" suffixes, because some vendors don't support booting from non ".efi" files.
There are also small tab/space changes to make tabs more consistent.
The boot order "restore" functionality has been completely removed.

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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-master-29780.patch --]
[-- Type: text/x-diff, Size: 5032 bytes --]

From 35578228f0cb95a5f8fe5c2b7c1bf886abb59969 Mon Sep 17 00:00:00 2001
From: Daniel Florescu <Daniel.florescu1905@protonmail.ch>
Date: Sat, 27 Mar 2021 10:16:45 +0100
Subject: [PATCH] efibootmgr: Add new option to EFI hook

- Add new option "USE_STRICT_EFI_SUFFIX" to post-install hook.
- Update README.voidlinux to show info about the new hook.
- Fix inconsistent use of spaces and tabs in post-install hook.
- Bump revision number in template.
---
 srcpkgs/efibootmgr/files/README.voidlinux     | 10 +++----
 .../files/efibootmgr-kernel-hook.confd        |  2 ++
 .../files/kernel.d/efibootmgr.post-install    | 29 ++++++++++++-------
 srcpkgs/efibootmgr/template                   |  2 +-
 4 files changed, 26 insertions(+), 17 deletions(-)

diff --git a/srcpkgs/efibootmgr/files/README.voidlinux b/srcpkgs/efibootmgr/files/README.voidlinux
index 98844fd85a65..7dfb5c05c7ba 100644
--- a/srcpkgs/efibootmgr/files/README.voidlinux
+++ b/srcpkgs/efibootmgr/files/README.voidlinux
@@ -2,8 +2,8 @@ efibootmgr can automatically generate EFI boot entries to
 directly boot the kernel after every kernel update or installation.
 Enable this by editing /etc/default/efibootmgr-kernel-hook.
 
-The EFI variables need to be accessible in order for this to work, so
-add this line to your fstab and reboot or mount manually:
+The EFI variables need to be accessible in order for this to work, either
+boot into EFI mode or add this line to your fstab and reboot or mount:
   efivarfs /sys/firmware/efi/efivars efivarfs defaults 0 0
 -----------------------------------------------------------------------
 Kernel cmd options can be configured in /etc/default/efibootmgr-kernel-hook,
@@ -14,6 +14,6 @@ but you always have to reconfigure the kernel:
 
 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>"
+Some EFI implementations require the stub to end with a .efi suffix. If
+your implementation requires this, edit /etc/default/efibootmgr-kernel-hook
+and enable "USE_STRICT_EFI_SUFFIX=1".
diff --git a/srcpkgs/efibootmgr/files/efibootmgr-kernel-hook.confd b/srcpkgs/efibootmgr/files/efibootmgr-kernel-hook.confd
index 42adfc0da400..a6acde6a0d23 100644
--- a/srcpkgs/efibootmgr/files/efibootmgr-kernel-hook.confd
+++ b/srcpkgs/efibootmgr/files/efibootmgr-kernel-hook.confd
@@ -2,6 +2,8 @@
 MODIFY_EFI_ENTRIES=0
 # To allow efibootmgr to modify boot entries, set
 # MODIFY_EFI_ENTRIES=1
+# Use strict EFI file name spec. Default is 0
+# USE_STRICT_EFI_SUFFIX=0
 # Kernel command-line options.  Example:
 # OPTIONS="root=/dev/sda3 loglevel=4"
 # Disk where EFI Partition is.  Default is /dev/sda
diff --git a/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install b/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
index adf523e7b1fa..6739f3ba17f8 100644
--- a/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
+++ b/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
@@ -28,18 +28,25 @@ 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
+	/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
+# if using strict efi suffix
+if [ "x${USE_STRICT_EFI_SUFFIX}" = x1 ]; then
+	# rename vmlinuz
+	if [ -f /boot/vmlinuz-${VERSION} ]; then
+		mv -f /boot/vmlinuz-${VERSION} /boot/vmlinuz-${VERSION}.efi
+	fi
+	# create the new entry
+	efibootmgr -qc $args -L "Void Linux with kernel ${major_version}" -l /vmlinuz-${VERSION}.efi -u "${OPTIONS}"
+else
+	# remove efi
+	if [ -f /boot/vmlinuz-${VERSION}.efi ]; then
+		# vmlinuz is not generated on every reconfigure
+		mv -f /boot/vmlinuz-${VERSION}.efi /boot/vmlinuz-${VERSION}
+	fi
+	# create the new entry
+	efibootmgr -qc $args -L "Void Linux with kernel ${major_version}" -l /vmlinuz-${VERSION} -u "${OPTIONS}"
+fi
diff --git a/srcpkgs/efibootmgr/template b/srcpkgs/efibootmgr/template
index bd2e88bbbeac..deeb8dffc583 100644
--- a/srcpkgs/efibootmgr/template
+++ b/srcpkgs/efibootmgr/template
@@ -1,7 +1,7 @@
 # Template file for 'efibootmgr'
 pkgname=efibootmgr
 version=17
-revision=6
+revision=7
 hostmakedepends="pkg-config"
 makedepends="libefivar-devel popt-devel"
 short_desc="Tool to modify UEFI Firmware Boot Manager Variables"

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

* Re: efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (34 preceding siblings ...)
  2021-09-05 10:42 ` [PR PATCH] [Updated] " Dko1905
@ 2021-09-05 10:42 ` Dko1905
  2021-09-06 12:54 ` Dko1905
                   ` (30 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: Dko1905 @ 2021-09-05 10:42 UTC (permalink / raw)
  To: ml

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

New comment by Dko1905 on void-packages repository

https://github.com/void-linux/void-packages/pull/29780#issuecomment-913128150

Comment:
I've now again rebased the master branch onto the upstream master branch, could be nice if someone starts the CI again.

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

* Re: efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (35 preceding siblings ...)
  2021-09-05 10:42 ` Dko1905
@ 2021-09-06 12:54 ` Dko1905
  2021-09-06 17:11 ` [PR REVIEW] " tornaria
                   ` (29 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: Dko1905 @ 2021-09-06 12:54 UTC (permalink / raw)
  To: ml

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

New comment by Dko1905 on void-packages repository

https://github.com/void-linux/void-packages/pull/29780#issuecomment-913627233

Comment:
Should I get hold of someone to get this merged, on IRC or something?

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

* Re: [PR REVIEW] efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (36 preceding siblings ...)
  2021-09-06 12:54 ` Dko1905
@ 2021-09-06 17:11 ` tornaria
  2021-09-06 17:16 ` tornaria
                   ` (28 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: tornaria @ 2021-09-06 17:11 UTC (permalink / raw)
  To: ml

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

New review comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/29780#discussion_r703016911

Comment:
> For the new codepath, I would expect we will have an entry for each version, instead of single entry for the whole major version. The current hook only allows 1 version for the whole major version, which is bad if the new version is broken.

I see this as a feature: I switched from grub to efibootmgr because of this. Concretely: I want to be able to choose to boot `linux5.4` and have that always boot the latest 5.4, even if I have `linux5.10` installed.

One possibility is to have an entry for linux5.4 (which is replaced) and also entries for each individual kernel. Then the default boot entry can be selected as "linux5.4" but it's still possible to boot a particular kernel version.

Another choice would be to keep a rolling list of past kernels when updating, etc.

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

* Re: [PR REVIEW] efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (37 preceding siblings ...)
  2021-09-06 17:11 ` [PR REVIEW] " tornaria
@ 2021-09-06 17:16 ` tornaria
  2021-09-06 17:22 ` tornaria
                   ` (27 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: tornaria @ 2021-09-06 17:16 UTC (permalink / raw)
  To: ml

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

New review comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/29780#discussion_r703018192

Comment:
Won't removing this mean I might end up booting a different kernel than the one I want?

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

* Re: [PR REVIEW] efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (38 preceding siblings ...)
  2021-09-06 17:16 ` tornaria
@ 2021-09-06 17:22 ` tornaria
  2021-09-06 17:35 ` tornaria
                   ` (26 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: tornaria @ 2021-09-06 17:22 UTC (permalink / raw)
  To: ml

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

New review comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/29780#discussion_r703019668

Comment:
I'm a bit wary of moving the kernel around. What about copying the kernel and the initrd to the actual ESP partition. Note that grub expects the ESP to be mounted in /boot/EFI, but efibootmgr expects it to be mounted in /boot, hence they cannot easily coexist.

Copying the kernel to the ESP partition (with the .efi suffix) would solve both problems.

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

* Re: [PR REVIEW] efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (39 preceding siblings ...)
  2021-09-06 17:22 ` tornaria
@ 2021-09-06 17:35 ` tornaria
  2021-09-06 17:42 ` ahesford
                   ` (25 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: tornaria @ 2021-09-06 17:35 UTC (permalink / raw)
  To: ml

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

New review comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/29780#discussion_r703023319

Comment:
BTW, there's another bug wrt bootorder: if the bootorder list has an empty slot, saving the order and then restoring like this script will change the entries after the empty slot.

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

* Re: [PR REVIEW] efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (40 preceding siblings ...)
  2021-09-06 17:35 ` tornaria
@ 2021-09-06 17:42 ` ahesford
  2021-09-06 17:42 ` ahesford
                   ` (24 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: ahesford @ 2021-09-06 17:42 UTC (permalink / raw)
  To: ml

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

New review comment by ahesford on void-packages repository

https://github.com/void-linux/void-packages/pull/29780#discussion_r703025035

Comment:
+1 for copying the kernel rather than renaming.

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

* Re: [PR REVIEW] efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (41 preceding siblings ...)
  2021-09-06 17:42 ` ahesford
@ 2021-09-06 17:42 ` ahesford
  2021-09-06 17:47 ` tornaria
                   ` (23 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: ahesford @ 2021-09-06 17:42 UTC (permalink / raw)
  To: ml

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

New review comment by ahesford on void-packages repository

https://github.com/void-linux/void-packages/pull/29780#discussion_r703023298

Comment:
Booting via UEFI isn't sufficient to expose `efivarfs`. It must be manually mounted or `elogind` must run to mount it. (I have no idea why `elogind` cares about `efivarfs`, but it will automatically mount it when seeting up other mounts.)

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

* Re: [PR REVIEW] efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (42 preceding siblings ...)
  2021-09-06 17:42 ` ahesford
@ 2021-09-06 17:47 ` tornaria
  2021-09-07 15:08 ` Dko1905
                   ` (22 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: tornaria @ 2021-09-06 17:47 UTC (permalink / raw)
  To: ml

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

New review comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/29780#discussion_r703026578

Comment:
> BTW, there's another bug wrt bootorder: if the bootorder list has an empty slot, saving the order and then restoring like this script will change the entries after the empty slot.

Sorry, my explanation is a mess. What happens is:
 - say kernel is on entry 0005, which is the first in bootorder
 - now install a new version of the kernel
 - script removes entry for this kernel (0005)
 - script adds entry for the new version of the kernel
Result: if 0000-0004 are occupied then the new kernel will be 0005, but if one of 0000-0004 is empty, new kernel will go to the empty slot and 0005 will be empty. Then the bootorder is screwed.

The better way to do it would be:
 - script checks if there's an entry for the kernel it's replacing
 - if it is, it removes this old entry, and uses the same number for the new entry



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

* Re: [PR REVIEW] efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (43 preceding siblings ...)
  2021-09-06 17:47 ` tornaria
@ 2021-09-07 15:08 ` Dko1905
  2021-09-07 15:09 ` Dko1905
                   ` (21 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: Dko1905 @ 2021-09-07 15:08 UTC (permalink / raw)
  To: ml

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

New review comment by Dko1905 on void-packages repository

https://github.com/void-linux/void-packages/pull/29780#discussion_r703599213

Comment:
I've encountered this before, I thought it was because of `efibootmgr -qo $bootorder` so I removed it. What exactly do you want right now?

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

* Re: [PR REVIEW] efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (44 preceding siblings ...)
  2021-09-07 15:08 ` Dko1905
@ 2021-09-07 15:09 ` Dko1905
  2021-09-07 15:49 ` Dko1905
                   ` (20 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: Dko1905 @ 2021-09-07 15:09 UTC (permalink / raw)
  To: ml

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

New review comment by Dko1905 on void-packages repository

https://github.com/void-linux/void-packages/pull/29780#discussion_r703599544

Comment:
I'm on it.

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

* Re: [PR REVIEW] efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (45 preceding siblings ...)
  2021-09-07 15:09 ` Dko1905
@ 2021-09-07 15:49 ` Dko1905
  2021-09-07 15:55 ` [PR PATCH] [Updated] " Dko1905
                   ` (19 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: Dko1905 @ 2021-09-07 15:49 UTC (permalink / raw)
  To: ml

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

New review comment by Dko1905 on void-packages repository

https://github.com/void-linux/void-packages/pull/29780#discussion_r703632461

Comment:
>Note that grub expects the ESP to be mounted in /boot/EFI, but efibootmgr expects it >to be mounted in /boot, hence they cannot easily coexist.
Where do you know this from? I've not encountered any such problems and the default placement of the non .efi kernel is still on `/boot`. 
>Copying the kernel to the ESP partition (with the .efi suffix) would solve both problems.
Could you explain it in more details? 

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

* Re: [PR PATCH] [Updated] efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (46 preceding siblings ...)
  2021-09-07 15:49 ` Dko1905
@ 2021-09-07 15:55 ` Dko1905
  2021-09-07 15:56 ` [PR REVIEW] " Dko1905
                   ` (18 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: Dko1905 @ 2021-09-07 15:55 UTC (permalink / raw)
  To: ml

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

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

https://github.com/Dko1905/void-packages master
https://github.com/void-linux/void-packages/pull/29780

efibootmgr: Add strict EFI support & remove broken restore logic
#### General
- [ ] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements)

#### Have the results of the proposed changes been tested?
- [X] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me
- [ ] I generally don't use the affected packages but briefly tested this PR

<!--
If GitHub CI cannot be used to validate the build result (for example, if the
build is likely to take several hours), make sure to
[skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration).
When skipping CI, uncomment and fill out the following section.
Note: for builds that are likely to complete in less than 2 hours, it is not
acceptable to skip CI.
-->
<!-- 
#### Does it build and run successfully? 
(Please choose at least one native build and, if supported, at least one cross build. More are better.)
- [ ] I built this PR locally for my native architecture, (ARCH-LIBC)
- [ ] I built this PR locally for these architectures (if supported. mark crossbuilds):
  - [ ] aarch64-musl
  - [ ] armv7l
  - [ ] armv6l-musl
-->

I've just added a new option for using ".efi" suffixes, because some vendors don't support booting from non ".efi" files.
There are also small tab/space changes to make tabs more consistent.
The boot order "restore" functionality has been completely removed.

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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-master-29780.patch --]
[-- Type: text/x-diff, Size: 5036 bytes --]

From f9e622ff3b98f20a24a42c03ad3c3da337e4b25b Mon Sep 17 00:00:00 2001
From: Daniel Florescu <Daniel.florescu1905@protonmail.ch>
Date: Sat, 27 Mar 2021 10:16:45 +0100
Subject: [PATCH] efibootmgr: Add new option to EFI hook

- Add new option "USE_STRICT_EFI_SUFFIX" to post-install hook.
- Update README.voidlinux to show info about the new hook.
- Fix inconsistent use of spaces and tabs in post-install hook.
- Bump revision number in template.
---
 srcpkgs/efibootmgr/files/README.voidlinux     | 10 +++----
 .../files/efibootmgr-kernel-hook.confd        |  2 ++
 .../files/kernel.d/efibootmgr.post-install    | 29 ++++++++++++-------
 srcpkgs/efibootmgr/template                   |  2 +-
 4 files changed, 26 insertions(+), 17 deletions(-)

diff --git a/srcpkgs/efibootmgr/files/README.voidlinux b/srcpkgs/efibootmgr/files/README.voidlinux
index 98844fd85a65..91d92e02ddd6 100644
--- a/srcpkgs/efibootmgr/files/README.voidlinux
+++ b/srcpkgs/efibootmgr/files/README.voidlinux
@@ -2,8 +2,8 @@ efibootmgr can automatically generate EFI boot entries to
 directly boot the kernel after every kernel update or installation.
 Enable this by editing /etc/default/efibootmgr-kernel-hook.
 
-The EFI variables need to be accessible in order for this to work, so
-add this line to your fstab and reboot or mount manually:
+The EFI variables need to be accessible in order for this to work, make sure
+efivarfs is mounted or add this line to your fstab and reboot or mount:
   efivarfs /sys/firmware/efi/efivars efivarfs defaults 0 0
 -----------------------------------------------------------------------
 Kernel cmd options can be configured in /etc/default/efibootmgr-kernel-hook,
@@ -14,6 +14,6 @@ but you always have to reconfigure the kernel:
 
 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>"
+Some EFI implementations require the stub to end with a .efi suffix. If
+your implementation requires this, edit /etc/default/efibootmgr-kernel-hook
+and enable "USE_STRICT_EFI_SUFFIX=1".
diff --git a/srcpkgs/efibootmgr/files/efibootmgr-kernel-hook.confd b/srcpkgs/efibootmgr/files/efibootmgr-kernel-hook.confd
index 42adfc0da400..a6acde6a0d23 100644
--- a/srcpkgs/efibootmgr/files/efibootmgr-kernel-hook.confd
+++ b/srcpkgs/efibootmgr/files/efibootmgr-kernel-hook.confd
@@ -2,6 +2,8 @@
 MODIFY_EFI_ENTRIES=0
 # To allow efibootmgr to modify boot entries, set
 # MODIFY_EFI_ENTRIES=1
+# Use strict EFI file name spec. Default is 0
+# USE_STRICT_EFI_SUFFIX=0
 # Kernel command-line options.  Example:
 # OPTIONS="root=/dev/sda3 loglevel=4"
 # Disk where EFI Partition is.  Default is /dev/sda
diff --git a/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install b/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
index adf523e7b1fa..aacf3c2aa9dd 100644
--- a/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
+++ b/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
@@ -28,18 +28,25 @@ 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
+	/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
+# if using strict efi suffix
+if [ "x${USE_STRICT_EFI_SUFFIX}" = x1 ]; then
+	# rename vmlinuz
+	if [ -f /boot/vmlinuz-${VERSION} ]; then
+		cp -f /boot/vmlinuz-${VERSION} /boot/vmlinuz-${VERSION}.efi
+	fi
+	# create the new entry
+	efibootmgr -qc $args -L "Void Linux with kernel ${major_version}" -l /vmlinuz-${VERSION}.efi -u "${OPTIONS}"
+else
+	# remove efi
+	if [ -f /boot/vmlinuz-${VERSION}.efi ]; then
+		# vmlinuz is not generated on every reconfigure
+		cp -f /boot/vmlinuz-${VERSION}.efi /boot/vmlinuz-${VERSION}
+	fi
+	# create the new entry
+	efibootmgr -qc $args -L "Void Linux with kernel ${major_version}" -l /vmlinuz-${VERSION} -u "${OPTIONS}"
+fi
diff --git a/srcpkgs/efibootmgr/template b/srcpkgs/efibootmgr/template
index bd2e88bbbeac..deeb8dffc583 100644
--- a/srcpkgs/efibootmgr/template
+++ b/srcpkgs/efibootmgr/template
@@ -1,7 +1,7 @@
 # Template file for 'efibootmgr'
 pkgname=efibootmgr
 version=17
-revision=6
+revision=7
 hostmakedepends="pkg-config"
 makedepends="libefivar-devel popt-devel"
 short_desc="Tool to modify UEFI Firmware Boot Manager Variables"

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

* Re: [PR REVIEW] efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (47 preceding siblings ...)
  2021-09-07 15:55 ` [PR PATCH] [Updated] " Dko1905
@ 2021-09-07 15:56 ` Dko1905
  2021-09-07 15:58 ` Dko1905
                   ` (17 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: Dko1905 @ 2021-09-07 15:56 UTC (permalink / raw)
  To: ml

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

New review comment by Dko1905 on void-packages repository

https://github.com/void-linux/void-packages/pull/29780#discussion_r703638243

Comment:
This part has now been reworded.

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

* Re: [PR REVIEW] efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (48 preceding siblings ...)
  2021-09-07 15:56 ` [PR REVIEW] " Dko1905
@ 2021-09-07 15:58 ` Dko1905
  2021-09-07 16:05 ` ahesford
                   ` (16 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: Dko1905 @ 2021-09-07 15:58 UTC (permalink / raw)
  To: ml

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

New review comment by Dko1905 on void-packages repository

https://github.com/void-linux/void-packages/pull/29780#discussion_r703639786

Comment:
@ahesford Are you happy with the rewording of the text.

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

* Re: [PR REVIEW] efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (49 preceding siblings ...)
  2021-09-07 15:58 ` Dko1905
@ 2021-09-07 16:05 ` ahesford
  2021-09-07 22:34 ` tornaria
                   ` (15 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: ahesford @ 2021-09-07 16:05 UTC (permalink / raw)
  To: ml

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

New review comment by ahesford on void-packages repository

https://github.com/void-linux/void-packages/pull/29780#discussion_r703645306

Comment:
Other than needing a "so" after the comma and before "make sure efivarfs", this rewording is fine.

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

* Re: [PR REVIEW] efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (50 preceding siblings ...)
  2021-09-07 16:05 ` ahesford
@ 2021-09-07 22:34 ` tornaria
  2021-09-07 22:46 ` tornaria
                   ` (14 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: tornaria @ 2021-09-07 22:34 UTC (permalink / raw)
  To: ml

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

New review comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/29780#discussion_r703897593

Comment:
I correct myself: grub _can_ be installed with ESP on `/boot`.

However the installation guide recommends/assumes the ESP is on `/boot/efi` (see https://docs.voidlinux.org/installation/guides/chroot.html#create-a-new-root-and-mount-filesystems and https://docs.voidlinux.org/installation/guides/chroot.html#installing-grub)

When I wanted to switch to efibootmgr from grub, I had to move the contents of the `/boot` directory into the ESP, and then mount the ESP on `/boot`. Having the ESP on `/boot` is a requirement (in conflict with the above recommendation).

It would be nicer if efibootmgr can work with the ESP on the reocmmended location `/boot/efi`, even better if this can be configured or detected.

BTW, in case it's useful here's a silly way of figuring out where's the efi partition:
```
mount -t vfat | sed -nE 's|^([^ ]*) on (/boot(/[^ ]*)?) type vfat .*$|\1 \2|p'
```

I suppose a sensible location for the kernel+initrd might be `\EFI\void\vmlinuz-$VERSION.efi` and `\EFI\void\initramfs-$VERSION.img` on the ESP, would that work for you?


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

* Re: [PR REVIEW] efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (51 preceding siblings ...)
  2021-09-07 22:34 ` tornaria
@ 2021-09-07 22:46 ` tornaria
  2021-09-07 22:49 ` tornaria
                   ` (13 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: tornaria @ 2021-09-07 22:46 UTC (permalink / raw)
  To: ml

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

New review comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/29780#discussion_r703902693

Comment:
If not fixing the issue I described above, I would say at least leave the `efibootmgr -qo $bootorder` in place. Without it, the last kernel installed will take priority which is not very convenient (e.g. I have 4.19, 5.4, 5.10 and 5.13 installed, and I'm currently booting 5.4; I would hate that this changes every time one of the others is updated).

A possible fix might be to do something like this:
```
[...]
# get major version, e.g. "4.8" for "linux4.8"
major_version=$(echo $PKGNAME | cut -c 6-)

label="Void Linux with kernel ${major_version}"

# look for previous entry for this major kernel version
bootnum=$(efibootmgr | grep " $label$" | cut -c "5-8")

# 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 and reuse the same number
if [ -n "$bootnum" ]; then
	args="$args -B -b $bootnum"
fi

# if there is a boot order, keep it as is
if [ -n "$bootorder" ]; then
	args="$args -o $bootorder"
fi

# create the new entry
efibootmgr -qc $args -L "$label" -l /vmlinuz-${VERSION} -u "${OPTIONS}"
```

Instead of calling the `post-remove/50-efibootmgr` hook, just tell efibootmgr to replace the entry. This also keeps the order in the same call to efibootmgr so you don't have to do that in a separate step anymore.


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

* Re: [PR REVIEW] efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (52 preceding siblings ...)
  2021-09-07 22:46 ` tornaria
@ 2021-09-07 22:49 ` tornaria
  2021-09-07 22:49 ` tornaria
                   ` (12 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: tornaria @ 2021-09-07 22:49 UTC (permalink / raw)
  To: ml

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

New review comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/29780#discussion_r703903905

Comment:
I also added the following to the end of the kernel hook script, which is purely informational and useful:
```
##### Give some feedback

# reread $bootnum and $bootorder after the change
bootnum=$(efibootmgr | grep " $label$" | cut -c "5-8")
bootorder=$(efibootmgr | grep "^BootOrder: " |cut -c 12-)
default=$(efibootmgr | grep "^Boot${bootorder%%,*}" | cut -c 11-)

if [ -z "${bootorder##$bootnum*}" ]; then
	# $bootnum is the first entry in $bootorder
	echo "  Linux kernel ${VERSION} will boot by default"
else
	# new order with $bootnum first
	neworder=$bootnum,$(echo $bootorder | sed -e "s/,$bootnum//")
	echo "  Linux kernel ${VERSION} in boot entry '$bootnum' will NOT boot by default"
	echo "  Current default is '$default'"
	#echo "  Current boot order is $bootorder"
	#( IFS="," ; for num in $bootorder ; do 
	#	echo -n "    "
	#	efibootmgr | grep "^Boot$num"
	#done )
	echo "   - run 'efibootmgr -o $neworder' to boot kernel ${VERSION} by default"
	echo "   - run 'efibootmgr -n $bootnum' to boot it next time only"
fi
```

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

* Re: [PR REVIEW] efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (53 preceding siblings ...)
  2021-09-07 22:49 ` tornaria
@ 2021-09-07 22:49 ` tornaria
  2021-09-08 11:41 ` [PR PATCH] [Updated] " Dko1905
                   ` (11 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: tornaria @ 2021-09-07 22:49 UTC (permalink / raw)
  To: ml

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

New review comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/29780#discussion_r703903905

Comment:
I also added the following to the end of the kernel (post-install) hook script, which is purely informational and useful:
```
##### Give some feedback

# reread $bootnum and $bootorder after the change
bootnum=$(efibootmgr | grep " $label$" | cut -c "5-8")
bootorder=$(efibootmgr | grep "^BootOrder: " |cut -c 12-)
default=$(efibootmgr | grep "^Boot${bootorder%%,*}" | cut -c 11-)

if [ -z "${bootorder##$bootnum*}" ]; then
	# $bootnum is the first entry in $bootorder
	echo "  Linux kernel ${VERSION} will boot by default"
else
	# new order with $bootnum first
	neworder=$bootnum,$(echo $bootorder | sed -e "s/,$bootnum//")
	echo "  Linux kernel ${VERSION} in boot entry '$bootnum' will NOT boot by default"
	echo "  Current default is '$default'"
	#echo "  Current boot order is $bootorder"
	#( IFS="," ; for num in $bootorder ; do 
	#	echo -n "    "
	#	efibootmgr | grep "^Boot$num"
	#done )
	echo "   - run 'efibootmgr -o $neworder' to boot kernel ${VERSION} by default"
	echo "   - run 'efibootmgr -n $bootnum' to boot it next time only"
fi
```

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

* Re: [PR PATCH] [Updated] efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (54 preceding siblings ...)
  2021-09-07 22:49 ` tornaria
@ 2021-09-08 11:41 ` Dko1905
  2021-09-08 11:52 ` Dko1905
                   ` (10 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: Dko1905 @ 2021-09-08 11:41 UTC (permalink / raw)
  To: ml

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

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

https://github.com/Dko1905/void-packages master
https://github.com/void-linux/void-packages/pull/29780

efibootmgr: Add strict EFI support & remove broken restore logic
#### General
- [ ] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements)

#### Have the results of the proposed changes been tested?
- [X] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me
- [ ] I generally don't use the affected packages but briefly tested this PR

<!--
If GitHub CI cannot be used to validate the build result (for example, if the
build is likely to take several hours), make sure to
[skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration).
When skipping CI, uncomment and fill out the following section.
Note: for builds that are likely to complete in less than 2 hours, it is not
acceptable to skip CI.
-->
<!-- 
#### Does it build and run successfully? 
(Please choose at least one native build and, if supported, at least one cross build. More are better.)
- [ ] I built this PR locally for my native architecture, (ARCH-LIBC)
- [ ] I built this PR locally for these architectures (if supported. mark crossbuilds):
  - [ ] aarch64-musl
  - [ ] armv7l
  - [ ] armv6l-musl
-->

I've just added a new option for using ".efi" suffixes, because some vendors don't support booting from non ".efi" files.
There are also small tab/space changes to make tabs more consistent.
The boot order "restore" functionality has been completely removed.

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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-master-29780.patch --]
[-- Type: text/x-diff, Size: 6320 bytes --]

From f9e622ff3b98f20a24a42c03ad3c3da337e4b25b Mon Sep 17 00:00:00 2001
From: Daniel Florescu <Daniel.florescu1905@protonmail.ch>
Date: Sat, 27 Mar 2021 10:16:45 +0100
Subject: [PATCH 1/2] efibootmgr: Add new option to EFI hook

- Add new option "USE_STRICT_EFI_SUFFIX" to post-install hook.
- Update README.voidlinux to show info about the new hook.
- Fix inconsistent use of spaces and tabs in post-install hook.
- Bump revision number in template.
---
 srcpkgs/efibootmgr/files/README.voidlinux     | 10 +++----
 .../files/efibootmgr-kernel-hook.confd        |  2 ++
 .../files/kernel.d/efibootmgr.post-install    | 29 ++++++++++++-------
 srcpkgs/efibootmgr/template                   |  2 +-
 4 files changed, 26 insertions(+), 17 deletions(-)

diff --git a/srcpkgs/efibootmgr/files/README.voidlinux b/srcpkgs/efibootmgr/files/README.voidlinux
index 98844fd85a65..91d92e02ddd6 100644
--- a/srcpkgs/efibootmgr/files/README.voidlinux
+++ b/srcpkgs/efibootmgr/files/README.voidlinux
@@ -2,8 +2,8 @@ efibootmgr can automatically generate EFI boot entries to
 directly boot the kernel after every kernel update or installation.
 Enable this by editing /etc/default/efibootmgr-kernel-hook.
 
-The EFI variables need to be accessible in order for this to work, so
-add this line to your fstab and reboot or mount manually:
+The EFI variables need to be accessible in order for this to work, make sure
+efivarfs is mounted or add this line to your fstab and reboot or mount:
   efivarfs /sys/firmware/efi/efivars efivarfs defaults 0 0
 -----------------------------------------------------------------------
 Kernel cmd options can be configured in /etc/default/efibootmgr-kernel-hook,
@@ -14,6 +14,6 @@ but you always have to reconfigure the kernel:
 
 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>"
+Some EFI implementations require the stub to end with a .efi suffix. If
+your implementation requires this, edit /etc/default/efibootmgr-kernel-hook
+and enable "USE_STRICT_EFI_SUFFIX=1".
diff --git a/srcpkgs/efibootmgr/files/efibootmgr-kernel-hook.confd b/srcpkgs/efibootmgr/files/efibootmgr-kernel-hook.confd
index 42adfc0da400..a6acde6a0d23 100644
--- a/srcpkgs/efibootmgr/files/efibootmgr-kernel-hook.confd
+++ b/srcpkgs/efibootmgr/files/efibootmgr-kernel-hook.confd
@@ -2,6 +2,8 @@
 MODIFY_EFI_ENTRIES=0
 # To allow efibootmgr to modify boot entries, set
 # MODIFY_EFI_ENTRIES=1
+# Use strict EFI file name spec. Default is 0
+# USE_STRICT_EFI_SUFFIX=0
 # Kernel command-line options.  Example:
 # OPTIONS="root=/dev/sda3 loglevel=4"
 # Disk where EFI Partition is.  Default is /dev/sda
diff --git a/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install b/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
index adf523e7b1fa..aacf3c2aa9dd 100644
--- a/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
+++ b/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
@@ -28,18 +28,25 @@ 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
+	/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
+# if using strict efi suffix
+if [ "x${USE_STRICT_EFI_SUFFIX}" = x1 ]; then
+	# rename vmlinuz
+	if [ -f /boot/vmlinuz-${VERSION} ]; then
+		cp -f /boot/vmlinuz-${VERSION} /boot/vmlinuz-${VERSION}.efi
+	fi
+	# create the new entry
+	efibootmgr -qc $args -L "Void Linux with kernel ${major_version}" -l /vmlinuz-${VERSION}.efi -u "${OPTIONS}"
+else
+	# remove efi
+	if [ -f /boot/vmlinuz-${VERSION}.efi ]; then
+		# vmlinuz is not generated on every reconfigure
+		cp -f /boot/vmlinuz-${VERSION}.efi /boot/vmlinuz-${VERSION}
+	fi
+	# create the new entry
+	efibootmgr -qc $args -L "Void Linux with kernel ${major_version}" -l /vmlinuz-${VERSION} -u "${OPTIONS}"
+fi
diff --git a/srcpkgs/efibootmgr/template b/srcpkgs/efibootmgr/template
index bd2e88bbbeac..deeb8dffc583 100644
--- a/srcpkgs/efibootmgr/template
+++ b/srcpkgs/efibootmgr/template
@@ -1,7 +1,7 @@
 # Template file for 'efibootmgr'
 pkgname=efibootmgr
 version=17
-revision=6
+revision=7
 hostmakedepends="pkg-config"
 makedepends="libefivar-devel popt-devel"
 short_desc="Tool to modify UEFI Firmware Boot Manager Variables"

From 713fc1b0bfdd05e22264ce3525b8df62a3f59211 Mon Sep 17 00:00:00 2001
From: Daniel Florescu <df@z5.lt>
Date: Wed, 8 Sep 2021 13:41:25 +0200
Subject: [PATCH 2/2] efibootmgr: Add 'sure' after ',' in README.voidlinux

---
 srcpkgs/efibootmgr/files/README.voidlinux | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/efibootmgr/files/README.voidlinux b/srcpkgs/efibootmgr/files/README.voidlinux
index 91d92e02ddd6..57cabb6e080e 100644
--- a/srcpkgs/efibootmgr/files/README.voidlinux
+++ b/srcpkgs/efibootmgr/files/README.voidlinux
@@ -2,8 +2,8 @@ efibootmgr can automatically generate EFI boot entries to
 directly boot the kernel after every kernel update or installation.
 Enable this by editing /etc/default/efibootmgr-kernel-hook.
 
-The EFI variables need to be accessible in order for this to work, make sure
-efivarfs is mounted or add this line to your fstab and reboot or mount:
+The EFI variables need to be accessible in order for this to work, so make
+suer efivarfs is mounted or add this line to your fstab and reboot or mount:
   efivarfs /sys/firmware/efi/efivars efivarfs defaults 0 0
 -----------------------------------------------------------------------
 Kernel cmd options can be configured in /etc/default/efibootmgr-kernel-hook,

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

* Re: [PR PATCH] [Updated] efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (55 preceding siblings ...)
  2021-09-08 11:41 ` [PR PATCH] [Updated] " Dko1905
@ 2021-09-08 11:52 ` Dko1905
  2021-09-08 11:52 ` [PR REVIEW] " Dko1905
                   ` (9 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: Dko1905 @ 2021-09-08 11:52 UTC (permalink / raw)
  To: ml

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

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

https://github.com/Dko1905/void-packages master
https://github.com/void-linux/void-packages/pull/29780

efibootmgr: Add strict EFI support & remove broken restore logic
#### General
- [ ] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements)

#### Have the results of the proposed changes been tested?
- [X] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me
- [ ] I generally don't use the affected packages but briefly tested this PR

<!--
If GitHub CI cannot be used to validate the build result (for example, if the
build is likely to take several hours), make sure to
[skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration).
When skipping CI, uncomment and fill out the following section.
Note: for builds that are likely to complete in less than 2 hours, it is not
acceptable to skip CI.
-->
<!-- 
#### Does it build and run successfully? 
(Please choose at least one native build and, if supported, at least one cross build. More are better.)
- [ ] I built this PR locally for my native architecture, (ARCH-LIBC)
- [ ] I built this PR locally for these architectures (if supported. mark crossbuilds):
  - [ ] aarch64-musl
  - [ ] armv7l
  - [ ] armv6l-musl
-->

I've just added a new option for using ".efi" suffixes, because some vendors don't support booting from non ".efi" files.
There are also small tab/space changes to make tabs more consistent.
The boot order "restore" functionality has been completely removed.

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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-master-29780.patch --]
[-- Type: text/x-diff, Size: 7588 bytes --]

From f9e622ff3b98f20a24a42c03ad3c3da337e4b25b Mon Sep 17 00:00:00 2001
From: Daniel Florescu <Daniel.florescu1905@protonmail.ch>
Date: Sat, 27 Mar 2021 10:16:45 +0100
Subject: [PATCH 1/3] efibootmgr: Add new option to EFI hook

- Add new option "USE_STRICT_EFI_SUFFIX" to post-install hook.
- Update README.voidlinux to show info about the new hook.
- Fix inconsistent use of spaces and tabs in post-install hook.
- Bump revision number in template.
---
 srcpkgs/efibootmgr/files/README.voidlinux     | 10 +++----
 .../files/efibootmgr-kernel-hook.confd        |  2 ++
 .../files/kernel.d/efibootmgr.post-install    | 29 ++++++++++++-------
 srcpkgs/efibootmgr/template                   |  2 +-
 4 files changed, 26 insertions(+), 17 deletions(-)

diff --git a/srcpkgs/efibootmgr/files/README.voidlinux b/srcpkgs/efibootmgr/files/README.voidlinux
index 98844fd85a65..91d92e02ddd6 100644
--- a/srcpkgs/efibootmgr/files/README.voidlinux
+++ b/srcpkgs/efibootmgr/files/README.voidlinux
@@ -2,8 +2,8 @@ efibootmgr can automatically generate EFI boot entries to
 directly boot the kernel after every kernel update or installation.
 Enable this by editing /etc/default/efibootmgr-kernel-hook.
 
-The EFI variables need to be accessible in order for this to work, so
-add this line to your fstab and reboot or mount manually:
+The EFI variables need to be accessible in order for this to work, make sure
+efivarfs is mounted or add this line to your fstab and reboot or mount:
   efivarfs /sys/firmware/efi/efivars efivarfs defaults 0 0
 -----------------------------------------------------------------------
 Kernel cmd options can be configured in /etc/default/efibootmgr-kernel-hook,
@@ -14,6 +14,6 @@ but you always have to reconfigure the kernel:
 
 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>"
+Some EFI implementations require the stub to end with a .efi suffix. If
+your implementation requires this, edit /etc/default/efibootmgr-kernel-hook
+and enable "USE_STRICT_EFI_SUFFIX=1".
diff --git a/srcpkgs/efibootmgr/files/efibootmgr-kernel-hook.confd b/srcpkgs/efibootmgr/files/efibootmgr-kernel-hook.confd
index 42adfc0da400..a6acde6a0d23 100644
--- a/srcpkgs/efibootmgr/files/efibootmgr-kernel-hook.confd
+++ b/srcpkgs/efibootmgr/files/efibootmgr-kernel-hook.confd
@@ -2,6 +2,8 @@
 MODIFY_EFI_ENTRIES=0
 # To allow efibootmgr to modify boot entries, set
 # MODIFY_EFI_ENTRIES=1
+# Use strict EFI file name spec. Default is 0
+# USE_STRICT_EFI_SUFFIX=0
 # Kernel command-line options.  Example:
 # OPTIONS="root=/dev/sda3 loglevel=4"
 # Disk where EFI Partition is.  Default is /dev/sda
diff --git a/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install b/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
index adf523e7b1fa..aacf3c2aa9dd 100644
--- a/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
+++ b/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
@@ -28,18 +28,25 @@ 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
+	/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
+# if using strict efi suffix
+if [ "x${USE_STRICT_EFI_SUFFIX}" = x1 ]; then
+	# rename vmlinuz
+	if [ -f /boot/vmlinuz-${VERSION} ]; then
+		cp -f /boot/vmlinuz-${VERSION} /boot/vmlinuz-${VERSION}.efi
+	fi
+	# create the new entry
+	efibootmgr -qc $args -L "Void Linux with kernel ${major_version}" -l /vmlinuz-${VERSION}.efi -u "${OPTIONS}"
+else
+	# remove efi
+	if [ -f /boot/vmlinuz-${VERSION}.efi ]; then
+		# vmlinuz is not generated on every reconfigure
+		cp -f /boot/vmlinuz-${VERSION}.efi /boot/vmlinuz-${VERSION}
+	fi
+	# create the new entry
+	efibootmgr -qc $args -L "Void Linux with kernel ${major_version}" -l /vmlinuz-${VERSION} -u "${OPTIONS}"
+fi
diff --git a/srcpkgs/efibootmgr/template b/srcpkgs/efibootmgr/template
index bd2e88bbbeac..deeb8dffc583 100644
--- a/srcpkgs/efibootmgr/template
+++ b/srcpkgs/efibootmgr/template
@@ -1,7 +1,7 @@
 # Template file for 'efibootmgr'
 pkgname=efibootmgr
 version=17
-revision=6
+revision=7
 hostmakedepends="pkg-config"
 makedepends="libefivar-devel popt-devel"
 short_desc="Tool to modify UEFI Firmware Boot Manager Variables"

From 713fc1b0bfdd05e22264ce3525b8df62a3f59211 Mon Sep 17 00:00:00 2001
From: Daniel Florescu <df@z5.lt>
Date: Wed, 8 Sep 2021 13:41:25 +0200
Subject: [PATCH 2/3] efibootmgr: Add 'sure' after ',' in README.voidlinux

---
 srcpkgs/efibootmgr/files/README.voidlinux | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/efibootmgr/files/README.voidlinux b/srcpkgs/efibootmgr/files/README.voidlinux
index 91d92e02ddd6..57cabb6e080e 100644
--- a/srcpkgs/efibootmgr/files/README.voidlinux
+++ b/srcpkgs/efibootmgr/files/README.voidlinux
@@ -2,8 +2,8 @@ efibootmgr can automatically generate EFI boot entries to
 directly boot the kernel after every kernel update or installation.
 Enable this by editing /etc/default/efibootmgr-kernel-hook.
 
-The EFI variables need to be accessible in order for this to work, make sure
-efivarfs is mounted or add this line to your fstab and reboot or mount:
+The EFI variables need to be accessible in order for this to work, so make
+suer efivarfs is mounted or add this line to your fstab and reboot or mount:
   efivarfs /sys/firmware/efi/efivars efivarfs defaults 0 0
 -----------------------------------------------------------------------
 Kernel cmd options can be configured in /etc/default/efibootmgr-kernel-hook,

From ddd6c700952a669d5c21e53bca2a2a8b61597375 Mon Sep 17 00:00:00 2001
From: Daniel Florescu <df@z5.lt>
Date: Wed, 8 Sep 2021 13:51:35 +0200
Subject: [PATCH 3/3] efibootmgr: Remove code that copies vmlinuz back

Since we now copy vmlinuz, instead of moving it, we don't need to
move it back again, since it still is there after copying.
---
 srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install b/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
index aacf3c2aa9dd..766cb5949d59 100644
--- a/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
+++ b/srcpkgs/efibootmgr/files/kernel.d/efibootmgr.post-install
@@ -44,8 +44,9 @@ if [ "x${USE_STRICT_EFI_SUFFIX}" = x1 ]; then
 else
 	# remove efi
 	if [ -f /boot/vmlinuz-${VERSION}.efi ]; then
-		# vmlinuz is not generated on every reconfigure
-		cp -f /boot/vmlinuz-${VERSION}.efi /boot/vmlinuz-${VERSION}
+		# since we copy vmlinuz-... to vmlinuz-....efi, we don't need
+		# to copy it back.
+		rm -f /boot/vmlinuz-${VERSION}.efi
 	fi
 	# create the new entry
 	efibootmgr -qc $args -L "Void Linux with kernel ${major_version}" -l /vmlinuz-${VERSION} -u "${OPTIONS}"

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

* Re: [PR REVIEW] efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (56 preceding siblings ...)
  2021-09-08 11:52 ` Dko1905
@ 2021-09-08 11:52 ` Dko1905
  2021-09-08 11:52 ` Dko1905
                   ` (8 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: Dko1905 @ 2021-09-08 11:52 UTC (permalink / raw)
  To: ml

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

New review comment by Dko1905 on void-packages repository

https://github.com/void-linux/void-packages/pull/29780#discussion_r704344447

Comment:
This is getting really complicated, I don't know much about how efibootmgr works, or where the efi files should be located. And I really don't want this pr to fix all the issues that efibootmgr currently has. I created this pr because I had an issue with my laptop, and this pr fixes that issue, and only that issue.

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

* Re: [PR REVIEW] efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (57 preceding siblings ...)
  2021-09-08 11:52 ` [PR REVIEW] " Dko1905
@ 2021-09-08 11:52 ` Dko1905
  2021-09-08 11:52 ` Dko1905
                   ` (7 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: Dko1905 @ 2021-09-08 11:52 UTC (permalink / raw)
  To: ml

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

New review comment by Dko1905 on void-packages repository

https://github.com/void-linux/void-packages/pull/29780#discussion_r704344499

Comment:
These are great ideas, but they shouldn't be part of this pr. A new pr for these changes would be lovely, but not this pr.

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

* Re: efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (58 preceding siblings ...)
  2021-09-08 11:52 ` Dko1905
@ 2021-09-08 11:52 ` Dko1905
  2021-09-08 12:19 ` tornaria
                   ` (6 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: Dko1905 @ 2021-09-08 11:52 UTC (permalink / raw)
  To: ml

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

New comment by Dko1905 on void-packages repository

https://github.com/void-linux/void-packages/pull/29780#issuecomment-915167380

Comment:
I'm getting a lot of feedback, and thank you for that, but some of it starts fixing other parts of efibootmgr, that I don't know enough about or don't want to be part of this pr. The only goal with this pr is to add strict EFI support, and optionally also remove the boot loader restore part of the script, since it has lead to my laptop not booting after an update.

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

* Re: efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (59 preceding siblings ...)
  2021-09-08 11:52 ` Dko1905
@ 2021-09-08 12:19 ` tornaria
  2021-09-08 12:26 ` [PR REVIEW] " tornaria
                   ` (5 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: tornaria @ 2021-09-08 12:19 UTC (permalink / raw)
  To: ml

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

New comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/29780#issuecomment-915184563

Comment:
> I'm getting a lot of feedback, and thank you for that, but some of it starts fixing other parts of efibootmgr, that I don't know enough about or don't want to be part of this pr. The only goal with this pr is to add strict EFI support, and optionally also remove the boot loader restore part of the script, since it has lead to my laptop not booting after an update.

If you make a change that fixes your usage and breaks mine, that would be a regression. We can work together to figure out a way to fix your case without breaking others.

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

* Re: [PR REVIEW] efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (60 preceding siblings ...)
  2021-09-08 12:19 ` tornaria
@ 2021-09-08 12:26 ` tornaria
  2021-09-08 12:50 ` ahesford
                   ` (4 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: tornaria @ 2021-09-08 12:26 UTC (permalink / raw)
  To: ml

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

New review comment by tornaria on void-packages repository

https://github.com/void-linux/void-packages/pull/29780#discussion_r704368057

Comment:
> These are great ideas, but they shouldn't be part of this pr. A new pr for these changes would be lovely, but not this pr.

Then move 
```diff
-# restore the boot order
-efibootmgr -qo $bootorder
```
to a different issue/PR.

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

* Re: [PR REVIEW] efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (61 preceding siblings ...)
  2021-09-08 12:26 ` [PR REVIEW] " tornaria
@ 2021-09-08 12:50 ` ahesford
  2021-09-08 12:50 ` ahesford
                   ` (3 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: ahesford @ 2021-09-08 12:50 UTC (permalink / raw)
  To: ml

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

New review comment by ahesford on void-packages repository

https://github.com/void-linux/void-packages/pull/29780#discussion_r704354391

Comment:
1. Removal of the EFI files should happen in the `post-remove` hook, not the `post-install` hook.
2. If you're going to run `rm -f`, there's no need to test for existing with `if [ -f ... ]`.

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

* Re: [PR REVIEW] efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (62 preceding siblings ...)
  2021-09-08 12:50 ` ahesford
@ 2021-09-08 12:50 ` ahesford
  2021-09-28  8:55 ` [PR PATCH] [Updated] " Dko1905
                   ` (2 subsequent siblings)
  66 siblings, 0 replies; 68+ messages in thread
From: ahesford @ 2021-09-08 12:50 UTC (permalink / raw)
  To: ml

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

New review comment by ahesford on void-packages repository

https://github.com/void-linux/void-packages/pull/29780#discussion_r704366538

Comment:
Repeating the `efibootmgr` command in both the `if` and `else` blocks just invites mistakes if people want to modify loader behavior in the future. Better to define a variable, `kernel_path` or something, and set
```sh
kernel_path="/vmlinuz-${VERSION}"
```
here and
```sh
kernel_path="[...]/vmlinuz-${VERSION}.efi"
```
in the above `if` block. (See my general comment for how I think `[...]` should be handled.) This way, you can make one call to
```sh
efibootmgr -qc $args -L "Void Linux with kernel ${major_version}" -l "${kernel_path}" -u "${OPTIONS}"
```
after the block.

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

* Re: [PR PATCH] [Updated] efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (63 preceding siblings ...)
  2021-09-08 12:50 ` ahesford
@ 2021-09-28  8:55 ` Dko1905
  2021-09-28  8:55 ` [PR PATCH] [Closed]: " Dko1905
  2021-09-28  9:16 ` Dko1905
  66 siblings, 0 replies; 68+ messages in thread
From: Dko1905 @ 2021-09-28  8:55 UTC (permalink / raw)
  To: ml

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

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

https://github.com/Dko1905/void-packages master
https://github.com/void-linux/void-packages/pull/29780

efibootmgr: Add strict EFI support & remove broken restore logic
#### General
- [ ] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements)

#### Have the results of the proposed changes been tested?
- [X] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me
- [ ] I generally don't use the affected packages but briefly tested this PR

<!--
If GitHub CI cannot be used to validate the build result (for example, if the
build is likely to take several hours), make sure to
[skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration).
When skipping CI, uncomment and fill out the following section.
Note: for builds that are likely to complete in less than 2 hours, it is not
acceptable to skip CI.
-->
<!-- 
#### Does it build and run successfully? 
(Please choose at least one native build and, if supported, at least one cross build. More are better.)
- [ ] I built this PR locally for my native architecture, (ARCH-LIBC)
- [ ] I built this PR locally for these architectures (if supported. mark crossbuilds):
  - [ ] aarch64-musl
  - [ ] armv7l
  - [ ] armv6l-musl
-->

I've just added a new option for using ".efi" suffixes, because some vendors don't support booting from non ".efi" files.
There are also small tab/space changes to make tabs more consistent.
The boot order "restore" functionality has been completely removed.

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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-master-29780.patch --]
[-- Type: text/x-diff, Size: 0 bytes --]



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

* Re: [PR PATCH] [Closed]: efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (64 preceding siblings ...)
  2021-09-28  8:55 ` [PR PATCH] [Updated] " Dko1905
@ 2021-09-28  8:55 ` Dko1905
  2021-09-28  9:16 ` Dko1905
  66 siblings, 0 replies; 68+ messages in thread
From: Dko1905 @ 2021-09-28  8:55 UTC (permalink / raw)
  To: ml

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

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

efibootmgr: Add strict EFI support & remove broken restore logic
https://github.com/void-linux/void-packages/pull/29780

Description:
#### General
- [ ] This is a new package and it conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements)

#### Have the results of the proposed changes been tested?
- [X] I use the packages affected by the proposed changes on a regular basis and confirm this PR works for me
- [ ] I generally don't use the affected packages but briefly tested this PR

<!--
If GitHub CI cannot be used to validate the build result (for example, if the
build is likely to take several hours), make sure to
[skip CI](https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration).
When skipping CI, uncomment and fill out the following section.
Note: for builds that are likely to complete in less than 2 hours, it is not
acceptable to skip CI.
-->
<!-- 
#### Does it build and run successfully? 
(Please choose at least one native build and, if supported, at least one cross build. More are better.)
- [ ] I built this PR locally for my native architecture, (ARCH-LIBC)
- [ ] I built this PR locally for these architectures (if supported. mark crossbuilds):
  - [ ] aarch64-musl
  - [ ] armv7l
  - [ ] armv6l-musl
-->

I've just added a new option for using ".efi" suffixes, because some vendors don't support booting from non ".efi" files.
There are also small tab/space changes to make tabs more consistent.
The boot order "restore" functionality has been completely removed.

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

* Re: efibootmgr: Add strict EFI support & remove broken restore logic
  2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
                   ` (65 preceding siblings ...)
  2021-09-28  8:55 ` [PR PATCH] [Closed]: " Dko1905
@ 2021-09-28  9:16 ` Dko1905
  66 siblings, 0 replies; 68+ messages in thread
From: Dko1905 @ 2021-09-28  9:16 UTC (permalink / raw)
  To: ml

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

New comment by Dko1905 on void-packages repository

https://github.com/void-linux/void-packages/pull/29780#issuecomment-929009097

Comment:
Oh, no

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

end of thread, other threads:[~2021-09-28  9:16 UTC | newest]

Thread overview: 68+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-27 12:25 [PR PATCH] efibootmgr: Add strict EFI support & remove broken restore logic Dko1905
2021-03-27 12:46 ` [PR REVIEW] " prez
2021-03-27 12:46 ` prez
2021-03-27 13:14 ` Dko1905
2021-03-27 13:48 ` [PR PATCH] [Updated] " Dko1905
2021-03-27 13:49 ` [PR REVIEW] " Dko1905
2021-03-27 13:50 ` Dko1905
2021-03-27 13:59 ` Dko1905
2021-03-27 16:20 ` Dko1905
2021-03-28  7:54 ` Dko1905
2021-04-11  2:59 ` ericonr
2021-04-11 14:01 ` [PR REVIEW] " sgn
2021-04-11 14:01 ` sgn
2021-04-11 14:01 ` sgn
2021-04-11 14:21 ` Duncaen
2021-04-11 14:23 ` Duncaen
2021-04-11 18:06 ` [PR REVIEW] " Dko1905
2021-04-11 18:07 ` Dko1905
2021-04-11 18:07 ` Dko1905
2021-04-11 18:09 ` Dko1905
2021-04-11 18:12 ` Dko1905
2021-04-27 12:27 ` [PR PATCH] [Updated] " Dko1905
2021-06-16  9:21 ` Dko1905
2021-08-25 20:03 ` Dko1905
2021-08-25 20:13 ` [PR REVIEW] " ericonr
2021-08-25 20:13 ` ericonr
2021-08-26  6:29 ` Dko1905
2021-08-26  6:35 ` Dko1905
2021-08-28 14:52 ` Dko1905
2021-08-28 14:59 ` Dko1905
2021-08-28 15:00 ` Dko1905
2021-08-28 17:46 ` ericonr
2021-08-29 16:15 ` [PR PATCH] [Updated] " Dko1905
2021-08-29 16:17 ` Dko1905
2021-09-04 15:15 ` Dko1905
2021-09-05 10:42 ` [PR PATCH] [Updated] " Dko1905
2021-09-05 10:42 ` Dko1905
2021-09-06 12:54 ` Dko1905
2021-09-06 17:11 ` [PR REVIEW] " tornaria
2021-09-06 17:16 ` tornaria
2021-09-06 17:22 ` tornaria
2021-09-06 17:35 ` tornaria
2021-09-06 17:42 ` ahesford
2021-09-06 17:42 ` ahesford
2021-09-06 17:47 ` tornaria
2021-09-07 15:08 ` Dko1905
2021-09-07 15:09 ` Dko1905
2021-09-07 15:49 ` Dko1905
2021-09-07 15:55 ` [PR PATCH] [Updated] " Dko1905
2021-09-07 15:56 ` [PR REVIEW] " Dko1905
2021-09-07 15:58 ` Dko1905
2021-09-07 16:05 ` ahesford
2021-09-07 22:34 ` tornaria
2021-09-07 22:46 ` tornaria
2021-09-07 22:49 ` tornaria
2021-09-07 22:49 ` tornaria
2021-09-08 11:41 ` [PR PATCH] [Updated] " Dko1905
2021-09-08 11:52 ` Dko1905
2021-09-08 11:52 ` [PR REVIEW] " Dko1905
2021-09-08 11:52 ` Dko1905
2021-09-08 11:52 ` Dko1905
2021-09-08 12:19 ` tornaria
2021-09-08 12:26 ` [PR REVIEW] " tornaria
2021-09-08 12:50 ` ahesford
2021-09-08 12:50 ` ahesford
2021-09-28  8:55 ` [PR PATCH] [Updated] " Dko1905
2021-09-28  8:55 ` [PR PATCH] [Closed]: " Dko1905
2021-09-28  9:16 ` Dko1905

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).