[gdm/fix-jump-back-to-login-screen: 19/21] Honor initial setup being disabled by distro installer




commit 879c0e436b3fe28e22ada97656abc7d3ba3ddf8f
Author: Rui Matos <tiagomatos gmail com>
Date:   Mon Jan 23 20:19:51 2017 +0100

    Honor initial setup being disabled by distro installer
    
    Sysadmins might want to disable any kind of initial setup for their
    users, perhaps because they pre-configure their environments. We
    already provide a configuration file option for this but distro
    installers might have their own way of requesting this.
    
    At least the anaconda installer provides an option to skip any kind
    post-install setup tools so, for now we're only adding support for
    that but more might be added in the future.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=777708

 daemon/gdm-display.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
---
diff --git a/daemon/gdm-display.c b/daemon/gdm-display.c
index 344678564..9438fe72c 100644
--- a/daemon/gdm-display.c
+++ b/daemon/gdm-display.c
@@ -1648,6 +1648,31 @@ kernel_cmdline_initial_setup_force_state (gboolean *force_state)
         return TRUE;
 }
 
+static gboolean
+initial_setup_disabled_by_anaconda (void)
+{
+        GKeyFile *key_file;
+        const gchar *file_name = SYSCONFDIR "/sysconfig/anaconda";
+        gboolean disabled = FALSE;
+        GError *error = NULL;
+
+        key_file = g_key_file_new ();
+        if (!g_key_file_load_from_file (key_file, file_name, G_KEY_FILE_NONE, &error)) {
+                if (!g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_NOENT) &&
+                    !g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_NOT_FOUND)) {
+                        g_warning ("Could not read %s: %s", file_name, error->message);
+                }
+                g_error_free (error);
+                goto out;
+        }
+
+        disabled = g_key_file_get_boolean (key_file, "General",
+                                           "post_install_tools_disabled", NULL);
+ out:
+        g_key_file_unref (key_file);
+        return disabled;
+}
+
 static gboolean
 wants_initial_setup (GdmDisplay *self)
 {
@@ -1691,6 +1716,10 @@ wants_initial_setup (GdmDisplay *self)
                 return FALSE;
         }
 
+        if (initial_setup_disabled_by_anaconda ()) {
+                return FALSE;
+        }
+
         return enabled;
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]