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

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