commit:     d16d04c25e9ffbafe9a4d4821a277fa98edc833d
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Thu Feb 12 02:40:50 2026 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Thu Feb 12 16:54:33 2026 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d16d04c2

sys-boot/grub: rework sbat logic

Templatize the generation field and update the generation for 2.12 and
2.14.

Closes: https://bugs.gentoo.org/954009
Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>
Part-of: https://codeberg.org/gentoo/gentoo/pulls/43
Merges: https://codeberg.org/gentoo/gentoo/pulls/43

 sys-boot/grub/files/sbat.csv                                 |  3 ---
 sys-boot/grub/files/sbat.csv.in                              |  3 +++
 sys-boot/grub/{grub-2.12-r11.ebuild => grub-2.12-r12.ebuild} | 11 +++++++++--
 sys-boot/grub/{grub-2.14-r1.ebuild => grub-2.14-r2.ebuild}   | 11 +++++++++--
 sys-boot/grub/grub-9999.ebuild                               | 11 +++++++++--
 5 files changed, 30 insertions(+), 9 deletions(-)

diff --git a/sys-boot/grub/files/sbat.csv b/sys-boot/grub/files/sbat.csv
deleted file mode 100644
index f85cd8eb0632..000000000000
--- a/sys-boot/grub/files/sbat.csv
+++ /dev/null
@@ -1,3 +0,0 @@
-sbat,1,SBAT Version,sbat,1,https://github.com/rhboot/shim/blob/main/SBAT.md
-grub,3,Free Software Foundation,grub,%PV%,https://www.gnu.org/software/grub/
-grub.gentoo,1,Gentoo,grub,%PV%,https://bugs.gentoo.org/

diff --git a/sys-boot/grub/files/sbat.csv.in b/sys-boot/grub/files/sbat.csv.in
new file mode 100644
index 000000000000..1c112393e8eb
--- /dev/null
+++ b/sys-boot/grub/files/sbat.csv.in
@@ -0,0 +1,3 @@
+sbat,1,SBAT Version,sbat,1,https://github.com/rhboot/shim/blob/main/SBAT.md
+grub,@GEN_GRUB@,Free Software 
Foundation,grub,@PV@,https://www.gnu.org/software/grub/
+grub.gentoo,@GEN_GENTOO@,Gentoo,grub,@PVR@,https://bugs.gentoo.org/

diff --git a/sys-boot/grub/grub-2.12-r11.ebuild 
b/sys-boot/grub/grub-2.12-r12.ebuild
similarity index 98%
rename from sys-boot/grub/grub-2.12-r11.ebuild
rename to sys-boot/grub/grub-2.12-r12.ebuild
index dd675f80bfd9..7b91114ef24d 100644
--- a/sys-boot/grub/grub-2.12-r11.ebuild
+++ b/sys-boot/grub/grub-2.12-r12.ebuild
@@ -275,6 +275,14 @@ src_configure() {
        export LEX=flex
        unset YACC
 
+       local sedargs=(
+               -e "s/@PV@/${PV}/"
+               -e "s/@PVR@/${PVR}/"
+               -e "s/@GEN_GRUB@/4/"
+               -e "s/@GEN_GENTOO@/1/"
+       )
+       sed "${sedargs[@]}" "${FILESDIR}/sbat.csv.in" > "${WORKDIR}/sbat.csv" 
|| die
+
        MULTIBUILD_VARIANTS=()
        local p
        for p in "${GRUB_ALL_PLATFORMS[@]}"; do
@@ -381,9 +389,8 @@ src_install() {
        # https://bugs.gentoo.org/231935
        dostrip -x /usr/lib/grub
 
-       sed -e "s/%PV%/${PV}/" "${FILESDIR}/sbat.csv" > "${T}/sbat.csv" || die
        insinto /usr/share/grub
-       doins "${T}/sbat.csv"
+       doins "${WORKDIR}/sbat.csv"
 
        if use elibc_musl; then
                # https://bugs.gentoo.org/900348

diff --git a/sys-boot/grub/grub-2.14-r1.ebuild 
b/sys-boot/grub/grub-2.14-r2.ebuild
similarity index 98%
rename from sys-boot/grub/grub-2.14-r1.ebuild
rename to sys-boot/grub/grub-2.14-r2.ebuild
index 48baae6cb21c..7d50dd838c63 100644
--- a/sys-boot/grub/grub-2.14-r1.ebuild
+++ b/sys-boot/grub/grub-2.14-r2.ebuild
@@ -283,6 +283,14 @@ src_configure() {
        export LEX=flex
        unset YACC
 
+       local sedargs=(
+               -e "s/@PV@/${PV}/"
+               -e "s/@PVR@/${PVR}/"
+               -e "s/@GEN_GRUB@/5/"
+               -e "s/@GEN_GENTOO@/1/"
+       )
+       sed "${sedargs[@]}" "${FILESDIR}/sbat.csv.in" > "${WORKDIR}/sbat.csv" 
|| die
+
        MULTIBUILD_VARIANTS=()
        local p
        for p in "${GRUB_ALL_PLATFORMS[@]}"; do
@@ -389,9 +397,8 @@ src_install() {
        # https://bugs.gentoo.org/231935
        dostrip -x /usr/lib/grub
 
-       sed -e "s/%PV%/${PV}/" "${FILESDIR}/sbat.csv" > "${T}/sbat.csv" || die
        insinto /usr/share/grub
-       doins "${T}/sbat.csv"
+       doins "${WORKDIR}/sbat.csv"
 
        if use elibc_musl; then
                # https://bugs.gentoo.org/900348

diff --git a/sys-boot/grub/grub-9999.ebuild b/sys-boot/grub/grub-9999.ebuild
index a19d2f46b719..1c175f98607e 100644
--- a/sys-boot/grub/grub-9999.ebuild
+++ b/sys-boot/grub/grub-9999.ebuild
@@ -280,6 +280,14 @@ src_configure() {
        export LEX=flex
        unset YACC
 
+       local sedargs=(
+               -e "s/@PV@/${PV}/"
+               -e "s/@PVR@/${PVR}/"
+               -e "s/@GEN_GRUB@/5/"
+               -e "s/@GEN_GENTOO@/1/"
+       )
+       sed "${sedargs[@]}" "${FILESDIR}/sbat.csv.in" > "${WORKDIR}/sbat.csv" 
|| die
+
        MULTIBUILD_VARIANTS=()
        local p
        for p in "${GRUB_ALL_PLATFORMS[@]}"; do
@@ -386,9 +394,8 @@ src_install() {
        # https://bugs.gentoo.org/231935
        dostrip -x /usr/lib/grub
 
-       sed -e "s/%PV%/${PV}/" "${FILESDIR}/sbat.csv" > "${T}/sbat.csv" || die
        insinto /usr/share/grub
-       doins "${T}/sbat.csv"
+       doins "${WORKDIR}/sbat.csv"
 
        if use elibc_musl; then
                # https://bugs.gentoo.org/900348

Reply via email to