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

890c66
From fa5733788ae5f8e8caeb07e956be370e96f9b6b1 Mon Sep 17 00:00:00 2001
890c66
From: Rui Matos <tiagomatos@gmail.com>
890c66
Date: Mon, 23 Jan 2017 20:19:51 +0100
890c66
Subject: [PATCH] Honor initial setup being disabled by distro installer
890c66
890c66
Sysadmins might want to disable any kind of initial setup for their
890c66
users, perhaps because they pre-configure their environments. We
890c66
already provide a configuration file option for this but distro
890c66
installers might have their own way of requesting this.
890c66
890c66
At least the anaconda installer provides an option to skip any kind
890c66
post-install setup tools so, for now we're only adding support for
890c66
that but more might be added in the future.
890c66
890c66
https://bugzilla.gnome.org/show_bug.cgi?id=777708
890c66
---
890c66
 daemon/Makefile.am   |  1 +
890c66
 daemon/gdm-display.c | 29 +++++++++++++++++++++++++++++
890c66
 2 files changed, 30 insertions(+)
890c66
890c66
diff --git a/daemon/Makefile.am b/daemon/Makefile.am
890c66
index ab5dda0..786e0c5 100644
890c66
--- a/daemon/Makefile.am
890c66
+++ b/daemon/Makefile.am
890c66
@@ -14,6 +14,7 @@ AM_CPPFLAGS = \
890c66
 	-DLOCALSTATEDIR=\"$(localstatedir)\"		\
890c66
 	-DLOGDIR=\"$(logdir)\"				\
890c66
 	-DSBINDIR=\"$(sbindir)\"			\
890c66
+	-DSYSCONFDIR=\"$(sysconfdir)\"			\
890c66
 	-DGNOMELOCALEDIR=\""$(datadir)/locale"\"	\
890c66
 	-DGDM_RUN_DIR=\"$(GDM_RUN_DIR)\"		\
890c66
 	-DGDM_XAUTH_DIR=\"$(GDM_XAUTH_DIR)\"		\
890c66
diff --git a/daemon/gdm-display.c b/daemon/gdm-display.c
890c66
index 0057e2c..2af8e13 100644
890c66
--- a/daemon/gdm-display.c
890c66
+++ b/daemon/gdm-display.c
890c66
@@ -1456,6 +1456,31 @@ can_create_environment (const char *session_id)
890c66
 }
890c66
 
890c66
 static gboolean
890c66
+initial_setup_disabled_by_anaconda (void)
890c66
+{
890c66
+        GKeyFile *key_file;
890c66
+        const gchar *file_name = SYSCONFDIR "/sysconfig/anaconda";
890c66
+        gboolean disabled = FALSE;
890c66
+        GError *error = NULL;
890c66
+
890c66
+        key_file = g_key_file_new ();
890c66
+        if (!g_key_file_load_from_file (key_file, file_name, G_KEY_FILE_NONE, &error)) {
890c66
+                if (!g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_NOENT) &&
890c66
+                    !g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_NOT_FOUND)) {
890c66
+                        g_warning ("Could not read %s: %s", file_name, error->message);
890c66
+                }
890c66
+                g_error_free (error);
890c66
+                goto out;
890c66
+        }
890c66
+
890c66
+        disabled = g_key_file_get_boolean (key_file, "General",
890c66
+                                           "post_install_tools_disabled", NULL);
890c66
+ out:
890c66
+        g_key_file_unref (key_file);
890c66
+        return disabled;
890c66
+}
890c66
+
890c66
+static gboolean
890c66
 wants_initial_setup (GdmDisplay *self)
890c66
 {
890c66
         gboolean enabled = FALSE;
890c66
@@ -1480,6 +1505,10 @@ wants_initial_setup (GdmDisplay *self)
890c66
                 return FALSE;
890c66
         }
890c66
 
890c66
+        if (initial_setup_disabled_by_anaconda ()) {
890c66
+                return FALSE;
890c66
+        }
890c66
+
890c66
         return enabled;
890c66
 }
890c66
 
890c66
-- 
890c66
2.9.3
890c66