|
|
3b7e70 |
From a447cd87b99868348ecf69479eb7958f20a318a2 Mon Sep 17 00:00:00 2001
|
|
|
890c66 |
From: Rui Matos <tiagomatos@gmail.com>
|
|
|
890c66 |
Date: Mon, 23 Jan 2017 20:19:51 +0100
|
|
|
890c66 |
Subject: [PATCH] Honor initial setup being disabled by distro installer
|
|
|
890c66 |
|
|
|
890c66 |
Sysadmins might want to disable any kind of initial setup for their
|
|
|
890c66 |
users, perhaps because they pre-configure their environments. We
|
|
|
890c66 |
already provide a configuration file option for this but distro
|
|
|
890c66 |
installers might have their own way of requesting this.
|
|
|
890c66 |
|
|
|
890c66 |
At least the anaconda installer provides an option to skip any kind
|
|
|
890c66 |
post-install setup tools so, for now we're only adding support for
|
|
|
890c66 |
that but more might be added in the future.
|
|
|
890c66 |
|
|
|
890c66 |
https://bugzilla.gnome.org/show_bug.cgi?id=777708
|
|
|
890c66 |
---
|
|
|
890c66 |
daemon/gdm-display.c | 29 +++++++++++++++++++++++++++++
|
|
|
3b7e70 |
1 file changed, 29 insertions(+)
|
|
|
890c66 |
|
|
|
890c66 |
diff --git a/daemon/gdm-display.c b/daemon/gdm-display.c
|
|
|
3b7e70 |
index 687e7da4b..b3bdf066d 100644
|
|
|
890c66 |
--- a/daemon/gdm-display.c
|
|
|
890c66 |
+++ b/daemon/gdm-display.c
|
|
|
3b7e70 |
@@ -1591,103 +1591,132 @@ kernel_cmdline_initial_setup_force_state (gboolean *force_state)
|
|
|
3b7e70 |
GError *error = NULL;
|
|
|
3b7e70 |
gchar *contents = NULL;
|
|
|
3b7e70 |
gchar *setup_argument = NULL;
|
|
|
3b7e70 |
|
|
|
3b7e70 |
g_return_val_if_fail (force_state != NULL, FALSE);
|
|
|
3b7e70 |
|
|
|
3b7e70 |
if (!g_file_get_contents ("/proc/cmdline", &contents, NULL, &error)) {
|
|
|
3b7e70 |
g_debug ("GdmDisplay: Could not check kernel parameters, not forcing initial setup: %s",
|
|
|
3b7e70 |
error->message);
|
|
|
3b7e70 |
g_clear_error (&error);
|
|
|
3b7e70 |
return FALSE;
|
|
|
3b7e70 |
}
|
|
|
3b7e70 |
|
|
|
3b7e70 |
g_debug ("GdmDisplay: Checking kernel command buffer %s", contents);
|
|
|
3b7e70 |
|
|
|
3b7e70 |
if (!kernel_cmdline_initial_setup_argument (contents, &setup_argument, &error)) {
|
|
|
3b7e70 |
g_debug ("GdmDisplay: Failed to read kernel commandline: %s", error->message);
|
|
|
3b7e70 |
g_clear_pointer (&contents, g_free);
|
|
|
3b7e70 |
return FALSE;
|
|
|
3b7e70 |
}
|
|
|
3b7e70 |
|
|
|
3b7e70 |
g_clear_pointer (&contents, g_free);
|
|
|
3b7e70 |
|
|
|
3b7e70 |
/* Poor-man's check for truthy or falsey values */
|
|
|
3b7e70 |
*force_state = setup_argument[0] == '1';
|
|
|
3b7e70 |
|
|
|
3b7e70 |
g_free (setup_argument);
|
|
|
3b7e70 |
return TRUE;
|
|
|
890c66 |
}
|
|
|
890c66 |
|
|
|
3b7e70 |
+static gboolean
|
|
|
890c66 |
+initial_setup_disabled_by_anaconda (void)
|
|
|
890c66 |
+{
|
|
|
890c66 |
+ GKeyFile *key_file;
|
|
|
890c66 |
+ const gchar *file_name = SYSCONFDIR "/sysconfig/anaconda";
|
|
|
890c66 |
+ gboolean disabled = FALSE;
|
|
|
890c66 |
+ GError *error = NULL;
|
|
|
890c66 |
+
|
|
|
890c66 |
+ key_file = g_key_file_new ();
|
|
|
890c66 |
+ if (!g_key_file_load_from_file (key_file, file_name, G_KEY_FILE_NONE, &error)) {
|
|
|
890c66 |
+ if (!g_error_matches (error, G_FILE_ERROR, G_FILE_ERROR_NOENT) &&
|
|
|
890c66 |
+ !g_error_matches (error, G_KEY_FILE_ERROR, G_KEY_FILE_ERROR_NOT_FOUND)) {
|
|
|
890c66 |
+ g_warning ("Could not read %s: %s", file_name, error->message);
|
|
|
890c66 |
+ }
|
|
|
890c66 |
+ g_error_free (error);
|
|
|
890c66 |
+ goto out;
|
|
|
890c66 |
+ }
|
|
|
890c66 |
+
|
|
|
890c66 |
+ disabled = g_key_file_get_boolean (key_file, "General",
|
|
|
890c66 |
+ "post_install_tools_disabled", NULL);
|
|
|
890c66 |
+ out:
|
|
|
890c66 |
+ g_key_file_unref (key_file);
|
|
|
890c66 |
+ return disabled;
|
|
|
890c66 |
+}
|
|
|
890c66 |
+
|
|
|
3b7e70 |
static gboolean
|
|
|
890c66 |
wants_initial_setup (GdmDisplay *self)
|
|
|
890c66 |
{
|
|
|
3b7e70 |
GdmDisplayPrivate *priv;
|
|
|
890c66 |
gboolean enabled = FALSE;
|
|
|
3b7e70 |
gboolean forced = FALSE;
|
|
|
3b7e70 |
|
|
|
3b7e70 |
priv = gdm_display_get_instance_private (self);
|
|
|
3b7e70 |
|
|
|
3b7e70 |
if (already_done_initial_setup_on_this_boot ()) {
|
|
|
3b7e70 |
return FALSE;
|
|
|
3b7e70 |
}
|
|
|
3b7e70 |
|
|
|
3b7e70 |
if (kernel_cmdline_initial_setup_force_state (&forced)) {
|
|
|
3b7e70 |
if (forced) {
|
|
|
3b7e70 |
g_debug ("GdmDisplay: Forcing gnome-initial-setup");
|
|
|
3b7e70 |
return TRUE;
|
|
|
3b7e70 |
}
|
|
|
3b7e70 |
|
|
|
3b7e70 |
g_debug ("GdmDisplay: Forcing no gnome-initial-setup");
|
|
|
3b7e70 |
return FALSE;
|
|
|
3b7e70 |
}
|
|
|
3b7e70 |
|
|
|
3b7e70 |
/* don't run initial-setup on remote displays
|
|
|
3b7e70 |
*/
|
|
|
3b7e70 |
if (!priv->is_local) {
|
|
|
3b7e70 |
return FALSE;
|
|
|
3b7e70 |
}
|
|
|
3b7e70 |
|
|
|
3b7e70 |
/* don't run if the system has existing users */
|
|
|
3b7e70 |
if (priv->have_existing_user_accounts) {
|
|
|
3b7e70 |
return FALSE;
|
|
|
3b7e70 |
}
|
|
|
3b7e70 |
|
|
|
3b7e70 |
/* don't run if initial-setup is unavailable */
|
|
|
3b7e70 |
if (!can_create_environment ("gnome-initial-setup")) {
|
|
|
3b7e70 |
return FALSE;
|
|
|
3b7e70 |
}
|
|
|
3b7e70 |
|
|
|
3b7e70 |
if (!gdm_settings_direct_get_boolean (GDM_KEY_INITIAL_SETUP_ENABLE, &enabled)) {
|
|
|
890c66 |
return FALSE;
|
|
|
890c66 |
}
|
|
|
890c66 |
|
|
|
890c66 |
+ if (initial_setup_disabled_by_anaconda ()) {
|
|
|
890c66 |
+ return FALSE;
|
|
|
890c66 |
+ }
|
|
|
890c66 |
+
|
|
|
890c66 |
return enabled;
|
|
|
890c66 |
}
|
|
|
890c66 |
|
|
|
3b7e70 |
void
|
|
|
3b7e70 |
gdm_display_start_greeter_session (GdmDisplay *self)
|
|
|
3b7e70 |
{
|
|
|
3b7e70 |
GdmDisplayPrivate *priv;
|
|
|
3b7e70 |
GdmSession *session;
|
|
|
3b7e70 |
char *display_name;
|
|
|
3b7e70 |
char *seat_id;
|
|
|
3b7e70 |
char *hostname;
|
|
|
3b7e70 |
char *auth_file = NULL;
|
|
|
3b7e70 |
|
|
|
3b7e70 |
priv = gdm_display_get_instance_private (self);
|
|
|
3b7e70 |
g_return_if_fail (g_strcmp0 (priv->session_class, "greeter") == 0);
|
|
|
3b7e70 |
|
|
|
3b7e70 |
g_debug ("GdmDisplay: Running greeter");
|
|
|
3b7e70 |
|
|
|
3b7e70 |
display_name = NULL;
|
|
|
3b7e70 |
seat_id = NULL;
|
|
|
3b7e70 |
hostname = NULL;
|
|
|
3b7e70 |
|
|
|
3b7e70 |
g_object_get (self,
|
|
|
3b7e70 |
"x11-display-name", &display_name,
|
|
|
3b7e70 |
"seat-id", &seat_id,
|
|
|
3b7e70 |
"remote-hostname", &hostname,
|
|
|
3b7e70 |
NULL);
|
|
|
3b7e70 |
if (priv->access_file != NULL) {
|
|
|
3b7e70 |
auth_file = gdm_display_access_file_get_path (priv->access_file);
|
|
|
3b7e70 |
}
|
|
|
890c66 |
--
|
|
|
3b7e70 |
2.28.0
|
|
|
890c66 |
|