Blame SOURCES/0001-Fedora-Set-grub-boot-flags-on-shutdown-reboot.patch

0ae1c8
From 15be30033e5b24a8c84a4d4338da0e8a3930303a Mon Sep 17 00:00:00 2001
0ae1c8
From: Hans de Goede <hdegoede@redhat.com>
0ae1c8
Date: Tue, 14 Aug 2018 14:49:59 +0200
0ae1c8
Subject: [PATCH] Fedora: Set grub boot-flags on shutdown / reboot
0ae1c8
0ae1c8
Fedora's grub will automatically hide the boot-menu if the previous
0ae1c8
boot has set the boot_success flag in grub's environment. This happens
0ae1c8
automatically 30 seconds after login.
0ae1c8
0ae1c8
But if the user shuts down or reboots from the system-menu before then
0ae1c8
(e.g. directly from gdm) then the boot_success flag gets not set. If
0ae1c8
a reboot / shutdown is initiated through gnome-session then the user
0ae1c8
is successfully interacting with the system, so set the boot_success
0ae1c8
flag from gnome_session for this case to fix reboot from gdm leading to
0ae1c8
the boot-menu not being hidden.
0ae1c8
---
0ae1c8
 gnome-session/gsm-manager.c | 12 ++++++++++++
0ae1c8
 1 file changed, 12 insertions(+)
0ae1c8
0ae1c8
diff --git a/gnome-session/gsm-manager.c b/gnome-session/gsm-manager.c
0ae1c8
index 3cf421cd..924767af 100644
0ae1c8
--- a/gnome-session/gsm-manager.c
0ae1c8
+++ b/gnome-session/gsm-manager.c
0ae1c8
@@ -3629,51 +3629,63 @@ on_shutdown_prepared (GsmSystem  *system,
0ae1c8
                       gboolean    success,
0ae1c8
                       GsmManager *manager)
0ae1c8
 {
0ae1c8
         g_debug ("GsmManager: on_shutdown_prepared, success: %d", success);
0ae1c8
         g_signal_handlers_disconnect_by_func (system, on_shutdown_prepared, manager);
0ae1c8
 
0ae1c8
         if (success) {
0ae1c8
                 /* move to end-session phase */
0ae1c8
                 g_assert (manager->priv->phase == GSM_MANAGER_PHASE_QUERY_END_SESSION);
0ae1c8
                 manager->priv->phase++;
0ae1c8
                 start_phase (manager);
0ae1c8
         } else {
0ae1c8
                 disconnect_shell_dialog_signals (manager);
0ae1c8
                 gsm_shell_close_end_session_dialog (manager->priv->shell);
0ae1c8
                 /* back to running phase */
0ae1c8
                 cancel_end_session (manager);
0ae1c8
         }
0ae1c8
 }
0ae1c8
 
0ae1c8
 static gboolean
0ae1c8
 do_query_end_session_exit (GsmManager *manager)
0ae1c8
 {
0ae1c8
         gboolean reboot = FALSE;
0ae1c8
         gboolean shutdown = FALSE;
0ae1c8
 
0ae1c8
         switch (manager->priv->logout_type) {
0ae1c8
         case GSM_MANAGER_LOGOUT_LOGOUT:
0ae1c8
                 break;
0ae1c8
         case GSM_MANAGER_LOGOUT_REBOOT:
0ae1c8
         case GSM_MANAGER_LOGOUT_REBOOT_INTERACT:
0ae1c8
+                /*
0ae1c8
+                 * Fedora specific patch to make sure the boot-menu does not
0ae1c8
+                 * show when it is configured to auto-hide and a reboot is
0ae1c8
+                 * initiated directly from gdm.
0ae1c8
+                 */
0ae1c8
+                system("/usr/sbin/grub2-set-bootflag boot_success");
0ae1c8
                 reboot = TRUE;
0ae1c8
                 break;
0ae1c8
         case GSM_MANAGER_LOGOUT_SHUTDOWN:
0ae1c8
         case GSM_MANAGER_LOGOUT_SHUTDOWN_INTERACT:
0ae1c8
+                /*
0ae1c8
+                 * Fedora specific patch to make sure the boot-menu does not
0ae1c8
+                 * show when it is configured to auto-hide and a shutdown is
0ae1c8
+                 * initiated directly from gdm.
0ae1c8
+                 */
0ae1c8
+                system("/usr/sbin/grub2-set-bootflag boot_success");
0ae1c8
                 shutdown = TRUE;
0ae1c8
                 break;
0ae1c8
         default:
0ae1c8
                 g_warning ("Unexpected logout type %d in do_query_end_session_exit()",
0ae1c8
                            manager->priv->logout_type);
0ae1c8
                 break;
0ae1c8
         }
0ae1c8
 
0ae1c8
         if (reboot || shutdown) {
0ae1c8
                 g_signal_connect (manager->priv->system, "shutdown-prepared",
0ae1c8
                                   G_CALLBACK (on_shutdown_prepared), manager);
0ae1c8
                 gsm_system_prepare_shutdown (manager->priv->system, reboot);
0ae1c8
                 return FALSE; /* don't leave query end session yet */
0ae1c8
         }
0ae1c8
 
0ae1c8
         return TRUE; /* go to end session phase */
0ae1c8
 }
0ae1c8
-- 
0ae1c8
2.31.1
0ae1c8