2023-09-11 00:19:22 +00:00
|
|
|
From d42637a6f59981bac75a55eaee8fd1fc3b251e02 Mon Sep 17 00:00:00 2001
|
2023-09-08 15:28:32 +00:00
|
|
|
From: Ray Strode <rstrode@redhat.com>
|
|
|
|
Date: Tue, 22 Aug 2023 13:51:40 -0400
|
2023-09-11 00:19:22 +00:00
|
|
|
Subject: [PATCH 9/9] gnome-initial-setup: Read /etc/sysconfig/anaconda
|
2023-09-08 15:28:32 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
already answered via Anaconda.
|
|
|
|
|
|
|
|
This commit skips those from the --new-user mode as well.
|
|
|
|
---
|
|
|
|
gnome-initial-setup/gnome-initial-setup.c | 23 +++++++++++++++++++++++
|
|
|
|
1 file changed, 23 insertions(+)
|
|
|
|
|
|
|
|
diff --git a/gnome-initial-setup/gnome-initial-setup.c b/gnome-initial-setup/gnome-initial-setup.c
|
2023-09-11 00:19:22 +00:00
|
|
|
index 2bd2d375..474dfc58 100644
|
2023-09-08 15:28:32 +00:00
|
|
|
--- a/gnome-initial-setup/gnome-initial-setup.c
|
|
|
|
+++ b/gnome-initial-setup/gnome-initial-setup.c
|
2023-09-11 00:19:22 +00:00
|
|
|
@@ -171,72 +171,95 @@ pages_to_skip_from_file (GisDriver *driver)
|
2023-09-08 15:28:32 +00:00
|
|
|
g_strv_builder_addv (builder, (const char **) skip_pages);
|
|
|
|
g_clear_pointer (&skip_pages, g_strfreev);
|
|
|
|
}
|
|
|
|
|
|
|
|
other_modes = GIS_DRIVER_MODE_ALL & ~driver_mode;
|
|
|
|
while (other_modes) {
|
|
|
|
const GFlagsValue *other_mode_flags = g_flags_get_first_value (driver_mode_flags_class, other_modes);
|
|
|
|
|
|
|
|
if (other_mode_flags != NULL) {
|
|
|
|
g_autofree char *vendor_key = g_strdup_printf ("%s_only", other_mode_flags->value_nick);
|
|
|
|
|
|
|
|
skip_pages = gis_driver_conf_get_string_list (driver, VENDOR_PAGES_GROUP,
|
|
|
|
vendor_key, NULL);
|
|
|
|
|
|
|
|
if (skip_pages != NULL)
|
|
|
|
{
|
|
|
|
g_strv_builder_addv (builder, (const char **) skip_pages);
|
|
|
|
g_clear_pointer (&skip_pages, g_strfreev);
|
|
|
|
}
|
|
|
|
|
|
|
|
other_modes &= ~other_mode_flags->value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Also, if this is a system mode, we check if the user already answered questions earlier in
|
|
|
|
* a different system mode, and skip those pages too.
|
|
|
|
*/
|
|
|
|
if (driver_mode & GIS_DRIVER_MODE_NEW_USER) {
|
|
|
|
g_autoptr(GKeyFile) state = NULL;
|
|
|
|
gboolean state_loaded;
|
|
|
|
+ g_autoptr(GKeyFile) anaconda = NULL;
|
|
|
|
+ gboolean anaconda_loaded;
|
|
|
|
|
|
|
|
state = g_key_file_new ();
|
|
|
|
state_loaded = g_key_file_load_from_file (state, STATE_FILE, G_KEY_FILE_NONE, &error);
|
|
|
|
|
|
|
|
if (state_loaded) {
|
|
|
|
skip_pages = g_key_file_get_string_list (state, VENDOR_PAGES_GROUP, VENDOR_SKIP_KEY, NULL, NULL);
|
|
|
|
|
|
|
|
if (skip_pages != NULL) {
|
|
|
|
g_strv_builder_addv (builder, (const char **) skip_pages);
|
|
|
|
g_clear_pointer (&skip_pages, g_strfreev);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ anaconda = g_key_file_new ();
|
|
|
|
+ anaconda_loaded = g_key_file_load_from_file (anaconda, "/etc/sysconfig/anaconda", G_KEY_FILE_NONE, NULL);
|
|
|
|
+
|
|
|
|
+ if (anaconda_loaded) {
|
|
|
|
+ struct {
|
|
|
|
+ const char *spoke_name;
|
|
|
|
+ const char *page_name;
|
|
|
|
+ } spoke_page_map[] = {
|
|
|
|
+ { "WelcomeLanguageSpoke", "language" },
|
|
|
|
+ { "DatetimeSpoke", "timezone" },
|
|
|
|
+ { "KeyboardSpoke", "keyboard" },
|
|
|
|
+ { NULL, NULL }
|
|
|
|
+ };
|
|
|
|
+ size_t i;
|
|
|
|
+
|
|
|
|
+ for (i = 0; spoke_page_map[i].spoke_name != NULL; i++) {
|
|
|
|
+ if (g_key_file_get_boolean (anaconda, spoke_page_map[i].spoke_name, "visited", NULL))
|
|
|
|
+ g_strv_builder_add (builder, spoke_page_map[i].page_name);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
|
|
|
|
return g_strv_builder_end (builder);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
destroy_pages_after (GisAssistant *assistant,
|
|
|
|
GisPage *page)
|
|
|
|
{
|
|
|
|
GList *pages, *l, *next;
|
|
|
|
|
|
|
|
pages = gis_assistant_get_all_pages (assistant);
|
|
|
|
|
|
|
|
for (l = pages; l != NULL; l = l->next)
|
|
|
|
if (l->data == page)
|
|
|
|
break;
|
|
|
|
|
|
|
|
l = l->next;
|
|
|
|
for (; l != NULL; l = next) {
|
|
|
|
next = l->next;
|
|
|
|
gis_assistant_remove_page (assistant, l->data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
destroy_page (gpointer data)
|
|
|
|
{
|
|
|
|
GtkWidget *assistant;
|
|
|
|
GisPage *page;
|
|
|
|
|
|
|
|
--
|
|
|
|
2.41.0
|
|
|
|
|