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