Accepting request 419329 from Base:System

1

OBS-URL: https://build.opensuse.org/request/show/419329
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/grub2?expand=0&rev=141
This commit is contained in:
Dominique Leuenberger 2016-08-18 08:19:54 +00:00 committed by Git OBS Bridge
commit c4e0ef303a
3 changed files with 68 additions and 1 deletions

View File

@ -0,0 +1,58 @@
Index: grub-2.02~beta2/grub-core/normal/menu.c
===================================================================
--- grub-2.02~beta2.orig/grub-core/normal/menu.c
+++ grub-2.02~beta2/grub-core/normal/menu.c
@@ -575,6 +575,44 @@ print_countdown (struct grub_term_coordi
grub_refresh ();
}
+/* bsc#956046 - The first entry titled 'Bootable snapshot #$NUM' is inserted on
+ top at runtime to display current snapshot information. If default entry is
+ using number as key to index the entry, the result will be shifted so here we
+ add specical handling to shift it back. We apply this workaround until a better
+ solution can be found. */
+static void
+workaround_snapshot_menu_default_entry (grub_menu_t menu, const char *name, int *default_entry)
+{
+ grub_menu_entry_t entry;
+
+ if ((entry = grub_menu_get_entry (menu, 0))
+ && entry->submenu
+ && grub_strncmp (entry->title, "Bootable snapshot", sizeof("Bootable snapshot") - 1) == 0)
+ {
+ const char *val;
+
+ if (*default_entry == -1 && menu->size > 1)
+ {
+ *default_entry = 1;
+ return;
+ }
+
+ val = grub_env_get (name);
+
+ grub_error_push ();
+
+ if (val)
+ grub_strtoul (val, 0, 0);
+
+ if (*default_entry < (menu->size - 1) && grub_errno == GRUB_ERR_NONE)
+ ++(*default_entry);
+
+ grub_error_pop ();
+ }
+
+ return;
+}
+
#define GRUB_MENU_PAGE_SIZE 10
/* Show the menu and handle menu entry selection. Returns the menu entry
@@ -593,6 +631,8 @@ run_menu (grub_menu_t menu, int nested,
default_entry = get_entry_number (menu, "default");
+ workaround_snapshot_menu_default_entry (menu, "default", &default_entry);
+
/* If DEFAULT_ENTRY is not within the menu entries, fall back to
the first entry. */
if (default_entry < 0 || default_entry >= menu->size)

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Fri Aug 12 08:32:05 UTC 2016 - mchang@suse.com
- Workaround default entry in snapshot menu (bsc#956046)
* grub2-btrfs-08-workaround-snapshot-menu-default-entry.patch
- grub2.spec: Add true command to grub.efi (bsc#993274)
-------------------------------------------------------------------
Wed Aug 3 04:45:51 UTC 2016 - mchang@suse.com

View File

@ -193,6 +193,7 @@ Patch104: grub2-btrfs-04-grub2-install.patch
Patch105: grub2-btrfs-05-grub2-mkconfig.patch
Patch106: grub2-btrfs-06-subvol-mount.patch
Patch107: grub2-btrfs-07-subvol-fallback.patch
Patch108: grub2-btrfs-08-workaround-snapshot-menu-default-entry.patch
# Support EFI xen loader
Patch120: grub2-efi-xen-chainload.patch
Patch121: grub2-efi-chainloader-root.patch
@ -430,6 +431,7 @@ swap partition while in resuming
%patch105 -p1
%patch106 -p1
%patch107 -p1
%patch108 -p1
%patch120 -p1
%patch121 -p1
%patch122 -p1
@ -527,7 +529,7 @@ make %{?_smp_mflags}
#TODO: add efifwsetup module
FS_MODULES="ext2 btrfs ext2 xfs jfs reiserfs"
CD_MODULES=" all_video boot cat chain configfile echo \
CD_MODULES=" all_video boot cat chain configfile echo true \
efinet font gfxmenu gfxterm gzio halt iso9660 \
jpeg minicmd normal part_apple part_msdos part_gpt \
password_pbkdf2 png reboot search search_fs_uuid \