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

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