Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package grub2 for openSUSE:Factory checked 
in at 2025-05-31 19:14:27
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/grub2 (Old)
 and      /work/SRC/openSUSE:Factory/.grub2.new.16005 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "grub2"

Sat May 31 19:14:27 2025 rev:363 rq:1281004 version:2.12

Changes:
--------
--- /work/SRC/openSUSE:Factory/grub2/grub2.changes      2025-05-23 
14:29:49.918752590 +0200
+++ /work/SRC/openSUSE:Factory/.grub2.new.16005/grub2.changes   2025-05-31 
19:14:32.857007473 +0200
@@ -1,0 +2,12 @@
+Thu May 29 04:06:14 UTC 2025 - Michael Chang <mch...@suse.com>
+
+- Use /etc/SUSE-brand to display OS label (bsc#1239169)
+  * 0001-mkconfig-Determine-GRUB_DISTRIBUTOR-from-etc-SUSE-br.patch
+
+-------------------------------------------------------------------
+Wed May 25 13:31:57 UTC 2025 - Danilo Spinella <danilo.spine...@suse.com>
+
+- Add support for LoaderEntryOneshot
+  * grub2-bls-loader-entry-oneshot.patch
+
+-------------------------------------------------------------------

New:
----
  0001-mkconfig-Determine-GRUB_DISTRIBUTOR-from-etc-SUSE-br.patch
  grub2-bls-loader-entry-oneshot.patch

BETA DEBUG BEGIN:
  New:- Use /etc/SUSE-brand to display OS label (bsc#1239169)
  * 0001-mkconfig-Determine-GRUB_DISTRIBUTOR-from-etc-SUSE-br.patch
  New:- Add support for LoaderEntryOneshot
  * grub2-bls-loader-entry-oneshot.patch
BETA DEBUG END:

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ grub2.spec ++++++
--- /var/tmp/diff_new_pack.W1xwQu/_old  2025-05-31 19:14:37.201187001 +0200
+++ /var/tmp/diff_new_pack.W1xwQu/_new  2025-05-31 19:14:37.205187167 +0200
@@ -479,6 +479,8 @@
 Patch308:       0008-cryptocheck-Add-quiet-option.patch
 Patch309:       0001-Improve-TPM-key-protection-on-boot-interruptions.patch
 Patch310:       0004-Key-revocation-on-out-of-bound-file-access.patch
+Patch311:       grub2-bls-loader-entry-oneshot.patch
+Patch312:       0001-mkconfig-Determine-GRUB_DISTRIBUTOR-from-etc-SUSE-br.patch
 
 %if 0%{?suse_version} < 1600
 Requires:       gettext-runtime

++++++ 0001-mkconfig-Determine-GRUB_DISTRIBUTOR-from-etc-SUSE-br.patch ++++++
>From a5208417eecf9313239aa0659d4b015f2a3ba33e Mon Sep 17 00:00:00 2001
From: Michael Chang <mch...@suse.com>
Date: Thu, 29 May 2025 11:47:08 +0800
Subject: [PATCH] mkconfig: Determine GRUB_DISTRIBUTOR from /etc/SUSE-brand

Starting with SLE 16, the $NAME field in /etc/os-release contains only
the unified value "SLE". To provide a more specific OS label for GRUB
menu entries, GRUB should instead use the value from /etc/SUSE-brand.

Signed-off-by: Michael Chang <mch...@suse.com>
---
 util/grub-mkconfig.in | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
index 31c4851aee..e11835ad69 100644
--- a/util/grub-mkconfig.in
+++ b/util/grub-mkconfig.in
@@ -226,6 +226,17 @@ GRUB_ACTUAL_DEFAULT="$GRUB_DEFAULT"
 
 if [ "x${GRUB_ACTUAL_DEFAULT}" = "xsaved" ] ; then 
GRUB_ACTUAL_DEFAULT="`"${grub_editenv}" - list | sed -n '/^saved_entry=/ 
s,^saved_entry=,,p'`" ; fi
 
+# Use /etc/SUSE-brand for os label (bsc#1239169)
+grub_os_id () (
+    VERSION=""
+    GRUB_OS_ID=""
+    # Source /etc/SUSE-brand only if it defines GRUB_OS_ID
+    ! grep -q "^GRUB_OS_ID=" "${sysconfdir}/SUSE-brand" 2>/dev/null || source 
"${sysconfdir}/SUSE-brand"
+    # Check VERSION is 16.0 or newer before applying for backward compatibility
+    [ x"`echo -e "${VERSION}\n16.0" | sort -V | head -n1`" = x"16.0" ] || 
GRUB_OS_ID=""
+    echo "$GRUB_OS_ID"
+)
+
 if [ x"${GRUB_DISTRIBUTOR}" = x ] ; then
     for i in "${sysconfdir}/os-release" "/usr/lib/os-release" ; do
       if [ -f "$i" ] ; then
@@ -233,7 +244,12 @@ if [ x"${GRUB_DISTRIBUTOR}" = x ] ; then
         break
       fi
     done
-    if [ x"${NAME}" != x ] && [ x"${VERSION}" != x ] ; then
+
+    OS_ID=`grub_os_id`
+
+    if [ x"${OS_ID}" != x ] ; then
+      GRUB_DISTRIBUTOR="${OS_ID}"
+    elif [ x"${NAME}" != x ] && [ x"${VERSION}" != x ] ; then
       GRUB_DISTRIBUTOR="${NAME} ${VERSION}"
     else
       GRUB_DISTRIBUTOR="${NAME}"
-- 
2.49.0



++++++ grub2-bls-loader-entry-oneshot.patch ++++++
Add support for LoaderEntryOneshot EFI variable

Index: grub-2.12/grub-core/normal/menu.c
===================================================================
--- grub-2.12.orig/grub-core/normal/menu.c
+++ grub-2.12/grub-core/normal/menu.c
@@ -36,6 +36,16 @@
 #ifdef GRUB_MACHINE_IEEE1275
 #include <grub/ieee1275/ieee1275.h>
 #endif
+#ifdef GRUB_MACHINE_EFI
+#include <grub/charset.h>
+#include <grub/efi/api.h>
+#include <grub/efi/efi.h>
+
+#define GRUB_EFI_LOADER_GUID \
+        { 0x4a67b082, 0x0a4c, 0x41cf, { 0xb6, 0xc7, 0x44, 0x0b, 0x29, 0xbb, 
0x8c, 0x4f } }
+static grub_guid_t grub_efi_loader_guid = GRUB_EFI_LOADER_GUID;
+
+#endif
 
 /* Time to delay after displaying an error message about a default/fallback
    entry failing to boot.  */
@@ -562,6 +572,62 @@ menuentry_eq (const char *id, const char
     }
 }
 
+/* Search for an entry in the menu by its name */
+static int
+search_entry (grub_menu_t menu, const char* name)
+{
+  /* See if the variable matches the title of a menu entry.  */
+  grub_menu_entry_t e = menu->entry_list;
+  int i;
+  int entry;
+
+  /* Skip hidden entries */
+  while (e && e->hidden)
+  e = e->next;
+
+  grub_errno = GRUB_ERR_NONE;
+
+  for (i = 0; e; i++)
+  {
+       if (menuentry_eq (e->title, name)
+               || menuentry_eq (e->id, name))
+         {
+               entry = i;
+               break;
+         }
+
+       if (e->bls)
+         {
+               char *v, *ext;
+
+               if ((v = grub_strdup (name)) &&
+                       (ext = grub_strrchr (v, '.')) &&
+                       grub_strcmp (ext, ".conf") == 0)
+                 {
+                       *ext = '\0';
+                       if (menuentry_eq (e->id, v))
+                         {
+                               entry = i;
+                               grub_free (v);
+                               break;
+                         }
+                 }
+               grub_free (v);
+         }
+
+       e = e->next;
+
+       /* Skip hidden entries */
+       while (e && e->hidden)
+         e = e->next;
+  }
+
+  if (! e)
+       entry = -1;
+
+  return entry;
+}
+
 
 /* Get the entry number from the variable NAME.  */
 static int
@@ -580,53 +646,7 @@ get_entry_number (grub_menu_t menu, cons
 
   if (grub_errno == GRUB_ERR_BAD_NUMBER)
     {
-      /* See if the variable matches the title of a menu entry.  */
-      grub_menu_entry_t e = menu->entry_list;
-      int i;
-
-      /* Skip hidden entries */
-      while (e && e->hidden)
-       e = e->next;
-
-      grub_errno = GRUB_ERR_NONE;
-
-      for (i = 0; e; i++)
-       {
-         if (menuentry_eq (e->title, val)
-             || menuentry_eq (e->id, val))
-           {
-             entry = i;
-             break;
-           }
-
-         if (e->bls)
-           {
-             char *v, *ext;
-
-             if ((v = grub_strdup (val)) &&
-                 (ext = grub_strrchr (v, '.')) &&
-                 grub_strcmp (ext, ".conf") == 0)
-               {
-                 *ext = '\0';
-                 if (menuentry_eq (e->id, v))
-                   {
-                     entry = i;
-                     grub_free (v);
-                     break;
-                   }
-               }
-             grub_free (v);
-           }
-
-         e = e->next;
-
-         /* Skip hidden entries */
-         while (e && e->hidden)
-           e = e->next;
-       }
-
-      if (! e)
-       entry = -1;
+      entry = search_entry (menu, val);
     }
 
   if (grub_errno != GRUB_ERR_NONE)
@@ -724,6 +744,45 @@ run_menu (grub_menu_t menu, int nested,
 
   default_entry = get_entry_number (menu, "default");
 
+#ifdef GRUB_MACHINE_EFI
+  /* verify we are using blscfg */
+  const char* val = grub_env_get ("enable_blscfg");
+  if (val && (val[0] == '1' || val[0] == 'y'))
+       {
+         grub_efi_status_t status;
+         int oneshot_entry_index;
+         grub_efi_char16_t *oneshot_entry_efi = NULL;
+         char *oneshot_entry = NULL;
+         grub_size_t oneshot_entry_size;
+         status = grub_efi_get_variable("LoaderEntryOneShot",
+                                                                        
&grub_efi_loader_guid,
+                                                                        
&oneshot_entry_size,
+                                                                        
(void**) &oneshot_entry_efi);
+         if (status == GRUB_EFI_SUCCESS)
+               {
+                 grub_efi_char16_t *src = oneshot_entry_efi;
+                 int size = 0;
+                 while (*src++)
+                       size++;
+                 if (size == 0)
+                       {
+                         oneshot_entry = grub_malloc (size * sizeof (char));
+                         grub_utf16_to_utf8 ((grub_uint8_t*) oneshot_entry,
+                                                                 
(grub_uint16_t*) oneshot_entry_efi, size);
+                         oneshot_entry_index = search_entry (menu, 
oneshot_entry);
+                         if (oneshot_entry_index != -1)
+                               {
+                                 default_entry = oneshot_entry_index;
+                                 
grub_efi_set_variable_to_string("LoaderEntryOneShot",
+                                                                               
                  &grub_efi_loader_guid, "", 0);
+                               }
+                         grub_free(oneshot_entry);
+                       }
+                 grub_free(oneshot_entry_efi);
+               }
+       }
+#endif
+
   workaround_snapshot_menu_default_entry (menu, "default", &default_entry);
 
   /* If DEFAULT_ENTRY is not within the menu entries, fall back to

Reply via email to