c751d8e
From 5314490a7e5ce5770059363a84e13e87f3d9669c Mon Sep 17 00:00:00 2001
650dd58
From: Hans de Goede <hdegoede@redhat.com>
650dd58
Date: Tue, 14 Aug 2018 14:49:59 +0200
650dd58
Subject: [PATCH 2/2] Fedora: Set grub boot-flags on shutdown / reboot
650dd58
650dd58
Fedora's grub will automatically hide the boot-menu if the previous
650dd58
boot has set the boot_success flag in grub's environment. This happens
650dd58
automatically 30 seconds after login.
650dd58
650dd58
But if the user shuts down or reboots from the system-menu before then
650dd58
(e.g. directly from gdm) then the boot_success flag gets not set. If
650dd58
a reboot / shutdown is initiated through gnome-session then the user
650dd58
is successfully interacting with the system, so set the boot_success
650dd58
flag from gnome_session for this case to fix reboot from gdm leading to
650dd58
the boot-menu not being hidden.
650dd58
650dd58
Likewise implement ConfirmedRebootMenu handling in a Fedora specific
650dd58
way (for now) by setting the menu_show_once grub bootflag in this case.
650dd58
---
650dd58
 gnome-session/gsm-manager.c | 15 ++++++++++++++-
650dd58
 1 file changed, 14 insertions(+), 1 deletion(-)
650dd58
650dd58
diff --git a/gnome-session/gsm-manager.c b/gnome-session/gsm-manager.c
c751d8e
index e0c05d82..b4d50936 100644
650dd58
--- a/gnome-session/gsm-manager.c
650dd58
+++ b/gnome-session/gsm-manager.c
c751d8e
@@ -3842,14 +3842,27 @@ do_query_end_session_exit (GsmManager *manager)
650dd58
                 break;
650dd58
         case GSM_MANAGER_LOGOUT_REBOOT:
650dd58
         case GSM_MANAGER_LOGOUT_REBOOT_INTERACT:
650dd58
+                /*
650dd58
+                 * Fedora specific patch to make sure the boot-menu does not
650dd58
+                 * show when it is configured to auto-hide and a reboot is
650dd58
+                 * initiated directly from gdm.
650dd58
+                 */
650dd58
+                system("/usr/sbin/grub2-set-bootflag boot_success");
650dd58
                 reboot = TRUE;
650dd58
                 break;
650dd58
         case GSM_MANAGER_LOGOUT_REBOOT_TO_BOOT_OPTIONS:
650dd58
-                /* FIXME tell bootmanager to show menu on next boot */
650dd58
+                /* Fedora specific implementation to show the menu on next boot */
650dd58
+                system("/usr/sbin/grub2-set-bootflag menu_show_once");
650dd58
                 reboot = TRUE;
650dd58
                 break;
650dd58
         case GSM_MANAGER_LOGOUT_SHUTDOWN:
650dd58
         case GSM_MANAGER_LOGOUT_SHUTDOWN_INTERACT:
650dd58
+                /*
650dd58
+                 * Fedora specific patch to make sure the boot-menu does not
650dd58
+                 * show when it is configured to auto-hide and a shutdown is
650dd58
+                 * initiated directly from gdm.
650dd58
+                 */
650dd58
+                system("/usr/sbin/grub2-set-bootflag boot_success");
650dd58
                 shutdown = TRUE;
650dd58
                 break;
650dd58
         default:
650dd58
-- 
c751d8e
2.23.0
650dd58