commit:     becfea3c2a348982323838e525525d57501b0c07
Author:     Steffen Winter <steffen.winter <AT> proton <DOT> me>
AuthorDate: Sun Jun 23 14:44:48 2024 +0000
Commit:     John Helmert III <ajak <AT> gentoo <DOT> org>
CommitDate: Thu Jun 27 18:34:21 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=becfea3c

app-crypt/sbctl: backport bashism fix in kernel install hook

Closes: https://bugs.gentoo.org/934768
Signed-off-by: Steffen Winter <steffen.winter <AT> proton.me>
Closes: https://github.com/gentoo/gentoo/pull/37253
Signed-off-by: John Helmert III <ajak <AT> gentoo.org>

 .../files/sbctl-0.14-installkernel-bashism.patch   | 37 ++++++++++++++++++++++
 .../{sbctl-0.14.ebuild => sbctl-0.14-r1.ebuild}    |  4 +++
 2 files changed, 41 insertions(+)

diff --git a/app-crypt/sbctl/files/sbctl-0.14-installkernel-bashism.patch 
b/app-crypt/sbctl/files/sbctl-0.14-installkernel-bashism.patch
new file mode 100644
index 000000000000..bc1b988769fc
--- /dev/null
+++ b/app-crypt/sbctl/files/sbctl-0.14-installkernel-bashism.patch
@@ -0,0 +1,37 @@
+From 1167500b9da76febe85342e09b1bf9eeaf367ca6 Mon Sep 17 00:00:00 2001
+From: MithicSpirit <[email protected]>
+Date: Fri, 10 May 2024 17:51:59 -0400
+Subject: [PATCH] nit(91-sbctl.install): consistent syntax for tests
+
+Unifies usage of testing commands like `[]`, `test`, and `[[]]` to just
+use `[]` everywhere. This also improves compatibility, as `[[]]` is not
+available in POSIX sh.
+
+Bug: https://bugs.gentoo.org/934768
+Signed-off-by: Steffen Winter <[email protected]>
+--- a/contrib/kernel-install/91-sbctl.install
++++ b/contrib/kernel-install/91-sbctl.install
+@@ -31,7 +31,7 @@ add)
+ 
+       # exit without error if keys don't exist
+       # https://github.com/Foxboron/sbctl/issues/187
+-      if ! test -d /usr/share/secureboot/keys; then
++      if ! [ -d /usr/share/secureboot/keys ]; then
+               echo "Secureboot key directory doesn't exist, not signing!"
+               exit 0
+       fi
+@@ -39,10 +39,10 @@ add)
+       sbctl sign -s "$IMAGE_FILE" 1>/dev/null
+       ;;
+ remove)
+-      if [[ -e "$IMAGE_FILE" ]]; then
+-          [ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] &&
+-              printf 'sbctl: Removing kernel %s from signing database\n' 
"$IMAGE_FILE"
+-          sbctl remove-file "$IMAGE_FILE" 1>/dev/null
++      if [ -e "$IMAGE_FILE" ]; then
++              [ "$KERNEL_INSTALL_VERBOSE" -gt 0 ] &&
++                      printf 'sbctl: Removing kernel %s from signing 
database\n' "$IMAGE_FILE"
++              sbctl remove-file "$IMAGE_FILE" 1>/dev/null
+       fi
+       ;;
+ esac

diff --git a/app-crypt/sbctl/sbctl-0.14.ebuild 
b/app-crypt/sbctl/sbctl-0.14-r1.ebuild
similarity index 93%
rename from app-crypt/sbctl/sbctl-0.14.ebuild
rename to app-crypt/sbctl/sbctl-0.14-r1.ebuild
index 97f67663daf4..8cdded303c60 100644
--- a/app-crypt/sbctl/sbctl-0.14.ebuild
+++ b/app-crypt/sbctl/sbctl-0.14-r1.ebuild
@@ -20,6 +20,10 @@ BDEPEND="app-text/asciidoc
 
 VERIFY_SIG_OPENPGP_KEY_PATH="/usr/share/openpgp-keys/foxboron.asc"
 
+PATCHES=(
+       "${FILESDIR}/sbctl-0.14-installkernel-bashism.patch"
+)
+
 src_unpack() {
        if use verify-sig; then
                verify-sig_verify_detached "${DISTDIR}"/${P}.tar.gz{,.sig}

Reply via email to