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