2021-12-07 18:22:59 +00:00
|
|
|
From f6ebcec5d48aeff718a9db9b8ff812fd404a61ed Mon Sep 17 00:00:00 2001
|
2021-11-02 13:03:55 +00:00
|
|
|
From: Rui Matos <tiagomatos@gmail.com>
|
|
|
|
Date: Mon, 23 Jan 2017 20:19:51 +0100
|
|
|
|
Subject: [PATCH] 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 +++++++++++++++++++++++++++++
|
2021-12-07 18:22:59 +00:00
|
|
|
1 file changed, 29 insertions(+)
|
2021-11-02 13:03:55 +00:00
|
|
|
|
|
|
|
diff --git a/daemon/gdm-display.c b/daemon/gdm-display.c
|
2021-12-07 18:22:59 +00:00
|
|
|
index 34467856..9438fe72 100644
|
2021-11-02 13:03:55 +00:00
|
|
|
--- a/daemon/gdm-display.c
|
|
|
|
+++ b/daemon/gdm-display.c
|
2021-12-07 18:22:59 +00:00
|
|
|
@@ -1621,103 +1621,132 @@ kernel_cmdline_initial_setup_force_state (gboolean *force_state)
|
|
|
|
GError *error = NULL;
|
|
|
|
gchar *contents = NULL;
|
|
|
|
gchar *setup_argument = NULL;
|
|
|
|
|
|
|
|
g_return_val_if_fail (force_state != NULL, FALSE);
|
|
|
|
|
|
|
|
if (!g_file_get_contents ("/proc/cmdline", &contents, NULL, &error)) {
|
|
|
|
g_debug ("GdmDisplay: Could not check kernel parameters, not forcing initial setup: %s",
|
|
|
|
error->message);
|
|
|
|
g_clear_error (&error);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_debug ("GdmDisplay: Checking kernel command buffer %s", contents);
|
|
|
|
|
|
|
|
if (!kernel_cmdline_initial_setup_argument (contents, &setup_argument, &error)) {
|
|
|
|
g_debug ("GdmDisplay: Failed to read kernel commandline: %s", error->message);
|
|
|
|
g_clear_pointer (&contents, g_free);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_clear_pointer (&contents, g_free);
|
|
|
|
|
|
|
|
/* Poor-man's check for truthy or falsey values */
|
|
|
|
*force_state = setup_argument[0] == '1';
|
|
|
|
|
|
|
|
g_free (setup_argument);
|
2021-11-02 13:03:55 +00:00
|
|
|
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)
|
|
|
|
{
|
2021-12-07 18:22:59 +00:00
|
|
|
GdmDisplayPrivate *priv;
|
|
|
|
gboolean enabled = FALSE;
|
|
|
|
gboolean forced = FALSE;
|
|
|
|
|
|
|
|
priv = gdm_display_get_instance_private (self);
|
|
|
|
|
|
|
|
if (already_done_initial_setup_on_this_boot ()) {
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (kernel_cmdline_initial_setup_force_state (&forced)) {
|
|
|
|
if (forced) {
|
|
|
|
g_debug ("GdmDisplay: Forcing gnome-initial-setup");
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_debug ("GdmDisplay: Forcing no gnome-initial-setup");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* don't run initial-setup on remote displays
|
|
|
|
*/
|
|
|
|
if (!priv->is_local) {
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* don't run if the system has existing users */
|
|
|
|
if (priv->have_existing_user_accounts) {
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* don't run if initial-setup is unavailable */
|
|
|
|
if (!can_create_environment ("gnome-initial-setup")) {
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!gdm_settings_direct_get_boolean (GDM_KEY_INITIAL_SETUP_ENABLE, &enabled)) {
|
2021-11-02 13:03:55 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
+ if (initial_setup_disabled_by_anaconda ()) {
|
|
|
|
+ return FALSE;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
return enabled;
|
|
|
|
}
|
|
|
|
|
2021-12-07 18:22:59 +00:00
|
|
|
void
|
|
|
|
gdm_display_start_greeter_session (GdmDisplay *self)
|
|
|
|
{
|
|
|
|
GdmDisplayPrivate *priv;
|
|
|
|
GdmSession *session;
|
|
|
|
char *display_name;
|
|
|
|
char *seat_id;
|
|
|
|
char *hostname;
|
|
|
|
char *auth_file = NULL;
|
|
|
|
|
|
|
|
priv = gdm_display_get_instance_private (self);
|
|
|
|
g_return_if_fail (g_strcmp0 (priv->session_class, "greeter") == 0);
|
|
|
|
|
|
|
|
g_debug ("GdmDisplay: Running greeter");
|
|
|
|
|
|
|
|
display_name = NULL;
|
|
|
|
seat_id = NULL;
|
|
|
|
hostname = NULL;
|
|
|
|
|
|
|
|
g_object_get (self,
|
|
|
|
"x11-display-name", &display_name,
|
|
|
|
"seat-id", &seat_id,
|
|
|
|
"remote-hostname", &hostname,
|
|
|
|
NULL);
|
|
|
|
if (priv->access_file != NULL) {
|
|
|
|
auth_file = gdm_display_access_file_get_path (priv->access_file);
|
|
|
|
}
|
2021-11-02 13:03:55 +00:00
|
|
|
--
|
2021-12-07 18:22:59 +00:00
|
|
|
2.32.0
|
2021-11-02 13:03:55 +00:00
|
|
|
|