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