Update live-user-mode.patch again

Hopefully fix gnome-initial-setup failing to create user account or log
into the user session.

Also, remove stray patches that I included by mistake.
This commit is contained in:
Michael Catanzaro 2024-01-22 14:18:16 -06:00
parent ae551eb5a7
commit 6b8dd31e0c

View File

@ -1,7 +1,7 @@
From 575edeab57c891a7053279c676e82bebe53222d3 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Tue, 15 Aug 2023 10:53:41 -0400
Subject: [PATCH 01/17] gnome-initial-setup: Bump GLib required version to 2.76
Subject: [PATCH 01/16] gnome-initial-setup: Bump GLib required version to 2.76
This gives us GStrvBuilder, g_ptr_array_sort_values, etc
---
@ -44,7 +44,7 @@ index 5d30fcd1..00e24d7b 100644
From 60a2db34bd50d561e716a63dd526ee7ff4810a29 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Sat, 9 Sep 2023 17:07:46 -0400
Subject: [PATCH 02/17] keyboard: Don't require localed for existing user mode
Subject: [PATCH 02/16] keyboard: Don't require localed for existing user mode
If we're in existing user mode, the user may not have
permission to set the system keymap.
@ -82,7 +82,7 @@ index fa41230f..da384495 100644
From 1478cce3663bfa276066c073be3bbb65bc4b1785 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Fri, 8 Sep 2023 11:02:39 -0400
Subject: [PATCH 03/17] language: Don't proceed until localed has set locale
Subject: [PATCH 03/16] language: Don't proceed until localed has set locale
In sysmte modes, the keyboard page requires reading the locale from
localed, so we need to make sure the setting has been applied before
@ -171,7 +171,7 @@ index 87b9f2d8..26a01257 100644
From e8d5b6a4c1ee9bfb3f8ed7dbe5f25053fae7a1ae Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Thu, 24 Aug 2023 21:19:40 -0400
Subject: [PATCH 04/17] keyboard: Get default input sources from gnome-desktop
Subject: [PATCH 04/16] keyboard: Get default input sources from gnome-desktop
Right now, we figure out the default input sources ourselves,
based on the current locale and layout information coming from
@ -785,7 +785,7 @@ index da384495..f2bfe164 100644
From 7b83c89d8b2fe2f9de5f7f364a7af5f2f4fcc605 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Sun, 13 Aug 2023 09:09:56 -0400
Subject: [PATCH 05/17] driver: Specify mode via flags instead of boolean
Subject: [PATCH 05/16] driver: Specify mode via flags instead of boolean
At the moment we just have system mode and new user mode,
but we're actually going to want other modes (such as
@ -1075,7 +1075,7 @@ index adb04075..a079c705 100644
From 68391446ee06083a06899cdadb09ca90b4b40af3 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Wed, 30 Aug 2023 15:08:23 -0400
Subject: [PATCH 06/17] assistant: Show Back button on summary page
Subject: [PATCH 06/16] assistant: Show Back button on summary page
commit f60b4622350468f7ef17f79d9bc6679bf8cce7b9 changed the
assistant to no longer show the back and forward buttons on the
@ -1194,7 +1194,7 @@ index 0aee2dad..8a526b64 100644
From f1e4b58ced27b028e13dd9bb29794419dc08fb72 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Sun, 13 Aug 2023 09:39:07 -0400
Subject: [PATCH 07/17] gnome-initial-setup: Add live user mode
Subject: [PATCH 07/16] gnome-initial-setup: Add live user mode
This commit adds a new "live user" mode meant to be run in live image
environments.
@ -2201,7 +2201,7 @@ index 6c12ca38..3d648c48 100644
From 3f15601af333aeddb8e4458e69f81023a8184a8f Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Wed, 16 Aug 2023 10:47:13 -0400
Subject: [PATCH 08/17] initial-setup: Don't show duplicated pages between
Subject: [PATCH 08/16] initial-setup: Don't show duplicated pages between
modes
It's possible a user just got asked questions in live mode
@ -2390,7 +2390,7 @@ index 00e24d7b..95fe8e51 100644
From 935b2cca6dd7e3ce31e2540d90e5864190885d81 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Sun, 13 Aug 2023 16:33:49 -0400
Subject: [PATCH 09/17] polkit: Add fedora specfic rules
Subject: [PATCH 09/16] polkit: Add fedora specfic rules
We should probably add some way to check vendor.conf for the policy
updates instead of a hardcoded list.
@ -2419,7 +2419,7 @@ index 881efde9..f5b7d981 100644
From 03073bd42bf01f5d051f299860be40afd1844447 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Tue, 22 Aug 2023 13:51:40 -0400
Subject: [PATCH 10/17] gnome-initial-setup: Read /etc/sysconfig/anaconda
Subject: [PATCH 10/16] gnome-initial-setup: Read /etc/sysconfig/anaconda
Just as /var/lib/gnome-initial-setup/state may show pages the user has
already answered, on Fedora, /etc/sysconfig/anaconda shows pages the user has
@ -2475,53 +2475,10 @@ index 4e2aa5af..2de3ecab 100644
2.43.0
From 5ffced5f0b7d96458cde5264b79e08a89e22ffb2 Mon Sep 17 00:00:00 2001
From: Jeremy Bicha <jeremy.bicha@canonical.com>
Date: Wed, 17 Jan 2024 13:07:26 -0500
Subject: [PATCH 11/17] driver: Allow closing the window in existing user mode
Existing user mode was disabled in 43f1870c
but some distros like Debian have reverted that change.
With existing user mode, Initial Setup is just another app.
Since the questions are not mandatory, it is reasonable
to not go out of our way to prevent users from exiting early.
This partially reverts 1db957a7
---
gnome-initial-setup/gis-driver.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/gnome-initial-setup/gis-driver.c b/gnome-initial-setup/gis-driver.c
index 0b3f542f..29c6c0a1 100644
--- a/gnome-initial-setup/gis-driver.c
+++ b/gnome-initial-setup/gis-driver.c
@@ -802,10 +802,13 @@ gis_driver_startup (GApplication *app)
G_CALLBACK (window_realize_cb),
(gpointer)app);
- g_signal_connect (driver->main_window,
- "close-request",
- G_CALLBACK (window_close_request_cb),
- NULL);
+ /* Only allow closing the window in existing user mode*/
+ if (driver->mode != GIS_DRIVER_MODE_EXISTING_USER) {
+ g_signal_connect (driver->main_window,
+ "close-request",
+ G_CALLBACK (window_close_request_cb),
+ NULL);
+ }
driver->assistant = g_object_new (GIS_TYPE_ASSISTANT, NULL);
gtk_window_set_child (GTK_WINDOW (driver->main_window),
--
2.43.0
From baaa29d56bbb91f3ad15f90e3db98eea446b9adb Mon Sep 17 00:00:00 2001
From: Michael Catanzaro <mcatanzaro@redhat.com>
Date: Wed, 17 Jan 2024 12:29:54 -0600
Subject: [PATCH 12/17] Fix criticals in set_localed_input()
Subject: [PATCH 11/16] Fix criticals in set_localed_input()
If the default input sources do not match the current input sources,
these won't be set in set_input_settings() and we shouldn't try to use
@ -2555,64 +2512,10 @@ index 7801667c..3b59a0bf 100644
2.43.0
From 52c588a3c9990ca1e08beff55acbfc93796104f2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jeremy=20B=C3=ADcha?= <jeremy.bicha@canonical.com>
Date: Wed, 17 Jan 2024 14:16:53 -0500
Subject: [PATCH 13/17] welcome: Use PRETTY_NAME instead of manually combining
NAME and VERSION_ID
---
.../pages/welcome/gis-welcome-page.c | 20 ++++---------------
1 file changed, 4 insertions(+), 16 deletions(-)
diff --git a/gnome-initial-setup/pages/welcome/gis-welcome-page.c b/gnome-initial-setup/pages/welcome/gis-welcome-page.c
index 1594e164..f7cfc783 100644
--- a/gnome-initial-setup/pages/welcome/gis-welcome-page.c
+++ b/gnome-initial-setup/pages/welcome/gis-welcome-page.c
@@ -46,23 +46,11 @@ static void
update_welcome_title (GisWelcomePage *page)
{
GisWelcomePagePrivate *priv = gis_welcome_page_get_instance_private (page);
- g_autofree char *name = g_get_os_info (G_OS_INFO_KEY_NAME);
- g_autofree char *entity = NULL;
+ g_autofree char *name = g_get_os_info (G_OS_INFO_KEY_PRETTY_NAME);
g_autofree char *text = NULL;
- if (name != NULL)
- {
- g_autofree char *version = g_get_os_info (G_OS_INFO_KEY_VERSION_ID);
-
- if (version)
- entity = g_strdup_printf ("%s %s", name, version);
- else
- entity = g_strdup (name);
- }
- else
- {
- entity = g_strdup ("GNOME");
- }
+ if (!name)
+ name = g_strdup ("GNOME");
/* Translators: This is meant to be a warm, engaging welcome message,
* like greeting somebody at the door. If the exclamation mark is not
@@ -72,7 +60,7 @@ update_welcome_title (GisWelcomePage *page)
* keep or remove. The %s is getting replaced with the name and version
* of the OS, e.g. "GNOME 3.38"
*/
- text = g_strdup_printf (_("Welcome to %s!"), entity);
+ text = g_strdup_printf (_("Welcome to %s!"), name);
gtk_label_set_label (GTK_LABEL (priv->title), text);
}
--
2.43.0
From b46a3d7e6df08030680c2e7aaa6408c28315e75f Mon Sep 17 00:00:00 2001
From: Michael Catanzaro <mcatanzaro@redhat.com>
Date: Fri, 19 Jan 2024 15:49:15 -0600
Subject: [PATCH 14/17] assistant: assert next page exists when switching to
Subject: [PATCH 12/16] assistant: assert next page exists when switching to
next page
If there is no next page, then we should crash nicely on this assert
@ -2643,7 +2546,7 @@ index 8a7fc52b..c1af2943 100644
From deecf58106544ac8603575cb80e79ddfa1b822ba Mon Sep 17 00:00:00 2001
From: Michael Catanzaro <mcatanzaro@redhat.com>
Date: Fri, 19 Jan 2024 15:50:33 -0600
Subject: [PATCH 15/17] summary: don't crash if there is no user account to
Subject: [PATCH 13/16] summary: don't crash if there is no user account to
create
---
@ -2673,7 +2576,7 @@ index 8a526b64..8c005640 100644
From b3e54dbaa09e944e537050c7393cd69e44488384 Mon Sep 17 00:00:00 2001
From: Michael Catanzaro <mcatanzaro@redhat.com>
Date: Fri, 19 Jan 2024 15:52:03 -0600
Subject: [PATCH 16/17] Don't show warnings when failing to connect to gdm
Subject: [PATCH 14/16] Don't show warnings when failing to connect to gdm
This is an expected condition. We need to log it since it might be
needed when debugging, but a warning is overkill.
@ -2730,7 +2633,7 @@ index 8c005640..1352cb41 100644
From fa8caf710c38c41fc17f6dacc1c964a849e4c6e1 Mon Sep 17 00:00:00 2001
From: Michael Catanzaro <mcatanzaro@redhat.com>
Date: Fri, 19 Jan 2024 15:58:09 -0600
Subject: [PATCH 17/17] Never skip the summary page if available
Subject: [PATCH 15/16] Never skip the summary page if available
This avoids a crash when finishing the welcome page if there are no
other pages available.
@ -2762,3 +2665,206 @@ index 2de3ecab..54bca86f 100644
--
2.43.0
From b4e51c75dce43fb8095909278122c96a32b7a62d Mon Sep 17 00:00:00 2001
From: Michael Catanzaro <mcatanzaro@redhat.com>
Date: Mon, 22 Jan 2024 14:07:15 -0600
Subject: [PATCH 16/16] Fix failure to log into user account
Currently gis_driver_get_user_permissions() is guaranteed to fail
because we call it after gis_driver_save_data(), which creates the user
account. We need to call it later at the right point.
Also, let's own the user_password that we store on the summary and
install page. Even if it's not expected to change, it doesn't seem very
safe to rely on the GisDriver not deleting it.
---
.../pages/install/gis-install-page.c | 41 ++++++++++++++----
.../pages/summary/gis-summary-page.c | 42 ++++++++++++-------
2 files changed, 59 insertions(+), 24 deletions(-)
diff --git a/gnome-initial-setup/pages/install/gis-install-page.c b/gnome-initial-setup/pages/install/gis-install-page.c
index 850c8241..be4d6968 100644
--- a/gnome-initial-setup/pages/install/gis-install-page.c
+++ b/gnome-initial-setup/pages/install/gis-install-page.c
@@ -43,9 +43,7 @@ struct _GisInstallPagePrivate {
GtkWidget *install_button;
AdwStatusPage *status_page;
GDesktopAppInfo *installer;
-
- ActUser *user_account;
- const gchar *user_password;
+ char *user_password;
};
typedef struct _GisInstallPagePrivate GisInstallPagePrivate;
@@ -128,6 +126,24 @@ log_user_in (GisInstallPage *page)
g_autoptr(GError) error = NULL;
GdmGreeter *greeter = NULL;
GdmUserVerifier *user_verifier = NULL;
+ ActUser *user_account = NULL;
+ const char *user_password = NULL;
+
+ gis_driver_get_user_permissions (GIS_PAGE (page)->driver,
+ &user_account,
+ &user_password);
+ if (user_account == NULL) {
+ g_info ("No new user account (was the account page skipped?); not initiating login");
+ return;
+ }
+ g_assert (priv->user_password == NULL);
+ priv->user_password = g_strdup (user_password);
+
+ if (!gis_driver_get_gdm_objects (GIS_PAGE (page)->driver,
+ &greeter, &user_verifier)) {
+ g_info ("No GDM connection; not initiating login");
+ return;
+ }
if (!gis_driver_get_gdm_objects (GIS_PAGE (page)->driver,
&greeter, &user_verifier)) {
@@ -149,7 +165,7 @@ log_user_in (GisInstallPage *page)
gdm_user_verifier_call_begin_verification_for_user_sync (user_verifier,
SERVICE_NAME,
- act_user_get_user_name (priv->user_account),
+ act_user_get_user_name (user_account),
NULL, &error);
if (error != NULL)
@@ -259,11 +275,6 @@ gis_install_page_shown (GisPage *page)
{
GisInstallPage *install = GIS_INSTALL_PAGE (page);
GisInstallPagePrivate *priv = gis_install_page_get_instance_private (install);
- g_autoptr(GError) local_error = NULL;
-
- gis_driver_get_user_permissions (GIS_PAGE (page)->driver,
- &priv->user_account,
- &priv->user_password);
gtk_widget_grab_focus (priv->install_button);
}
@@ -341,6 +352,17 @@ gis_install_page_constructed (GObject *object)
gtk_widget_set_visible (GTK_WIDGET (page), TRUE);
}
+static void
+gis_install_page_finalize (GObject *object)
+{
+ GisInstallPage *page = GIS_INSTALL_PAGE (object);
+ GisInstallPagePrivate *priv = gis_install_page_get_instance_private (page);
+
+ g_clear_pointer (&priv->user_password, g_free);
+
+ G_OBJECT_CLASS (gis_install_page_parent_class)->finalize (object);
+}
+
static void
gis_install_page_locale_changed (GisPage *page)
{
@@ -365,6 +387,7 @@ gis_install_page_class_init (GisInstallPageClass *klass)
page_class->locale_changed = gis_install_page_locale_changed;
page_class->shown = gis_install_page_shown;
object_class->constructed = gis_install_page_constructed;
+ object_class->finalize = gis_install_page_finalize;
}
static void
diff --git a/gnome-initial-setup/pages/summary/gis-summary-page.c b/gnome-initial-setup/pages/summary/gis-summary-page.c
index 1352cb41..1fc14556 100644
--- a/gnome-initial-setup/pages/summary/gis-summary-page.c
+++ b/gnome-initial-setup/pages/summary/gis-summary-page.c
@@ -40,9 +40,7 @@
struct _GisSummaryPagePrivate {
GtkWidget *start_button;
AdwStatusPage *status_page;
-
- ActUser *user_account;
- const gchar *user_password;
+ char *user_password;
};
typedef struct _GisSummaryPagePrivate GisSummaryPagePrivate;
@@ -144,15 +142,22 @@ log_user_in (GisSummaryPage *page)
g_autoptr(GError) error = NULL;
GdmGreeter *greeter = NULL;
GdmUserVerifier *user_verifier = NULL;
+ ActUser *user_account = NULL;
+ const char *user_password = NULL;
- if (!gis_driver_get_gdm_objects (GIS_PAGE (page)->driver,
- &greeter, &user_verifier)) {
- g_info ("No GDM connection; not initiating login");
+ gis_driver_get_user_permissions (GIS_PAGE (page)->driver,
+ &user_account,
+ &user_password);
+ if (user_account == NULL) {
+ g_info ("No new user account (was the account page skipped?); not initiating login");
return;
}
+ g_assert (priv->user_password == NULL);
+ priv->user_password = g_strdup (user_password);
- if (!priv->user_account) {
- g_info ("No new user account (was the account page skipped?); not initiating login");
+ if (!gis_driver_get_gdm_objects (GIS_PAGE (page)->driver,
+ &greeter, &user_verifier)) {
+ g_info ("No GDM connection; not initiating login");
return;
}
@@ -171,11 +176,11 @@ log_user_in (GisSummaryPage *page)
/* We are in NEW_USER mode and we want to make it possible for third
* parties to find out which user ID we created.
*/
- add_uid_file (act_user_get_uid (priv->user_account));
+ add_uid_file (act_user_get_uid (user_account));
gdm_user_verifier_call_begin_verification_for_user_sync (user_verifier,
SERVICE_NAME,
- act_user_get_user_name (priv->user_account),
+ act_user_get_user_name (user_account),
NULL, &error);
if (error != NULL)
@@ -214,11 +219,6 @@ gis_summary_page_shown (GisPage *page)
{
GisSummaryPage *summary = GIS_SUMMARY_PAGE (page);
GisSummaryPagePrivate *priv = gis_summary_page_get_instance_private (summary);
- g_autoptr(GError) local_error = NULL;
-
- gis_driver_get_user_permissions (GIS_PAGE (page)->driver,
- &priv->user_account,
- &priv->user_password);
gtk_widget_grab_focus (priv->start_button);
}
@@ -264,6 +264,17 @@ gis_summary_page_constructed (GObject *object)
gtk_widget_set_visible (GTK_WIDGET (page), TRUE);
}
+static void
+gis_summary_page_finalize (GObject *object)
+{
+ GisSummaryPage *page = GIS_SUMMARY_PAGE (object);
+ GisSummaryPagePrivate *priv = gis_summary_page_get_instance_private (page);
+
+ g_clear_pointer (&priv->user_password, g_free);
+
+ G_OBJECT_CLASS (gis_summary_page_parent_class)->finalize (object);
+}
+
static void
gis_summary_page_locale_changed (GisPage *page)
{
@@ -286,6 +297,7 @@ gis_summary_page_class_init (GisSummaryPageClass *klass)
page_class->locale_changed = gis_summary_page_locale_changed;
page_class->shown = gis_summary_page_shown;
object_class->constructed = gis_summary_page_constructed;
+ object_class->finalize = gis_summary_page_finalize;
}
static void
--
2.43.0