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