diff --git a/0001-keyboard-stop-setting-current-input-source.patch b/0001-keyboard-stop-setting-current-input-source.patch new file mode 100644 index 0000000..1d5bb14 --- /dev/null +++ b/0001-keyboard-stop-setting-current-input-source.patch @@ -0,0 +1,82 @@ +From 7dcd4e1b699a84d14de3c2686d0c6fbea64b2914 Mon Sep 17 00:00:00 2001 +From: Michael Catanzaro +Date: Tue, 22 Aug 2023 12:58:50 -0500 +Subject: [PATCH 01/11] keyboard: stop setting 'current' input source + +This setting is deprecated and ignored since 3.22. We don't need to set +it anymore because nothing uses it. See: + +https://bugzilla.gnome.org/show_bug.cgi?id=766847 +--- + gnome-initial-setup/pages/keyboard/gis-keyboard-page.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c b/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c +index fa41230f..693bb117 100644 +--- a/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c ++++ b/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c +@@ -84,61 +84,60 @@ set_input_settings (GisKeyboardPage *self) + GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self); + const gchar *type; + const gchar *id; + GVariantBuilder builder; + GSList *l; + gboolean is_xkb_source = FALSE; + + type = cc_input_chooser_get_input_type (CC_INPUT_CHOOSER (priv->input_chooser)); + id = cc_input_chooser_get_input_id (CC_INPUT_CHOOSER (priv->input_chooser)); + + g_variant_builder_init (&builder, G_VARIANT_TYPE ("a(ss)")); + + if (g_str_equal (type, "xkb")) { + g_variant_builder_add (&builder, "(ss)", type, id); + is_xkb_source = TRUE; + } + + for (l = priv->system_sources; l; l = l->next) { + const gchar *sid = l->data; + + if (g_str_equal (id, sid) && g_str_equal (type, "xkb")) + continue; + + g_variant_builder_add (&builder, "(ss)", "xkb", sid); + } + + if (!is_xkb_source) + g_variant_builder_add (&builder, "(ss)", type, id); + + g_settings_set_value (priv->input_settings, KEY_INPUT_SOURCES, g_variant_builder_end (&builder)); +- g_settings_set_uint (priv->input_settings, KEY_CURRENT_INPUT_SOURCE, 0); + + g_settings_apply (priv->input_settings); + } + + static void + set_localed_input (GisKeyboardPage *self) + { + GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self); + const gchar *layout, *variant; + GString *layouts; + GString *variants; + GSList *l; + + if (!priv->localed) + return; + + cc_input_chooser_get_layout (CC_INPUT_CHOOSER (priv->input_chooser), &layout, &variant); + if (layout == NULL) + layout = ""; + if (variant == NULL) + variant = ""; + + layouts = g_string_new (layout); + variants = g_string_new (variant); + + #define LAYOUT(a) (a[0]) + #define VARIANT(a) (a[1] ? a[1] : "") + for (l = priv->system_sources; l; l = l->next) { + const gchar *sid = l->data; + gchar **lv = g_strsplit (sid, "+", -1); +-- +2.41.0.rc2 + diff --git a/0002-keyboard-write-to-mru-sources-setting-if-it-has-neve.patch b/0002-keyboard-write-to-mru-sources-setting-if-it-has-neve.patch new file mode 100644 index 0000000..5bfa0d2 --- /dev/null +++ b/0002-keyboard-write-to-mru-sources-setting-if-it-has-neve.patch @@ -0,0 +1,160 @@ +From 6dbb638f3bda4d345e280f64c9739fd4026ef78f Mon Sep 17 00:00:00 2001 +From: Michael Catanzaro +Date: Thu, 24 Aug 2023 13:03:07 -0500 +Subject: [PATCH 02/11] keyboard: write to mru-sources setting if it has never + been set before + +This is a port of: + +https://gitlab.gnome.org/GNOME/gnome-control-center/-/merge_requests/1893 + +In theory, this shouldn't matter during a firstboot scenario as +mru-sources should not be touched yet, but gnome-initial-setup may be +run in a different ways and it seems useful to be robust here. +--- + .../pages/keyboard/gis-keyboard-page.c | 13 +++++++++++-- + 1 file changed, 11 insertions(+), 2 deletions(-) + +diff --git a/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c b/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c +index 693bb117..ad48d933 100644 +--- a/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c ++++ b/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c +@@ -17,60 +17,61 @@ + * Author: Sergey Udaltsov + * Michael Wood + * + * Based on gnome-control-center cc-region-panel.c + */ + + #define PAGE_ID "keyboard" + + #include "config.h" + + #include + #include + #include + #include + #include + + #define GNOME_DESKTOP_USE_UNSTABLE_API + #include + + #include "gis-keyboard-page.h" + #include "keyboard-resources.h" + #include "cc-input-chooser.h" + + #include "cc-common-language.h" + + #include "gis-page-header.h" + + #define GNOME_DESKTOP_INPUT_SOURCES_DIR "org.gnome.desktop.input-sources" + #define KEY_CURRENT_INPUT_SOURCE "current" + #define KEY_INPUT_SOURCES "sources" ++#define KEY_MRU_SOURCES "mru-sources" + + struct _GisKeyboardPagePrivate { + GtkWidget *input_chooser; + + GDBusProxy *localed; + GCancellable *cancellable; + GPermission *permission; + GSettings *input_settings; + + GSList *system_sources; + }; + typedef struct _GisKeyboardPagePrivate GisKeyboardPagePrivate; + + G_DEFINE_TYPE_WITH_PRIVATE (GisKeyboardPage, gis_keyboard_page, GIS_TYPE_PAGE); + + static void + gis_keyboard_page_finalize (GObject *object) + { + GisKeyboardPage *self = GIS_KEYBOARD_PAGE (object); + GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self); + + if (priv->cancellable) + g_cancellable_cancel (priv->cancellable); + g_clear_object (&priv->cancellable); + + g_clear_object (&priv->permission); + g_clear_object (&priv->localed); + g_clear_object (&priv->input_settings); + + g_slist_free_full (priv->system_sources, g_free); +@@ -83,63 +84,71 @@ set_input_settings (GisKeyboardPage *self) + { + GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self); + const gchar *type; + const gchar *id; + GVariantBuilder builder; + GSList *l; + gboolean is_xkb_source = FALSE; + + type = cc_input_chooser_get_input_type (CC_INPUT_CHOOSER (priv->input_chooser)); + id = cc_input_chooser_get_input_id (CC_INPUT_CHOOSER (priv->input_chooser)); + + g_variant_builder_init (&builder, G_VARIANT_TYPE ("a(ss)")); + + if (g_str_equal (type, "xkb")) { + g_variant_builder_add (&builder, "(ss)", type, id); + is_xkb_source = TRUE; + } + + for (l = priv->system_sources; l; l = l->next) { + const gchar *sid = l->data; + + if (g_str_equal (id, sid) && g_str_equal (type, "xkb")) + continue; + + g_variant_builder_add (&builder, "(ss)", "xkb", sid); + } + + if (!is_xkb_source) + g_variant_builder_add (&builder, "(ss)", type, id); + +- g_settings_set_value (priv->input_settings, KEY_INPUT_SOURCES, g_variant_builder_end (&builder)); ++ if (type != NULL && id != NULL) { ++ GVariantBuilder mru_input_source_builder; + +- g_settings_apply (priv->input_settings); ++ g_variant_builder_init (&mru_input_source_builder, G_VARIANT_TYPE ("a(ss)")); ++ g_variant_builder_add (&mru_input_source_builder, "(ss)", type, id); ++ g_settings_set_value (priv->input_settings, KEY_MRU_SOURCES, g_variant_builder_end (&mru_input_source_builder)); ++ } ++ ++ g_settings_set_value (priv->input_settings, KEY_INPUT_SOURCES, g_variant_builder_end (&builder)); ++ ++ g_settings_apply (priv->input_settings); + } + + static void + set_localed_input (GisKeyboardPage *self) + { + GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self); + const gchar *layout, *variant; + GString *layouts; + GString *variants; + GSList *l; + + if (!priv->localed) + return; + + cc_input_chooser_get_layout (CC_INPUT_CHOOSER (priv->input_chooser), &layout, &variant); + if (layout == NULL) + layout = ""; + if (variant == NULL) + variant = ""; + + layouts = g_string_new (layout); + variants = g_string_new (variant); + + #define LAYOUT(a) (a[0]) + #define VARIANT(a) (a[1] ? a[1] : "") + for (l = priv->system_sources; l; l = l->next) { + const gchar *sid = l->data; + gchar **lv = g_strsplit (sid, "+", -1); + + if (!g_str_equal (LAYOUT (lv), layout) || +-- +2.41.0.rc2 + diff --git a/0001-keyboard-Get-default-input-sources-from-gnome-deskto.patch b/0003-keyboard-Get-default-input-sources-from-gnome-deskto.patch similarity index 94% rename from 0001-keyboard-Get-default-input-sources-from-gnome-deskto.patch rename to 0003-keyboard-Get-default-input-sources-from-gnome-deskto.patch index fcaa4cb..8d97fc4 100644 --- a/0001-keyboard-Get-default-input-sources-from-gnome-deskto.patch +++ b/0003-keyboard-Get-default-input-sources-from-gnome-deskto.patch @@ -1,7 +1,7 @@ -From 810635287685db53ab320be75c992265370ff215 Mon Sep 17 00:00:00 2001 +From 58e95126c4256d339a282cc94c23508fd2258a4f Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Thu, 24 Aug 2023 21:19:40 -0400 -Subject: [PATCH 01/10] keyboard: Get default input sources from gnome-desktop +Subject: [PATCH 03/11] 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 @@ -16,15 +16,14 @@ The same time if leverages a gnome-desktop API to fix a bug where cyrillic layouts were getting added without a latin counterpart. --- - .../pages/keyboard/gis-keyboard-page.c | 313 ++++++------------ - 1 file changed, 105 insertions(+), 208 deletions(-) + .../pages/keyboard/gis-keyboard-page.c | 311 ++++++------------ + 1 file changed, 106 insertions(+), 205 deletions(-) diff --git a/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c b/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c -index fa41230f..61556b99 100644 +index ad48d933..76d0b32a 100644 --- a/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c +++ b/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c -@@ -17,503 +17,400 @@ - * Author: Sergey Udaltsov +@@ -18,510 +18,411 @@ * Michael Wood * * Based on gnome-control-center cc-region-panel.c @@ -54,6 +53,7 @@ index fa41230f..61556b99 100644 #define GNOME_DESKTOP_INPUT_SOURCES_DIR "org.gnome.desktop.input-sources" #define KEY_CURRENT_INPUT_SOURCE "current" #define KEY_INPUT_SOURCES "sources" + #define KEY_MRU_SOURCES "mru-sources" +#define KEY_INPUT_OPTIONS "xkb-options" struct _GisKeyboardPagePrivate { @@ -114,27 +114,28 @@ index fa41230f..61556b99 100644 + gboolean has_latin_layout = FALSE; gboolean is_xkb_source = FALSE; -- type = cc_input_chooser_get_input_type (CC_INPUT_CHOOSER (priv->input_chooser)); -- id = cc_input_chooser_get_input_id (CC_INPUT_CHOOSER (priv->input_chooser)); + type = cc_input_chooser_get_input_type (CC_INPUT_CHOOSER (priv->input_chooser)); + id = cc_input_chooser_get_input_id (CC_INPUT_CHOOSER (priv->input_chooser)); + +- g_variant_builder_init (&builder, G_VARIANT_TYPE ("a(ss)")); + g_variant_builder_init (&input_source_builder, G_VARIANT_TYPE ("a(ss)")); + g_variant_builder_init (&input_options_builder, G_VARIANT_TYPE ("as")); -- g_variant_builder_init (&builder, G_VARIANT_TYPE ("a(ss)")); +- if (g_str_equal (type, "xkb")) { +- g_variant_builder_add (&builder, "(ss)", type, id); +- is_xkb_source = TRUE; +- } + if (type != NULL && id != NULL) { + has_latin_layout = !gnome_input_source_is_non_latin (type, id); + if (g_str_equal (type, "xkb")) { + g_variant_builder_add (&input_source_builder, "(ss)", type, id); -- if (g_str_equal (type, "xkb")) { -- g_variant_builder_add (&builder, "(ss)", type, id); -- is_xkb_source = TRUE; -+ is_xkb_source = TRUE; -+ } - } - - for (l = priv->system_sources; l; l = l->next) { - const gchar *sid = l->data; -- ++ is_xkb_source = TRUE; ++ } ++ } + - if (g_str_equal (id, sid) && g_str_equal (type, "xkb")) + for (i = 0; priv->default_input_source_ids && priv->default_input_source_ids[i] != NULL; i++) { + if (g_str_equal (id, priv->default_input_source_ids[i]) && g_str_equal (type, priv->default_input_source_types[i])) @@ -145,31 +146,37 @@ index fa41230f..61556b99 100644 + + if (!gnome_input_source_is_non_latin (priv->default_input_source_types[i], priv->default_input_source_ids[i])) + has_latin_layout = TRUE; - } - -- if (!is_xkb_source) -- g_variant_builder_add (&builder, "(ss)", type, id); ++ } ++ + if (type != NULL && id != NULL) { + if (!is_xkb_source) { + g_variant_builder_add (&input_source_builder, "(ss)", type, id); + } + } - -- g_settings_set_value (priv->input_settings, KEY_INPUT_SOURCES, g_variant_builder_end (&builder)); -- g_settings_set_uint (priv->input_settings, KEY_CURRENT_INPUT_SOURCE, 0); ++ + if (!has_latin_layout) { + g_variant_builder_add (&input_source_builder, "(ss)", "xkb", "us"); -+ } + } -- g_settings_apply (priv->input_settings); +- if (!is_xkb_source) +- g_variant_builder_add (&builder, "(ss)", type, id); + for (i = 0; priv->default_input_options[i] != NULL; i++) { + g_variant_builder_add (&input_options_builder, "s", priv->default_input_options[i]); + } -+ + + if (type != NULL && id != NULL) { + GVariantBuilder mru_input_source_builder; + + g_variant_builder_init (&mru_input_source_builder, G_VARIANT_TYPE ("a(ss)")); + g_variant_builder_add (&mru_input_source_builder, "(ss)", type, id); + g_settings_set_value (priv->input_settings, KEY_MRU_SOURCES, g_variant_builder_end (&mru_input_source_builder)); + } + +- g_settings_set_value (priv->input_settings, KEY_INPUT_SOURCES, g_variant_builder_end (&builder)); +- + g_settings_set_value (priv->input_settings, KEY_INPUT_SOURCES, g_variant_builder_end (&input_source_builder)); + g_settings_set_value (priv->input_settings, KEY_INPUT_OPTIONS, g_variant_builder_end (&input_options_builder)); -+ g_settings_set_uint (priv->input_settings, KEY_CURRENT_INPUT_SOURCE, 0); -+ g_settings_apply (priv->input_settings); + g_settings_apply (priv->input_settings); } static void @@ -333,11 +340,10 @@ index fa41230f..61556b99 100644 - return sources; -} - - static void +-static void -add_default_keyboard_layout (GDBusProxy *proxy, - GVariantBuilder *builder) -+add_default_input_sources (GisKeyboardPage *self) - { +-{ - GSList *sources = get_localed_input (proxy); - sources = g_slist_reverse (sources); - @@ -379,11 +385,12 @@ index fa41230f..61556b99 100644 - g_object_unref (input_settings); -} - --static void + static void -skip_proxy_ready (GObject *source, - GAsyncResult *res, - gpointer data) --{ ++add_default_input_sources (GisKeyboardPage *self) + { - GisKeyboardPage *self = data; - GDBusProxy *proxy; - GError *error = NULL; @@ -547,13 +554,14 @@ index fa41230f..61556b99 100644 + GisKeyboardPage *self = data; + GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self); + g_autoptr (GError) error = NULL; ++ gboolean success = FALSE; + g_auto (GStrv) ids = NULL; + g_auto (GStrv) types = NULL; + g_auto (GStrv) options = NULL; + -+ ids = gnome_get_default_input_sources_finish (res, &types, &options, &error); ++ success = gnome_get_default_input_sources_finish (res, &ids, &types, &options, &error); + -+ if (!ids) { ++ if (!success) { + if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) + g_warning ("Failed to fetch default input sources: %s", error->message); + return; diff --git a/0004-gnome-initial-setup-Add-OEM-mode.patch b/0004-gnome-initial-setup-Add-OEM-mode.patch deleted file mode 100644 index a0ce494..0000000 --- a/0004-gnome-initial-setup-Add-OEM-mode.patch +++ /dev/null @@ -1,350 +0,0 @@ -From 17d62c9450b38fa492c245ec3da8ebd5f9a001dc Mon Sep 17 00:00:00 2001 -From: Ray Strode -Date: Sun, 13 Aug 2023 10:30:11 -0400 -Subject: [PATCH 4/5] gnome-initial-setup: Add OEM mode - -OEM mode is designed to get run when a site has imaged a bunch -of machines, and handed them off to the user. - -In this scenario, the user never saw the installer, so we need to -ask the user questions that the installer would have normally -asked them already. - -For example, the installer likely asks language, but if the user -never saw the installer, then we need to ask language again. ---- - gnome-initial-setup/gis-driver.c | 1 + - gnome-initial-setup/gis-driver.h | 5 +++-- - gnome-initial-setup/gnome-initial-setup.c | 22 ++++++++++++++-------- - 3 files changed, 18 insertions(+), 10 deletions(-) - -diff --git a/gnome-initial-setup/gis-driver.c b/gnome-initial-setup/gis-driver.c -index 75ceac76..d7a69fe1 100644 ---- a/gnome-initial-setup/gis-driver.c -+++ b/gnome-initial-setup/gis-driver.c -@@ -20,60 +20,61 @@ - */ - - #include "config.h" - - #include "gnome-initial-setup.h" - - #include - #include - #include - - #ifdef HAVE_WEBKITGTK_6_0 - #include - #else - #include - #endif - - #include "cc-common-language.h" - #include "gis-assistant.h" - - /* Statically include this for now. Maybe later - * we'll generate this from glib-mkenums. */ - GType - gis_driver_mode_get_type (void) { - static GType enum_type_id = 0; - if (G_UNLIKELY (!enum_type_id)) - { - static const GFlagsValue values[] = { - { GIS_DRIVER_MODE_NEW_USER, "GIS_DRIVER_MODE_NEW_USER", "new_user" }, - { GIS_DRIVER_MODE_EXISTING_USER, "GIS_DRIVER_MODE_EXISTING_USER", "existing_user" }, - { GIS_DRIVER_MODE_LIVE_USER, "GIS_DRIVER_MODE_LIVE_USER", "live_user" }, -+ { GIS_DRIVER_MODE_OEM, "GIS_DRIVER_MODE_OEM", "oem" }, - { GIS_DRIVER_MODE_SYSTEM, "GIS_DRIVER_MODE_SYSTEM", "system" }, - { GIS_DRIVER_MODE_ALL, "GIS_DRIVER_MODE_ALL", "all" }, - { 0, NULL, NULL } - }; - enum_type_id = g_flags_register_static("GisDriverMode", values); - } - return enum_type_id; - } - - enum { - REBUILD_PAGES, - LOCALE_CHANGED, - LAST_SIGNAL, - }; - - static guint signals[LAST_SIGNAL]; - - typedef enum { - PROP_MODE = 1, - PROP_USERNAME, - PROP_SMALL_SCREEN, - PROP_PARENTAL_CONTROLS_ENABLED, - PROP_FULL_NAME, - PROP_AVATAR, - } GisDriverProperty; - - static GParamSpec *obj_props[PROP_AVATAR + 1]; - - struct _GisDriver { - AdwApplication parent_instance; -diff --git a/gnome-initial-setup/gis-driver.h b/gnome-initial-setup/gis-driver.h -index aedb9a73..49639bef 100644 ---- a/gnome-initial-setup/gis-driver.h -+++ b/gnome-initial-setup/gis-driver.h -@@ -18,62 +18,63 @@ - * Written by: - * Jasper St. Pierre - */ - - #ifndef __GIS_DRIVER_H__ - #define __GIS_DRIVER_H__ - - #include "gis-assistant.h" - #include "gis-page.h" - #include - #include - #include - - G_BEGIN_DECLS - - #define GIS_TYPE_DRIVER (gis_driver_get_type ()) - #define GIS_TYPE_DRIVER_MODE (gis_driver_mode_get_type ()) - - G_DECLARE_FINAL_TYPE (GisDriver, gis_driver, GIS, DRIVER, AdwApplication) - - typedef enum { - UM_LOCAL, - UM_ENTERPRISE, - NUM_MODES, - } UmAccountMode; - - typedef enum { - GIS_DRIVER_MODE_NEW_USER = 1 << 0, - GIS_DRIVER_MODE_EXISTING_USER = 1 << 1, - GIS_DRIVER_MODE_LIVE_USER = 1 << 2, -- GIS_DRIVER_MODE_SYSTEM = (GIS_DRIVER_MODE_NEW_USER | GIS_DRIVER_MODE_LIVE_USER), -- GIS_DRIVER_MODE_ALL = (GIS_DRIVER_MODE_NEW_USER | GIS_DRIVER_MODE_EXISTING_USER | GIS_DRIVER_MODE_LIVE_USER), -+ GIS_DRIVER_MODE_OEM = 1 << 3, -+ GIS_DRIVER_MODE_SYSTEM = (GIS_DRIVER_MODE_NEW_USER | GIS_DRIVER_MODE_LIVE_USER | GIS_DRIVER_MODE_OEM), -+ GIS_DRIVER_MODE_ALL = (GIS_DRIVER_MODE_NEW_USER | GIS_DRIVER_MODE_EXISTING_USER | GIS_DRIVER_MODE_LIVE_USER | GIS_DRIVER_MODE_OEM), - } GisDriverMode; - - GType gis_driver_mode_get_type (void); - - GisAssistant *gis_driver_get_assistant (GisDriver *driver); - - void gis_driver_set_user_permissions (GisDriver *driver, - ActUser *user, - const gchar *password); - - void gis_driver_get_user_permissions (GisDriver *driver, - ActUser **user, - const gchar **password); - - void gis_driver_set_parent_permissions (GisDriver *driver, - ActUser *parent, - const gchar *password); - - void gis_driver_get_parent_permissions (GisDriver *driver, - ActUser **parent, - const gchar **password); - - void gis_driver_set_account_mode (GisDriver *driver, - UmAccountMode mode); - - UmAccountMode gis_driver_get_account_mode (GisDriver *driver); - - void gis_driver_set_parental_controls_enabled (GisDriver *driver, - gboolean parental_controls_enabled); - -diff --git a/gnome-initial-setup/gnome-initial-setup.c b/gnome-initial-setup/gnome-initial-setup.c -index 68f00f47..3e4c2c03 100644 ---- a/gnome-initial-setup/gnome-initial-setup.c -+++ b/gnome-initial-setup/gnome-initial-setup.c -@@ -24,90 +24,91 @@ - #include "gnome-initial-setup.h" - - #include - #include - #include - #include - #include - - #include "pages/welcome/gis-welcome-page.h" - #include "pages/language/gis-language-page.h" - #include "pages/keyboard/gis-keyboard-page.h" - #include "pages/network/gis-network-page.h" - #include "pages/timezone/gis-timezone-page.h" - #include "pages/privacy/gis-privacy-page.h" - #include "pages/software/gis-software-page.h" - #include "pages/goa/gis-goa-page.h" - #include "pages/account/gis-account-pages.h" - #include "pages/parental-controls/gis-parental-controls-page.h" - #include "pages/password/gis-password-page.h" - #include "pages/summary/gis-summary-page.h" - #include "pages/install/gis-install-page.h" - - #define VENDOR_PAGES_GROUP "pages" - #define VENDOR_SKIP_KEY "skip" - #define VENDOR_NEW_USER_ONLY_KEY "new_user_only" - #define VENDOR_EXISTING_USER_ONLY_KEY "existing_user_only" - #define VENDOR_LIVE_USER_ONLY_KEY "live_user_only" - - static gboolean force_existing_user_mode; - static gboolean force_live_user_mode; -+static gboolean force_oem_mode; - - static GPtrArray *skipped_pages; - - typedef GisPage *(*PreparePage) (GisDriver *driver); - - typedef struct { - const gchar *page_id; - PreparePage prepare_page_func; - GisDriverMode modes; - } PageData; - - #define PAGE(name, modes) { #name, gis_prepare_ ## name ## _page, modes } - - static PageData page_table[] = { - PAGE (welcome, GIS_DRIVER_MODE_NEW_USER | GIS_DRIVER_MODE_EXISTING_USER), - PAGE (language, GIS_DRIVER_MODE_ALL), - PAGE (keyboard, GIS_DRIVER_MODE_ALL), - PAGE (network, GIS_DRIVER_MODE_ALL), -- PAGE (privacy, GIS_DRIVER_MODE_NEW_USER | GIS_DRIVER_MODE_EXISTING_USER), -+ PAGE (privacy, GIS_DRIVER_MODE_NEW_USER | GIS_DRIVER_MODE_EXISTING_USER | GIS_DRIVER_MODE_OEM), - PAGE (timezone, GIS_DRIVER_MODE_ALL), -- PAGE (software, GIS_DRIVER_MODE_NEW_USER | GIS_DRIVER_MODE_EXISTING_USER), -- PAGE (goa, GIS_DRIVER_MODE_NEW_USER | GIS_DRIVER_MODE_EXISTING_USER), -+ PAGE (software, GIS_DRIVER_MODE_NEW_USER | GIS_DRIVER_MODE_EXISTING_USER | GIS_DRIVER_MODE_OEM), -+ PAGE (goa, GIS_DRIVER_MODE_NEW_USER | GIS_DRIVER_MODE_EXISTING_USER | GIS_DRIVER_MODE_OEM), - /* In live user mode, the account page isn't displayed, it just quietly creates the live user */ -- PAGE (account, GIS_DRIVER_MODE_NEW_USER | GIS_DRIVER_MODE_LIVE_USER), -- PAGE (password, GIS_DRIVER_MODE_NEW_USER | GIS_DRIVER_MODE_LIVE_USER), -+ PAGE (account, GIS_DRIVER_MODE_NEW_USER | GIS_DRIVER_MODE_LIVE_USER | GIS_DRIVER_MODE_OEM), -+ PAGE (password, GIS_DRIVER_MODE_NEW_USER | GIS_DRIVER_MODE_LIVE_USER | GIS_DRIVER_MODE_OEM), - #ifdef HAVE_PARENTAL_CONTROLS -- PAGE (parental_controls, GIS_DRIVER_MODE_NEW_USER | GIS_DRIVER_MODE_EXISTING_USER), -- PAGE (parent_password, GIS_DRIVER_MODE_NEW_USER | GIS_DRIVER_MODE_EXISTING_USER), -+ PAGE (parental_controls, GIS_DRIVER_MODE_NEW_USER | GIS_DRIVER_MODE_EXISTING_USER | GIS_DRIVER_MODE_OEM), -+ PAGE (parent_password, GIS_DRIVER_MODE_NEW_USER | GIS_DRIVER_MODE_EXISTING_USER | GIS_DRIVER_MODE_OEM), - #endif -- PAGE (summary, GIS_DRIVER_MODE_NEW_USER), -+ PAGE (summary, GIS_DRIVER_MODE_NEW_USER | GIS_DRIVER_MODE_OEM), - PAGE (install, GIS_DRIVER_MODE_LIVE_USER), - { NULL }, - }; - - #undef PAGE - - static gboolean - should_skip_page (const gchar *page_id, - gchar **skip_pages) - { - guint i = 0; - - /* special case welcome. We only want to show it if language - * is skipped - */ - if (strcmp (page_id, "welcome") == 0) - return !should_skip_page ("language", skip_pages); - - /* check through our skip pages list for pages we don't want */ - if (skip_pages) { - while (skip_pages[i]) { - if (g_strcmp0 (skip_pages[i], page_id) == 0) - return TRUE; - i++; - } - } - - return FALSE; - } - -@@ -292,81 +293,86 @@ static gboolean - initial_setup_disabled_by_anaconda (void) - { - const gchar *file_name = SYSCONFDIR "/sysconfig/anaconda"; - g_autoptr(GError) error = NULL; - g_autoptr(GKeyFile) key_file = g_key_file_new (); - - if (!g_key_file_load_from_file (key_file, file_name, G_KEY_FILE_NONE, &error)) { - if (!g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_NOENT) && - !g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_NOT_FOUND)) { - g_warning ("Could not read %s: %s", file_name, error->message); - } - return FALSE; - } - - return g_key_file_get_boolean (key_file, "General", "post_install_tools_disabled", NULL); - } - - int - main (int argc, char *argv[]) - { - GisDriver *driver; - int status; - GOptionContext *context; - GisDriverMode mode; - - GOptionEntry entries[] = { - { "existing-user", 0, 0, G_OPTION_ARG_NONE, &force_existing_user_mode, - _("Force existing user mode"), NULL }, - { "live-user", 0, 0, G_OPTION_ARG_NONE, &force_live_user_mode, - _("Force live user mode"), NULL }, -+ { "oem", 0, 0, G_OPTION_ARG_NONE, &force_oem_mode, -+ _("Force OEM mode"), NULL }, - { NULL } - }; - - g_unsetenv ("GIO_USE_VFS"); - - /* By default, libadwaita reads settings from the Settings portal, which causes - * the portal to be started, which causes gnome-keyring to be started. This - * interferes with our attempt below to manually start gnome-keyring and set - * the login keyring password to a well-known value, which we overwrite with - * the user's password once they choose one. - */ - g_setenv ("ADW_DISABLE_PORTAL", "1", TRUE); - - context = g_option_context_new (_("— GNOME initial setup")); - g_option_context_add_main_entries (context, entries, NULL); - - g_option_context_parse (context, &argc, &argv, NULL); - - if (gis_kernel_command_line_has_argument ((const char *[]) { "rd.live.image", "endless.live_boot", NULL })) - force_live_user_mode = TRUE; - -+ if (gis_kernel_command_line_has_argument ((const char *[]) { "gnome.oem_mode", NULL })) -+ force_oem_mode = TRUE; -+ - bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR); - bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); - textdomain (GETTEXT_PACKAGE); - - g_message ("Starting gnome-initial-setup"); - if (gis_get_mock_mode ()) - g_message ("Mock mode: changes will not be saved to disk"); - else - g_message ("Production mode: changes will be saved to disk"); - - skipped_pages = g_ptr_array_new_with_free_func (destroy_page); - mode = get_mode (); - - /* When we are running as the gnome-initial-setup user we - * dont have a normal user session and need to initialize - * the keyring manually so that we can pass the credentials - * along to the new user in the handoff. - */ - if (mode == GIS_DRIVER_MODE_NEW_USER && !gis_get_mock_mode ()) - gis_ensure_login_keyring (); - - driver = gis_driver_new (mode); - adw_style_manager_set_color_scheme (adw_style_manager_get_default (), - ADW_COLOR_SCHEME_PREFER_LIGHT); - - /* On first login, GNOME Shell offers to run a tour. If we also run Initial - * Setup, the two immovable, centred windows will sit atop one another. - * Until we have the ability to run Initial Setup in the "kiosk" mode, like - * it does in new-user mode, disable Initial Setup for existing users. - * --- -2.41.0 - diff --git a/0002-gnome-initial-setup-Bump-GLib-required-version-to-2..patch b/0004-gnome-initial-setup-Bump-GLib-required-version-to-2..patch similarity index 97% rename from 0002-gnome-initial-setup-Bump-GLib-required-version-to-2..patch rename to 0004-gnome-initial-setup-Bump-GLib-required-version-to-2..patch index dd6e91e..a88dc3f 100644 --- a/0002-gnome-initial-setup-Bump-GLib-required-version-to-2..patch +++ b/0004-gnome-initial-setup-Bump-GLib-required-version-to-2..patch @@ -1,7 +1,7 @@ -From c8246d78f920af9bc2b2971616ca4e199301a2b6 Mon Sep 17 00:00:00 2001 +From e2aa68d67c1ec4a788a45b366f651b87e4c5ae95 Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Tue, 15 Aug 2023 10:53:41 -0400 -Subject: [PATCH 02/10] gnome-initial-setup: Bump GLib required version to 2.70 +Subject: [PATCH 04/11] gnome-initial-setup: Bump GLib required version to 2.70 This gives us GStrvBuilder --- diff --git a/0003-driver-Specify-mode-via-flags-instead-of-boolean.patch b/0005-driver-Specify-mode-via-flags-instead-of-boolean.patch similarity index 99% rename from 0003-driver-Specify-mode-via-flags-instead-of-boolean.patch rename to 0005-driver-Specify-mode-via-flags-instead-of-boolean.patch index 61d7155..c621eae 100644 --- a/0003-driver-Specify-mode-via-flags-instead-of-boolean.patch +++ b/0005-driver-Specify-mode-via-flags-instead-of-boolean.patch @@ -1,7 +1,7 @@ -From 658a673feac93493a74a83434abce93e39bff170 Mon Sep 17 00:00:00 2001 +From f5de1beabc325dc20090d02d85088dfb7f3a0584 Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Sun, 13 Aug 2023 09:09:56 -0400 -Subject: [PATCH 03/10] driver: Specify mode via flags instead of boolean +Subject: [PATCH 05/11] 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 diff --git a/0005-polkit-Add-fedora-specfic-rules.patch b/0005-polkit-Add-fedora-specfic-rules.patch deleted file mode 100644 index dc6bf89..0000000 --- a/0005-polkit-Add-fedora-specfic-rules.patch +++ /dev/null @@ -1,51 +0,0 @@ -From fef99a9707d53c3c8f82260994793623f61246aa Mon Sep 17 00:00:00 2001 -From: Ray Strode -Date: Sun, 13 Aug 2023 16:33:49 -0400 -Subject: [PATCH 5/5] polkit: Add fedora specfic rules - -We should probably add some way to check vendor.conf for the policy -updates instead of a hardcoded list. ---- - data/20-gnome-initial-setup.rules.in | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - -diff --git a/data/20-gnome-initial-setup.rules.in b/data/20-gnome-initial-setup.rules.in -index 881efde9..f5b7d981 100644 ---- a/data/20-gnome-initial-setup.rules.in -+++ b/data/20-gnome-initial-setup.rules.in -@@ -1,30 +1,31 @@ - // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*- - // - // DO NOT EDIT THIS FILE, it will be overwritten on update. - // - // Allow the gnome-initial-setup user to do certain actions without - // being interrupted by password dialogs - - polkit.addRule(function(action, subject) { - if (subject.user !== 'gnome-initial-setup') - return undefined; - - var actionMatches = (action.id.indexOf('org.freedesktop.hostname1.') === 0 || - action.id.indexOf('org.freedesktop.NetworkManager.') === 0 || - action.id.indexOf('org.freedesktop.locale1.') === 0 || - action.id.indexOf('org.freedesktop.accounts.') === 0 || - action.id.indexOf('org.freedesktop.timedate1.') === 0 || - action.id.indexOf('org.freedesktop.realmd.') === 0 || - action.id.indexOf('com.endlessm.ParentalControls.') === 0 || - action.id.indexOf('org.fedoraproject.thirdparty.') === 0 || -- action.id.indexOf('org.freedesktop.login1.reboot') === 0); -+ action.id.indexOf('org.freedesktop.login1.reboot') === 0 || -+ action.id.indexOf('org.fedoraproject.pkexec.liveinst') === 0); - - if (actionMatches) { - if (subject.local) - return 'yes'; - else - return 'auth_admin'; - } - - return undefined; - }); --- -2.41.0 - diff --git a/0005-summary-Write-uid-file-with-other-state-files.patch b/0005-summary-Write-uid-file-with-other-state-files.patch deleted file mode 100644 index d9805f4..0000000 --- a/0005-summary-Write-uid-file-with-other-state-files.patch +++ /dev/null @@ -1,241 +0,0 @@ -From 43db755e9027bde74626b9d2f15ee9013c8f7dc6 Mon Sep 17 00:00:00 2001 -From: Ray Strode -Date: Fri, 25 Aug 2023 21:30:42 -0400 -Subject: [PATCH 05/10] summary: Write uid file with other state files - -When creating a user account gnome-initial-setup writes a file -saying what the uid of the new user is, so that GDM can make -gnome-initial-setup's configuration available to the user. - -It does this from the summary page, but it would be better to do -it more centrally along with other state files so it can be used -for modes that don't have the summary page. - -This is important groundwork for a "live user" mode that will -get added in a future commit. ---- - gnome-initial-setup/gnome-initial-setup.c | 37 +++++++++++++++++++ - .../pages/summary/gis-summary-page.c | 24 ------------ - 2 files changed, 37 insertions(+), 24 deletions(-) - -diff --git a/gnome-initial-setup/gnome-initial-setup.c b/gnome-initial-setup/gnome-initial-setup.c -index 49e8e6ca..3635f293 100644 ---- a/gnome-initial-setup/gnome-initial-setup.c -+++ b/gnome-initial-setup/gnome-initial-setup.c -@@ -418,61 +418,98 @@ write_state (GisDriver *driver) - g_auto(GStrv) visited_pages = NULL; - GisAssistant *assistant; - GList *pages, *node; - - state = g_key_file_new (); - - builder = g_strv_builder_new (); - - assistant = gis_driver_get_assistant (driver); - pages = gis_assistant_get_all_pages (assistant); - for (node = pages; node != NULL; node = node->next) { - GisPage *page = node->data; - g_strv_builder_add (builder, GIS_PAGE_GET_CLASS (page)->page_id); - } - - visited_pages = g_strv_builder_end (builder); - - g_key_file_set_string_list (state, - VENDOR_PAGES_GROUP, - VENDOR_SKIP_KEY, - (const char * const *) - visited_pages, - g_strv_length (visited_pages)); - - if (!g_key_file_save_to_file (state, STATE_FILE, &error)) { - g_warning ("Unable to save state to %s: %s", STATE_FILE, error->message); - return; - } - } - -+static void -+add_uid_file (GisDriver *driver) -+{ -+ gchar *gis_uid_path; -+ gchar *uid_str; -+ uid_t uid; -+ g_autoptr(GError) error = NULL; -+ ActUser *user_account = NULL; -+ -+ gis_driver_get_user_permissions (driver, &user_account, NULL); -+ -+ if (user_account == NULL) -+ return; -+ -+ uid = act_user_get_uid (user_account); -+ -+ gis_uid_path = g_build_filename (g_get_home_dir (), -+ "gnome-initial-setup-uid", -+ NULL); -+ uid_str = g_strdup_printf ("%u", uid); -+ -+ if (!g_file_set_contents (gis_uid_path, uid_str, -1, &error)) -+ g_warning ("Unable to create %s: %s", gis_uid_path, error->message); -+ -+ g_free (uid_str); -+ g_free (gis_uid_path); -+} -+ - void - gis_ensure_stamp_files (GisDriver *driver) - { - g_autofree gchar *done_file = NULL; - g_autoptr(GError) error = NULL; -+ GisDriverMode driver_mode; - - done_file = g_build_filename (g_get_user_config_dir (), "gnome-initial-setup-done", NULL); - if (!g_file_set_contents (done_file, "yes", -1, &error)) { - g_warning ("Unable to create %s: %s", done_file, error->message); - g_clear_error (&error); - } - -+ driver_mode = gis_driver_get_mode (driver); -+ -+ /* If we're in a system mode write out which UID the created user is so GDM can make the -+ * gnome-initial-setup home directory readable to the created user. -+ */ -+ if (driver_mode & GIS_DRIVER_MODE_SYSTEM) -+ add_uid_file (driver); -+ - write_state (driver); - } - - /** - * gis_get_mock_mode: - * - * Gets whether gnome-initial-setup has been built for development, and hence - * shouldn’t permanently change any system configuration. - * - * By default, mock mode is enabled when running in a build environment. This - * heuristic may be changed in future. - * - * Returns: %TRUE if in mock mode, %FALSE otherwise - */ - gboolean - gis_get_mock_mode (void) - { - return (g_getenv ("UNDER_JHBUILD") != NULL); - } -diff --git a/gnome-initial-setup/pages/summary/gis-summary-page.c b/gnome-initial-setup/pages/summary/gis-summary-page.c -index 0aee2dad..b072f7fc 100644 ---- a/gnome-initial-setup/pages/summary/gis-summary-page.c -+++ b/gnome-initial-setup/pages/summary/gis-summary-page.c -@@ -91,110 +91,86 @@ static void - on_secret_info_query (GdmUserVerifier *user_verifier, - const char *service_name, - const char *question, - GisSummaryPage *page) - { - GisSummaryPagePrivate *priv = gis_summary_page_get_instance_private (page); - gboolean should_send_password = priv->user_password != NULL; - - g_debug ("PAM module secret info query: %s", question); - if (should_send_password) { - g_debug ("sending password\n"); - gdm_user_verifier_call_answer_query (user_verifier, - service_name, - priv->user_password, - NULL, NULL, NULL); - priv->user_password = NULL; - } else { - request_info_query (page, user_verifier, question, TRUE); - } - } - - static void - on_session_opened (GdmGreeter *greeter, - const char *service_name, - GisSummaryPage *page) - { - gdm_greeter_call_start_session_when_ready_sync (greeter, service_name, - TRUE, NULL, NULL); - } - --static void --add_uid_file (uid_t uid) --{ -- gchar *gis_uid_path; -- gchar *uid_str; -- g_autoptr(GError) error = NULL; -- -- gis_uid_path = g_build_filename (g_get_home_dir (), -- "gnome-initial-setup-uid", -- NULL); -- uid_str = g_strdup_printf ("%u", uid); -- -- if (!g_file_set_contents (gis_uid_path, uid_str, -1, &error)) -- g_warning ("Unable to create %s: %s", gis_uid_path, error->message); -- -- g_free (uid_str); -- g_free (gis_uid_path); --} -- - static void - log_user_in (GisSummaryPage *page) - { - GisSummaryPagePrivate *priv = gis_summary_page_get_instance_private (page); - g_autoptr(GError) error = NULL; - GdmGreeter *greeter = NULL; - GdmUserVerifier *user_verifier = NULL; - - if (!gis_driver_get_gdm_objects (GIS_PAGE (page)->driver, - &greeter, &user_verifier)) { - g_warning ("No GDM connection; not initiating login"); - return; - } - - g_signal_connect (user_verifier, "info", - G_CALLBACK (on_info), page); - g_signal_connect (user_verifier, "problem", - G_CALLBACK (on_problem), page); - g_signal_connect (user_verifier, "info-query", - G_CALLBACK (on_info_query), page); - g_signal_connect (user_verifier, "secret-info-query", - G_CALLBACK (on_secret_info_query), page); - - g_signal_connect (greeter, "session-opened", - G_CALLBACK (on_session_opened), 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)); -- - gdm_user_verifier_call_begin_verification_for_user_sync (user_verifier, - SERVICE_NAME, - act_user_get_user_name (priv->user_account), - NULL, &error); - - if (error != NULL) - g_warning ("Could not begin verification: %s", error->message); - } - - static void - done_cb (GtkButton *button, GisSummaryPage *page) - { - gis_ensure_stamp_files (GIS_PAGE (page)->driver); - - switch (gis_driver_get_mode (GIS_PAGE (page)->driver)) - { - case GIS_DRIVER_MODE_NEW_USER: - gis_driver_hide_window (GIS_PAGE (page)->driver); - log_user_in (page); - break; - case GIS_DRIVER_MODE_EXISTING_USER: - g_application_quit (G_APPLICATION (GIS_PAGE (page)->driver)); - default: - break; - } - } - - static void - gis_summary_page_shown (GisPage *page) - { --- -2.41.0.rc2 - diff --git a/0006-gnome-initial-setup-Add-live-user-mode.patch b/0006-gnome-initial-setup-Add-live-user-mode.patch index 13976ee..f02c317 100644 --- a/0006-gnome-initial-setup-Add-live-user-mode.patch +++ b/0006-gnome-initial-setup-Add-live-user-mode.patch @@ -1,7 +1,7 @@ -From 64e82b502c7ed692f360c82478dc35dad55ed051 Mon Sep 17 00:00:00 2001 +From 7a5d91cc7c84c6eeeb1e68d5469a645a5e177215 Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Sun, 13 Aug 2023 09:39:07 -0400 -Subject: [PATCH 06/10] gnome-initial-setup: Add live user mode +Subject: [PATCH 06/11] gnome-initial-setup: Add live user mode This commit adds a new "live user" mode meant to be run in live image environments. @@ -70,7 +70,7 @@ index 02fd21d0..881efde9 100644 return undefined; }); diff --git a/gnome-initial-setup/gis-driver.c b/gnome-initial-setup/gis-driver.c -index 98fe2ca6..41cd6e38 100644 +index d3013063..b18a3808 100644 --- a/gnome-initial-setup/gis-driver.c +++ b/gnome-initial-setup/gis-driver.c @@ -19,60 +19,62 @@ @@ -136,7 +136,7 @@ index 98fe2ca6..41cd6e38 100644 struct _GisDriver { AdwApplication parent_instance; -@@ -767,61 +769,61 @@ static void +@@ -764,61 +766,61 @@ static void connect_to_gdm (GisDriver *driver) { g_autoptr(GError) error = NULL; @@ -400,10 +400,10 @@ index 5041bddd..10dcd70c 100644 +gboolean gis_kernel_command_line_has_argument (const char *arguments[]); +void gis_substitute_word_in_text (char **text, const char *old_word, const char *new_word); diff --git a/gnome-initial-setup/gnome-initial-setup.c b/gnome-initial-setup/gnome-initial-setup.c -index 3635f293..0e155cd3 100644 +index 59955779..bc7a4ee9 100644 --- a/gnome-initial-setup/gnome-initial-setup.c +++ b/gnome-initial-setup/gnome-initial-setup.c -@@ -14,144 +14,149 @@ +@@ -14,141 +14,146 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, see . @@ -442,8 +442,6 @@ index 3635f293..0e155cd3 100644 #define VENDOR_EXISTING_USER_ONLY_KEY "existing_user_only" +#define VENDOR_LIVE_USER_ONLY_KEY "live_user_only" - #define STATE_FILE GIS_WORKING_DIR "/state" - static gboolean force_existing_user_mode; +static gboolean force_live_user_mode; @@ -520,7 +518,6 @@ index 3635f293..0e155cd3 100644 g_autofree char *mode_group = NULL; g_autoptr (GFlagsClass) driver_mode_flags_class = NULL; const GFlagsValue *driver_mode_flags = NULL; - g_autoptr (GError) error = NULL; /* This code will read the keyfile containing vendor customization options and * look for options under the "pages" group, and supports the following keys: @@ -559,7 +556,7 @@ index 3635f293..0e155cd3 100644 driver_mode_flags_class = g_type_class_ref (GIS_TYPE_DRIVER_MODE); -@@ -273,130 +278,137 @@ rebuild_pages_cb (GisDriver *driver) +@@ -250,130 +255,137 @@ rebuild_pages_cb (GisDriver *driver) driver_mode = gis_driver_get_mode (driver); skip_pages = pages_to_skip_from_file (driver); @@ -1288,10 +1285,10 @@ index 00000000..e5084e5e + 'gis-install-page.h' +) diff --git a/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c b/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c -index 61556b99..44d48fd0 100644 +index 76d0b32a..1636350f 100644 --- a/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c +++ b/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c -@@ -199,61 +199,61 @@ change_locale_permission_acquired (GObject *source, +@@ -210,61 +210,61 @@ change_locale_permission_acquired (GObject *source, { GisKeyboardPage *page = GIS_KEYBOARD_PAGE (data); GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (page); @@ -1354,7 +1351,7 @@ index 61556b99..44d48fd0 100644 { GisKeyboardPage *self = GIS_KEYBOARD_PAGE (page); GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self); -@@ -358,61 +358,61 @@ static void +@@ -370,61 +370,61 @@ static void gis_keyboard_page_constructed (GObject *object) { GisKeyboardPage *self = GIS_KEYBOARD_PAGE (object); diff --git a/0004-initial-setup-Don-t-show-duplicated-pages-between-mo.patch b/0007-initial-setup-Don-t-show-duplicated-pages-between-mo.patch similarity index 93% rename from 0004-initial-setup-Don-t-show-duplicated-pages-between-mo.patch rename to 0007-initial-setup-Don-t-show-duplicated-pages-between-mo.patch index 825bd27..1963e4e 100644 --- a/0004-initial-setup-Don-t-show-duplicated-pages-between-mo.patch +++ b/0007-initial-setup-Don-t-show-duplicated-pages-between-mo.patch @@ -1,7 +1,7 @@ -From 97433b89c94c39c9059344a0e4a562b6ef251675 Mon Sep 17 00:00:00 2001 +From e0abb46daa5f5e84b35d8e6481c3408d3c377c40 Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Wed, 16 Aug 2023 10:47:13 -0400 -Subject: [PATCH 04/10] initial-setup: Don't show duplicated pages between +Subject: [PATCH 07/11] initial-setup: Don't show duplicated pages between modes It's possible a user just got asked questions in live mode @@ -12,9 +12,9 @@ This commit tracks that information so it doesn't get reasked. --- data/meson.build | 6 +++ gnome-initial-setup/gis-driver.c | 3 ++ - gnome-initial-setup/gnome-initial-setup.c | 61 +++++++++++++++++++++++ + gnome-initial-setup/gnome-initial-setup.c | 65 +++++++++++++++++++++++ meson.build | 4 ++ - 4 files changed, 74 insertions(+) + 4 files changed, 78 insertions(+) diff --git a/data/meson.build b/data/meson.build index 6a4ef7df..0bfccf56 100644 @@ -58,10 +58,10 @@ index 6a4ef7df..0bfccf56 100644 + strip_directory : true +) diff --git a/gnome-initial-setup/gis-driver.c b/gnome-initial-setup/gis-driver.c -index d3013063..98fe2ca6 100644 +index b18a3808..41cd6e38 100644 --- a/gnome-initial-setup/gis-driver.c +++ b/gnome-initial-setup/gis-driver.c -@@ -78,90 +78,93 @@ struct _GisDriver { +@@ -80,90 +80,93 @@ struct _GisDriver { GtkWindow *main_window; GisAssistant *assistant; @@ -156,12 +156,10 @@ index d3013063..98fe2ca6 100644 gtk_window_set_child (GTK_WINDOW (driver->main_window), sw); gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), child); diff --git a/gnome-initial-setup/gnome-initial-setup.c b/gnome-initial-setup/gnome-initial-setup.c -index 59955779..49e8e6ca 100644 +index bc7a4ee9..2bd2d375 100644 --- a/gnome-initial-setup/gnome-initial-setup.c +++ b/gnome-initial-setup/gnome-initial-setup.c -@@ -20,60 +20,62 @@ - */ - +@@ -22,60 +22,62 @@ #include "config.h" #include "gnome-initial-setup.h" @@ -184,15 +182,18 @@ index 59955779..49e8e6ca 100644 #include "pages/parental-controls/gis-parental-controls-page.h" #include "pages/password/gis-password-page.h" #include "pages/summary/gis-summary-page.h" + #include "pages/install/gis-install-page.h" #define VENDOR_PAGES_GROUP "pages" #define VENDOR_SKIP_KEY "skip" #define VENDOR_NEW_USER_ONLY_KEY "new_user_only" #define VENDOR_EXISTING_USER_ONLY_KEY "existing_user_only" + #define VENDOR_LIVE_USER_ONLY_KEY "live_user_only" +#define STATE_FILE GIS_WORKING_DIR "/state" + static gboolean force_existing_user_mode; + static gboolean force_live_user_mode; static GPtrArray *skipped_pages; @@ -210,19 +211,18 @@ index 59955779..49e8e6ca 100644 PAGE (welcome, GIS_DRIVER_MODE_NEW_USER | GIS_DRIVER_MODE_EXISTING_USER), PAGE (language, GIS_DRIVER_MODE_ALL), PAGE (keyboard, GIS_DRIVER_MODE_ALL), - PAGE (network, GIS_DRIVER_MODE_NEW_USER | GIS_DRIVER_MODE_EXISTING_USER), + PAGE (network, GIS_DRIVER_MODE_ALL), PAGE (privacy, GIS_DRIVER_MODE_NEW_USER | GIS_DRIVER_MODE_EXISTING_USER), - PAGE (timezone, GIS_DRIVER_MODE_NEW_USER | GIS_DRIVER_MODE_EXISTING_USER), + PAGE (timezone, GIS_DRIVER_MODE_ALL), PAGE (software, GIS_DRIVER_MODE_NEW_USER | GIS_DRIVER_MODE_EXISTING_USER), PAGE (goa, GIS_DRIVER_MODE_NEW_USER | GIS_DRIVER_MODE_EXISTING_USER), - PAGE (account, GIS_DRIVER_MODE_NEW_USER), - PAGE (password, GIS_DRIVER_MODE_NEW_USER), + /* In live user mode, the account page isn't displayed, it just quietly creates the live user */ + PAGE (account, GIS_DRIVER_MODE_NEW_USER | GIS_DRIVER_MODE_LIVE_USER), + PAGE (password, GIS_DRIVER_MODE_NEW_USER | GIS_DRIVER_MODE_LIVE_USER), #ifdef HAVE_PARENTAL_CONTROLS PAGE (parental_controls, GIS_DRIVER_MODE_NEW_USER | GIS_DRIVER_MODE_EXISTING_USER), PAGE (parent_password, GIS_DRIVER_MODE_NEW_USER | GIS_DRIVER_MODE_EXISTING_USER), - #endif - PAGE (summary, GIS_DRIVER_MODE_NEW_USER), -@@ -89,60 +91,61 @@ should_skip_page (const gchar *page_id, +@@ -94,60 +96,61 @@ should_skip_page (const gchar *page_id, guint i = 0; /* special case welcome. We only want to show it if language @@ -258,8 +258,8 @@ index 59955779..49e8e6ca 100644 /* This code will read the keyfile containing vendor customization options and * look for options under the "pages" group, and supports the following keys: * - skip (optional): list of pages to be skipped always - * - new_user_only (optional): list of pages to be skipped in existing user mode - * - existing_user_only (optional): list of pages to be skipped in new user mode + * - new_user_only (optional): list of pages to be skipped for modes other than new_user + * - existing_user_only (optional): list of pages to be skipped for modes other than existing_user * * In addition it will look for options under the "{mode} pages" group where {mode} is the * current driver mode for the following keys: @@ -284,7 +284,7 @@ index 59955779..49e8e6ca 100644 VENDOR_SKIP_KEY, NULL); if (skip_pages != NULL) { -@@ -157,60 +160,80 @@ pages_to_skip_from_file (GisDriver *driver) +@@ -162,60 +165,80 @@ pages_to_skip_from_file (GisDriver *driver) mode_group = g_strdup_printf ("%s pages", driver_mode_flags->value_nick); skip_pages = gis_driver_conf_get_string_list (driver, mode_group, @@ -365,7 +365,7 @@ index 59955779..49e8e6ca 100644 page = data; assistant = gtk_widget_get_ancestor (GTK_WIDGET (page), GIS_TYPE_ASSISTANT); -@@ -359,59 +382,97 @@ main (int argc, char *argv[]) +@@ -371,59 +394,101 @@ main (int argc, char *argv[]) * it does in new-user mode, disable Initial Setup for existing users. * * https://gitlab.gnome.org/GNOME/gnome-initial-setup/-/issues/120#note_1019004 @@ -406,11 +406,15 @@ index 59955779..49e8e6ca 100644 + GisAssistant *assistant; + GList *pages, *node; + ++ assistant = gis_driver_get_assistant (driver); ++ ++ if (assistant == NULL) ++ return; ++ + state = g_key_file_new (); + + builder = g_strv_builder_new (); + -+ assistant = gis_driver_get_assistant (driver); + pages = gis_assistant_get_all_pages (assistant); + for (node = pages; node != NULL; node = node->next) { + GisPage *page = node->data; diff --git a/0007-keyboard-Don-t-add-default-input-sources-if-input-so.patch b/0007-keyboard-Don-t-add-default-input-sources-if-input-so.patch deleted file mode 100644 index 9800ee2..0000000 --- a/0007-keyboard-Don-t-add-default-input-sources-if-input-so.patch +++ /dev/null @@ -1,95 +0,0 @@ -From 29fbe5dda08df05b193c0a064a58e5f0d9a66a4a Mon Sep 17 00:00:00 2001 -From: Ray Strode -Date: Sat, 19 Aug 2023 15:31:03 -0400 -Subject: [PATCH 07/10] keyboard: Don't add default input sources if input - sources already set - -If the keyboard page gets skipped, it adds default input sources derived -from the users locale. - -That is all fine and good, but may stomp on existiing site or distro configuration. - -This commit checks for that kind of thing first, and skips adding the -default in that case. ---- - gnome-initial-setup/pages/keyboard/gis-keyboard-page.c | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -diff --git a/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c b/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c -index 44d48fd0..a3be7287 100644 ---- a/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c -+++ b/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c -@@ -222,60 +222,70 @@ update_input (GisKeyboardPage *self) - const gchar *id; - - type = cc_input_chooser_get_input_type (CC_INPUT_CHOOSER (priv->input_chooser)); - id = cc_input_chooser_get_input_id (CC_INPUT_CHOOSER (priv->input_chooser)); - - set_input_settings (self, type, id); - - if (gis_driver_get_mode (GIS_PAGE (self)->driver) & GIS_DRIVER_MODE_SYSTEM) { - if (g_permission_get_allowed (priv->permission)) { - set_localed_input (self); - } else if (g_permission_get_can_acquire (priv->permission)) { - g_permission_acquire_async (priv->permission, - NULL, - change_locale_permission_acquired, - self); - } - } - } - - static gboolean - gis_keyboard_page_apply (GisPage *page, - GCancellable *cancellable) - { - update_input (GIS_KEYBOARD_PAGE (page)); - return FALSE; - } - - static void - add_default_input_sources (GisKeyboardPage *self) - { -+ GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self); -+ g_autoptr(GVariant) default_value = NULL; -+ g_autoptr(GVariant) value = NULL; -+ -+ default_value = g_settings_get_default_value (priv->input_settings, KEY_INPUT_SOURCES); -+ value = g_settings_get_value (priv->input_settings, KEY_INPUT_SOURCES); -+ -+ if (!g_variant_equal (default_value, value)) -+ return; -+ - set_input_settings (self, NULL, NULL); - } - - static void - gis_keyboard_page_skip (GisPage *page) - { - GisKeyboardPage *self = GIS_KEYBOARD_PAGE (page); - GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self); - - priv->should_skip = TRUE; - - if (priv->default_input_source_ids != NULL) - add_default_input_sources (self); - } - - static void - preselect_input_source (GisKeyboardPage *self) - { - GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self); - - cc_input_chooser_set_input (CC_INPUT_CHOOSER (priv->input_chooser), - priv->default_input_source_ids[0], - priv->default_input_source_types[0]); - } - - static void - update_page_complete (GisKeyboardPage *self) - { - GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self); - gboolean complete; --- -2.41.0.rc2 - diff --git a/0008-keyboard-Don-t-add-default-input-sources-if-input-so.patch b/0008-keyboard-Don-t-add-default-input-sources-if-input-so.patch new file mode 100644 index 0000000..aeec649 --- /dev/null +++ b/0008-keyboard-Don-t-add-default-input-sources-if-input-so.patch @@ -0,0 +1,103 @@ +From f7a5ba24eabf86f5175aac0d4f2d8e322c076e87 Mon Sep 17 00:00:00 2001 +From: Ray Strode +Date: Sat, 19 Aug 2023 15:31:03 -0400 +Subject: [PATCH 08/11] keyboard: Don't add default input sources if input + sources already set + +If the keyboard page gets skipped, it adds default input sources derived +from the users locale. + +That is all fine and good, but may stomp on existiing site or distro configuration. + +This commit checks for that kind of thing first, and skips adding the +default in that case. +--- + gnome-initial-setup/pages/keyboard/gis-keyboard-page.c | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c b/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c +index 1636350f..6f440981 100644 +--- a/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c ++++ b/gnome-initial-setup/pages/keyboard/gis-keyboard-page.c +@@ -63,70 +63,77 @@ struct _GisKeyboardPagePrivate { + typedef struct _GisKeyboardPagePrivate GisKeyboardPagePrivate; + + G_DEFINE_TYPE_WITH_PRIVATE (GisKeyboardPage, gis_keyboard_page, GIS_TYPE_PAGE); + + static void + gis_keyboard_page_finalize (GObject *object) + { + GisKeyboardPage *self = GIS_KEYBOARD_PAGE (object); + GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self); + + if (priv->cancellable) + g_cancellable_cancel (priv->cancellable); + g_clear_object (&priv->cancellable); + + g_clear_object (&priv->permission); + g_clear_object (&priv->localed); + g_clear_object (&priv->input_settings); + g_clear_pointer (&priv->default_input_source_ids, g_strfreev); + g_clear_pointer (&priv->default_input_source_types, g_strfreev); + g_clear_pointer (&priv->default_input_options, g_strfreev); + + G_OBJECT_CLASS (gis_keyboard_page_parent_class)->finalize (object); + } + + static void + set_input_settings (GisKeyboardPage *self, + const char *type, + const char *id) + { + GisKeyboardPagePrivate *priv = gis_keyboard_page_get_instance_private (self); +- ++ g_autoptr(GVariant) default_value = NULL; ++ g_autoptr(GVariant) value = NULL; + GVariantBuilder input_source_builder; + GVariantBuilder input_options_builder; + size_t i; + gboolean has_latin_layout = FALSE; + gboolean is_xkb_source = FALSE; + + type = cc_input_chooser_get_input_type (CC_INPUT_CHOOSER (priv->input_chooser)); + id = cc_input_chooser_get_input_id (CC_INPUT_CHOOSER (priv->input_chooser)); + ++ default_value = g_settings_get_default_value (priv->input_settings, KEY_INPUT_SOURCES); ++ value = g_settings_get_value (priv->input_settings, KEY_INPUT_SOURCES); ++ ++ if (!g_variant_equal (default_value, value)) ++ return; ++ + g_variant_builder_init (&input_source_builder, G_VARIANT_TYPE ("a(ss)")); + g_variant_builder_init (&input_options_builder, G_VARIANT_TYPE ("as")); + + if (type != NULL && id != NULL) { + has_latin_layout = !gnome_input_source_is_non_latin (type, id); + if (g_str_equal (type, "xkb")) { + g_variant_builder_add (&input_source_builder, "(ss)", type, id); + + is_xkb_source = TRUE; + } + } + + for (i = 0; priv->default_input_source_ids && priv->default_input_source_ids[i] != NULL; i++) { + if (g_str_equal (id, priv->default_input_source_ids[i]) && g_str_equal (type, priv->default_input_source_types[i])) + continue; + + g_variant_builder_add (&input_source_builder, "(ss)", priv->default_input_source_types[i], priv->default_input_source_ids[i]); + + if (!gnome_input_source_is_non_latin (priv->default_input_source_types[i], priv->default_input_source_ids[i])) + has_latin_layout = TRUE; + } + + if (type != NULL && id != NULL) { + if (!is_xkb_source) { + g_variant_builder_add (&input_source_builder, "(ss)", type, id); + } + } + + if (!has_latin_layout) { + g_variant_builder_add (&input_source_builder, "(ss)", "xkb", "us"); +-- +2.41.0.rc2 + diff --git a/0008-gnome-initial-setup-Add-OEM-mode.patch b/0009-gnome-initial-setup-Add-OEM-mode.patch similarity index 98% rename from 0008-gnome-initial-setup-Add-OEM-mode.patch rename to 0009-gnome-initial-setup-Add-OEM-mode.patch index c9e051d..a93e372 100644 --- a/0008-gnome-initial-setup-Add-OEM-mode.patch +++ b/0009-gnome-initial-setup-Add-OEM-mode.patch @@ -1,7 +1,7 @@ -From e5a05979db85f7a76b1292efb466b3d49e1e0564 Mon Sep 17 00:00:00 2001 +From 8912009c53aa45c8de0118ae416d5699ca31becf Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Sun, 13 Aug 2023 10:30:11 -0400 -Subject: [PATCH 08/10] gnome-initial-setup: Add OEM mode +Subject: [PATCH 09/11] gnome-initial-setup: Add OEM mode OEM mode is designed to get run when a site has imaged a bunch of machines, and handed them off to the user. @@ -155,7 +155,7 @@ index aedb9a73..49639bef 100644 gboolean parental_controls_enabled); diff --git a/gnome-initial-setup/gnome-initial-setup.c b/gnome-initial-setup/gnome-initial-setup.c -index 0e155cd3..82b8bba9 100644 +index 2bd2d375..6fe57017 100644 --- a/gnome-initial-setup/gnome-initial-setup.c +++ b/gnome-initial-setup/gnome-initial-setup.c @@ -26,90 +26,91 @@ diff --git a/0009-polkit-Add-fedora-specfic-rules.patch b/0010-polkit-Add-fedora-specfic-rules.patch similarity index 94% rename from 0009-polkit-Add-fedora-specfic-rules.patch rename to 0010-polkit-Add-fedora-specfic-rules.patch index 536eb40..38da20d 100644 --- a/0009-polkit-Add-fedora-specfic-rules.patch +++ b/0010-polkit-Add-fedora-specfic-rules.patch @@ -1,7 +1,7 @@ -From 87950841dceb637f6f6da001e283b53527bf5312 Mon Sep 17 00:00:00 2001 +From 06ff8e13a06aeb92b107e0483198042ab017593e Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Sun, 13 Aug 2023 16:33:49 -0400 -Subject: [PATCH 09/10] polkit: Add fedora specfic rules +Subject: [PATCH 10/11] polkit: Add fedora specfic rules We should probably add some way to check vendor.conf for the policy updates instead of a hardcoded list. diff --git a/0010-gnome-initial-setup-Read-etc-sysconfig-anaconda.patch b/0011-gnome-initial-setup-Read-etc-sysconfig-anaconda.patch similarity index 95% rename from 0010-gnome-initial-setup-Read-etc-sysconfig-anaconda.patch rename to 0011-gnome-initial-setup-Read-etc-sysconfig-anaconda.patch index 7c63cca..5c9eb17 100644 --- a/0010-gnome-initial-setup-Read-etc-sysconfig-anaconda.patch +++ b/0011-gnome-initial-setup-Read-etc-sysconfig-anaconda.patch @@ -1,7 +1,7 @@ -From 4c263eb0ab00dbdcea4589fca4dc3a82f18de5eb Mon Sep 17 00:00:00 2001 +From 6a5a2f04c6db1c6c329fc344f09aa8db53876cbb Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Tue, 22 Aug 2023 13:51:40 -0400 -Subject: [PATCH 10/10] gnome-initial-setup: Read /etc/sysconfig/anaconda +Subject: [PATCH 11/11] 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 @@ -13,7 +13,7 @@ This commit skips those from the --new-user mode as well. 1 file changed, 23 insertions(+) diff --git a/gnome-initial-setup/gnome-initial-setup.c b/gnome-initial-setup/gnome-initial-setup.c -index 82b8bba9..0ac93fe9 100644 +index 6fe57017..f9b3923f 100644 --- a/gnome-initial-setup/gnome-initial-setup.c +++ b/gnome-initial-setup/gnome-initial-setup.c @@ -172,72 +172,95 @@ pages_to_skip_from_file (GisDriver *driver) diff --git a/gnome-initial-setup.spec b/gnome-initial-setup.spec index 65ff213..eea8aa7 100644 --- a/gnome-initial-setup.spec +++ b/gnome-initial-setup.spec @@ -3,7 +3,7 @@ %global glib_required_version 2.63.1 %global gtk_required_version 4.6 %global geoclue_version 2.3.1 -%global gnome_desktop_version 44.0-6 +%global gnome_desktop_version 44.0-7 %global tarball_version %%(echo %{version} | tr '~' '.') @@ -17,16 +17,17 @@ URL: https://wiki.gnome.org/Design/OS/InitialSetup Source0: https://download.gnome.org/sources/%{name}/45/%{name}-%{tarball_version}.tar.xz Source1: vendor.conf -Patch: 0001-keyboard-Get-default-input-sources-from-gnome-deskto.patch -Patch: 0002-gnome-initial-setup-Bump-GLib-required-version-to-2..patch -Patch: 0003-driver-Specify-mode-via-flags-instead-of-boolean.patch -Patch: 0004-initial-setup-Don-t-show-duplicated-pages-between-mo.patch -Patch: 0005-summary-Write-uid-file-with-other-state-files.patch +Patch: 0001-keyboard-stop-setting-current-input-source.patch +Patch: 0002-keyboard-write-to-mru-sources-setting-if-it-has-neve.patch +Patch: 0003-keyboard-Get-default-input-sources-from-gnome-deskto.patch +Patch: 0004-gnome-initial-setup-Bump-GLib-required-version-to-2..patch +Patch: 0005-driver-Specify-mode-via-flags-instead-of-boolean.patch Patch: 0006-gnome-initial-setup-Add-live-user-mode.patch -Patch: 0007-keyboard-Don-t-add-default-input-sources-if-input-so.patch -Patch: 0008-gnome-initial-setup-Add-OEM-mode.patch -Patch: 0009-polkit-Add-fedora-specfic-rules.patch -Patch: 0010-gnome-initial-setup-Read-etc-sysconfig-anaconda.patch +Patch: 0007-initial-setup-Don-t-show-duplicated-pages-between-mo.patch +Patch: 0008-keyboard-Don-t-add-default-input-sources-if-input-so.patch +Patch: 0009-gnome-initial-setup-Add-OEM-mode.patch +Patch: 0010-polkit-Add-fedora-specfic-rules.patch +Patch: 0011-gnome-initial-setup-Read-etc-sysconfig-anaconda.patch BuildRequires: desktop-file-utils BuildRequires: gcc