Blame SOURCES/0048-manager-don-t-kill-initial-setup-right-away-with-Xor.patch

e0b6b0
From f1b7d85b46dfc253176d6a043dcce26da3a26dfb Mon Sep 17 00:00:00 2001
c90517
From: Ray Strode <rstrode@redhat.com>
c90517
Date: Mon, 13 Jul 2020 09:23:06 -0400
e0b6b0
Subject: [PATCH 48/51] manager: don't kill initial-setup right away with Xorg
c90517
 either
c90517
c90517
The login screen for both Xorg and wayland sessions is now silently
c90517
killed in the background post login.
c90517
c90517
We still kill initial-setup for Xorg sessions up front, though.
c90517
c90517
This commit fixes that.
c90517
---
c90517
 daemon/gdm-manager.c | 20 ++------------------
c90517
 1 file changed, 2 insertions(+), 18 deletions(-)
c90517
c90517
diff --git a/daemon/gdm-manager.c b/daemon/gdm-manager.c
c90517
index cf982870c..b147d73db 100644
c90517
--- a/daemon/gdm-manager.c
c90517
+++ b/daemon/gdm-manager.c
c90517
@@ -1757,123 +1757,107 @@ chown_initial_setup_home_dir (void)
c90517
 
c90517
         uid = (uid_t) atoi (gis_uid_contents);
c90517
         pwe = getpwuid (uid);
c90517
         if (uid == 0 || pwe == NULL) {
c90517
                 g_warning ("UID '%s' in %s is not valid", gis_uid_contents, gis_uid_path);
c90517
                 goto out;
c90517
         }
c90517
 
c90517
         error = NULL;
c90517
         dir = g_file_new_for_path (gis_dir_path);
c90517
         if (!chown_recursively (dir, pwe->pw_uid, pwe->pw_gid, &error)) {
c90517
                 g_warning ("Failed to change ownership for %s: %s", gis_dir_path, error->message);
c90517
                 g_error_free (error);
c90517
         }
c90517
         g_object_unref (dir);
c90517
 out:
c90517
         g_free (gis_uid_contents);
c90517
         g_free (gis_uid_path);
c90517
         g_free (gis_dir_path);
c90517
 }
c90517
 
c90517
 static gboolean
c90517
 on_start_user_session (StartUserSessionOperation *operation)
