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

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