2019-04-06 12:25:57 +00:00
|
|
|
From 56ee7759794f8b455563f795837df256bf35c193 Mon Sep 17 00:00:00 2001
|
2017-01-31 12:24:20 +00:00
|
|
|
From: Rui Matos <tiagomatos@gmail.com>
|
|
|
|
Date: Mon, 23 Jan 2017 19:42:44 +0100
|
2017-03-14 00:05:35 +00:00
|
|
|
Subject: [PATCH] Exit gracefully if we are disabled systemwide
|
2017-01-31 12:24:20 +00:00
|
|
|
|
|
|
|
Sysadmins might want to disable any kind of initial setup for their
|
|
|
|
users, perhaps because they pre-configure their environments. We
|
|
|
|
should provide an easy way to do it.
|
|
|
|
|
|
|
|
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=777707
|
|
|
|
---
|
2018-09-07 16:36:56 +00:00
|
|
|
gnome-initial-setup/gnome-initial-setup.c | 34 +++++++++++++++++++++++
|
2019-04-06 12:25:57 +00:00
|
|
|
meson.build | 2 ++
|
|
|
|
2 files changed, 36 insertions(+)
|
2017-01-31 12:24:20 +00:00
|
|
|
|
|
|
|
diff --git a/gnome-initial-setup/gnome-initial-setup.c b/gnome-initial-setup/gnome-initial-setup.c
|
2019-04-06 12:25:57 +00:00
|
|
|
index e2136de..280bd53 100644
|
2017-01-31 12:24:20 +00:00
|
|
|
--- a/gnome-initial-setup/gnome-initial-setup.c
|
|
|
|
+++ b/gnome-initial-setup/gnome-initial-setup.c
|
2019-04-06 12:25:57 +00:00
|
|
|
@@ -246,6 +246,31 @@ get_mode (void)
|
2017-01-31 12:24:20 +00:00
|
|
|
return GIS_DRIVER_MODE_NEW_USER;
|
|
|
|
}
|
|
|
|
|
|
|
|
+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;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
int
|
|
|
|
main (int argc, char *argv[])
|
|
|
|
{
|
2019-04-06 12:25:57 +00:00
|
|
|
@@ -280,6 +305,15 @@ main (int argc, char *argv[])
|
2018-09-07 16:36:56 +00:00
|
|
|
skipped_pages = g_ptr_array_new_with_free_func ((GDestroyNotify) gtk_widget_destroy);
|
2017-01-31 12:24:20 +00:00
|
|
|
mode = get_mode ();
|
|
|
|
|
|
|
|
+ /* We only do this in existing-user mode, because if gdm launches us
|
|
|
|
+ * in new-user mode and we just exit, gdm's special g-i-s session
|
|
|
|
+ * never terminates. */
|
|
|
|
+ if (initial_setup_disabled_by_anaconda () &&
|
|
|
|
+ mode == GIS_DRIVER_MODE_EXISTING_USER) {
|
|
|
|
+ gis_ensure_stamp_files ();
|
|
|
|
+ exit (EXIT_SUCCESS);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
/* When we are running as the gnome-initial-setup user we
|
|
|
|
* dont have a normal user session and need to initialize
|
|
|
|
* the keyring manually so that we can pass the credentials
|
2019-04-04 15:20:06 +00:00
|
|
|
diff --git a/meson.build b/meson.build
|
2019-04-06 12:25:57 +00:00
|
|
|
index 7b41505..8bf84db 100644
|
2019-04-04 15:20:06 +00:00
|
|
|
--- a/meson.build
|
|
|
|
+++ b/meson.build
|
2019-04-06 12:25:57 +00:00
|
|
|
@@ -11,6 +11,7 @@ i18n = import('i18n')
|
|
|
|
|
2019-04-04 15:20:06 +00:00
|
|
|
prefix = get_option('prefix')
|
|
|
|
po_dir = join_paths(meson.source_root(), 'po')
|
|
|
|
+sysconf_dir = join_paths(prefix, get_option('sysconfdir'))
|
|
|
|
data_dir = join_paths(prefix, get_option('datadir'))
|
|
|
|
locale_dir = join_paths(prefix, get_option('localedir'))
|
|
|
|
libexec_dir = join_paths(prefix, get_option('libexecdir'))
|
2019-04-06 12:25:57 +00:00
|
|
|
@@ -27,6 +28,7 @@ conf.set_quoted('VENDOR_CONF_FILE', vendor_conf_file)
|
2019-04-04 15:20:06 +00:00
|
|
|
conf.set_quoted('GETTEXT_PACKAGE', meson.project_name())
|
|
|
|
conf.set_quoted('GNOMELOCALEDIR', locale_dir)
|
|
|
|
conf.set_quoted('PKGDATADIR', pkgdata_dir)
|
|
|
|
+conf.set_quoted('SYSCONFDIR', sysconf_dir)
|
|
|
|
conf.set('ENABLE_REGION_PAGE', get_option('region-page'))
|
|
|
|
conf.set('SECRET_API_SUBJECT_TO_CHANGE', true)
|
2019-04-06 12:25:57 +00:00
|
|
|
|
|
|
|
--
|
|
|
|
2.21.0
|
2019-04-04 15:20:06 +00:00
|
|
|
|