c90517
 {
c90517
         GdmManager *self = operation->manager;
c90517
         gboolean migrated;
c90517
         gboolean fail_if_already_switched = TRUE;
c90517
         gboolean doing_initial_setup = FALSE;
c90517
         GdmDisplay *display;
c90517
         const char *session_id;
c90517
-#if defined(ENABLE_WAYLAND_SUPPORT) && defined(ENABLE_USER_DISPLAY_SERVER)
c90517
-        g_autofree char *display_session_type = NULL;
c90517
-#endif
c90517
 
c90517
         g_debug ("GdmManager: start or jump to session");
c90517
 
c90517
         /* If there's already a session running, jump to it.
c90517
          * If the only session running is the one we just opened,
c90517
          * start a session on it.
c90517
          */
c90517
         migrated = switch_to_compatible_user_session (operation->manager, operation->session, fail_if_already_switched);
c90517
 
c90517
         g_debug ("GdmManager: migrated: %d", migrated);
c90517
         if (migrated) {
c90517
                 /* We don't stop the manager here because
c90517
                    when Xorg exits it switches to the VT it was
c90517
                    started from.  That interferes with fast
c90517
                    user switching. */
c90517
                 gdm_session_reset (operation->session);
c90517
                 destroy_start_user_session_operation (operation);
c90517
                 goto out;
c90517
         }
c90517
 
c90517
         display = get_display_for_user_session (operation->session);
c90517
 
c90517
         g_object_get (G_OBJECT (display),
c90517
                       "doing-initial-setup", &doing_initial_setup,
c90517
-#if defined(ENABLE_WAYLAND_SUPPORT) && defined(ENABLE_USER_DISPLAY_SERVER)
c90517
-                      "session-type", &display_session_type,
c90517
-#endif
c90517
                       NULL);
c90517
 
c90517
         session_id = gdm_session_get_conversation_session_id (operation->session,
c90517
                                                               operation->service_name);
c90517
 
c90517
         if (gdm_session_get_display_mode (operation->session) == GDM_SESSION_DISPLAY_MODE_REUSE_VT) {
c90517
                 /* In this case, the greeter's display is morphing into
c90517
                  * the user session display. Kill the greeter on this session
c90517
                  * and let the user session follow the same display. */
c90517
                 gdm_display_stop_greeter_session (display);
c90517
                 g_object_set (G_OBJECT (display),
c90517
                                 "session-class", "user",
c90517
                                 "session-id", session_id,
c90517
                                 NULL);
c90517
         } else {
c90517
                 uid_t allowed_uid;
c90517
 
c90517
                 g_object_ref (display);
c90517
                 if (doing_initial_setup) {
c90517
                         g_autoptr(GError) error = NULL;
c90517
 
c90517
-#if defined(ENABLE_WAYLAND_SUPPORT) && defined(ENABLE_USER_DISPLAY_SERVER)
c90517
-                        if (g_strcmp0 (display_session_type, "wayland") == 0) {
c90517
-                                g_debug ("GdmManager: closing down initial setup display in background");
c90517
-                                g_object_set (G_OBJECT (display), "status", GDM_DISPLAY_WAITING_TO_FINISH, NULL);
c90517
-                        }
c90517
-#endif
c90517
-                        if (gdm_display_get_status (display) == GDM_DISPLAY_MANAGED) {
c90517
-                                g_debug ("GdmManager: closing down initial setup display");
c90517
-                                gdm_display_stop_greeter_session (display);
c90517
-                                gdm_display_unmanage (display);
c90517
-                                gdm_display_finish (display);
c90517
-                        }
c90517
+                        g_debug ("GdmManager: closing down initial setup display in background");
c90517
+                        g_object_set (G_OBJECT (display), "status", GDM_DISPLAY_WAITING_TO_FINISH, NULL);
c90517
 
c90517
                         chown_initial_setup_home_dir ();
c90517
 
c90517
                         if (!g_file_set_contents (ALREADY_RAN_INITIAL_SETUP_ON_THIS_BOOT,
c90517
                                                   "1",
c90517
                                                   1,
c90517
                                                   &error)) {
c90517
                                 g_warning ("GdmDisplay: Could not write initial-setup-done marker to %s: %s",
c90517
                                            ALREADY_RAN_INITIAL_SETUP_ON_THIS_BOOT,
c90517
                                            error->message);
c90517
                                 g_clear_error (&error);
c90517
                         }
c90517
                 } else {
c90517
                         g_debug ("GdmManager: session has its display server, reusing our server for another login screen");
c90517
                 }
c90517
 
c90517
                 /* The user session is going to follow the session worker
c90517
                  * into the new display. Untie it from this display and
c90517
                  * create a new session for a future user login. */
c90517
                 allowed_uid = gdm_session_get_allowed_user (operation->session);
c90517
                 g_object_set_data (G_OBJECT (display), "gdm-user-session", NULL);
c90517
                 g_object_set_data (G_OBJECT (operation->session), "gdm-display", NULL);
c90517
                 create_user_session_for_display (operation->manager, display, allowed_uid);
c90517
 
c90517
                 /* Give the user session a new display object for bookkeeping purposes */
c90517
                 create_display_for_user_session (operation->manager,
c90517
                                                  operation->session,
c90517
                                                  session_id);
c90517
 
c90517
                 if ((g_strcmp0 (operation->service_name, "gdm-autologin") == 0) &&
c90517
-- 
e0b6b0
2.27.0
c90517