Blame SOURCES/0001-Honor-initial-setup-being-disabled-by-distro-install.patch

39d8c7
From 42b18e4c84d470f33cdec5fc1f481cb25c25cf0d Mon Sep 17 00:00:00 2001
39d8c7
From: Rui Matos <tiagomatos@gmail.com>
39d8c7
Date: Mon, 23 Jan 2017 20:19:51 +0100
39d8c7
Subject: [PATCH] Honor initial setup being disabled by distro installer
39d8c7
39d8c7
Sysadmins might want to disable any kind of initial setup for their
39d8c7
users, perhaps because they pre-configure their environments. We
39d8c7
already provide a configuration file option for this but distro
39d8c7
installers might have their own way of requesting this.
39d8c7
39d8c7
At least the anaconda installer provides an option to skip any kind
39d8c7
post-install setup tools so, for now we're only adding support for
39d8c7
that but more might be added in the future.
39d8c7
39d8c7
https://bugzilla.gnome.org/show_bug.cgi?id=777708
39d8c7
---
39d8c7
 daemon/Makefile.am   |  1 +
39d8c7
 daemon/gdm-display.c | 29 +++++++++++++++++++++++++++++
39d8c7
 2 files changed, 30 insertions(+)
39d8c7
39d8c7
diff --git a/daemon/gdm-display.c b/daemon/gdm-display.c
39d8c7
index 5e193f2..878be88 100644
39d8c7
--- a/daemon/gdm-display.c
39d8c7
+++ b/daemon/gdm-display.c
39d8c7
@@ -1547,6 +1547,31 @@ kernel_cmdline_initial_setup_force_state (gboolean *force_state)
39d8c7
         return TRUE;
39d8c7
 }
39d8c7
 
39d8c7
+static gboolean
39d8c7
+initial_setup_disabled_by_anaconda (void)
39d8c7
+{
39d8c7
+        GKeyFile *key_file;
39d8c7
+        const gchar *file_name = SYSCONFDIR "/sysconfig/anaconda";
39d8c7
+        gboolean disabled = FALSE;
39d8c7
+        GError *error = NULL;
39d8c7
+
39d8c7
+        key_file = g_key_file_new ();
39d8c7
+        if (!g_key_file_load_from_file (key_file, file_name, G_KEY_FILE_NONE, &error)) {
39d8c7
+                if (!g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_NOENT) &&
39d8c7
+                    !g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_NOT_FOUND)) {
39d8c7
+                        g_warning ("Could not read %s: %s", file_name, error->message);
39d8c7
+                }
39d8c7
+                g_error_free (error);
39d8c7
+                goto out;
39d8c7
+        }
39d8c7
+
39d8c7
+        disabled = g_key_file_get_boolean (key_file, "General",
39d8c7
+                                           "post_install_tools_disabled", NULL);
39d8c7
+ out:
39d8c7
+        g_key_file_unref (key_file);
39d8c7
+        return disabled;
39d8c7
+}
39d8c7
+
39d8c7
 static gboolean
39d8c7
 wants_initial_setup (GdmDisplay *self)
39d8c7
 {
39d8c7
@@ -1587,6 +1612,10 @@ wants_initial_setup (GdmDisplay *self)
39d8c7
                 return FALSE;
39d8c7
         }
39d8c7
 
39d8c7
+        if (initial_setup_disabled_by_anaconda ()) {
39d8c7
+                return FALSE;
39d8c7
+        }
39d8c7
+
39d8c7
         return enabled;
39d8c7
 }
39d8c7
 
39d8c7
-- 
39d8c7
2.19.0
39d8c7