From 3096ed862717103e87b78afd94e92dc461e30509 Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Mon, 5 Nov 2018 08:42:12 -0800 Subject: launch-environment: Read XDG_DATA_DIRS from env.d for initial-setup In the initial setup session we may need to run a Flatpak application; Flatpak requires XDG_DATA_DIRS to include its locations to work correctly, but that's not set at the moment for the initial-setup session. This commit borrows the code from GdmSessionWorker to read XDG_DATA_DIRS from gdm's env.d machinery for the initial-setup session as well. --- common/gdm-common.c | 15 +++++++++++---- common/gdm-common.h | 1 + 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'common') diff --git a/common/gdm-common.c b/common/gdm-common.c index 6ba3c595..92029027 100644 --- a/common/gdm-common.c +++ b/common/gdm-common.c @@ -960,12 +960,14 @@ gdm_find_display_session (GPid pid, static void load_env_file (GFile *file, GdmLoadEnvVarFunc load_env_func, + GdmExpandVarFunc expand_func, gpointer user_data) { gchar *contents; gchar **lines; gchar *line, *p; gchar *var, *var_end; + gchar *expanded; char *filename; int i; @@ -998,7 +1000,10 @@ load_env_file (GFile *file, while (g_ascii_isspace (*p)) p++; - load_env_func (var, p, user_data); + expanded = gdm_shell_expand (p, expand_func, user_data); + expanded = g_strchomp (expanded); + load_env_func (var, expanded, user_data); + g_free (expanded); } g_strfreev (lines); } @@ -1014,6 +1019,7 @@ compare_str (gconstpointer a, static void gdm_load_env_dir (GFile *dir, GdmLoadEnvVarFunc load_env_func, + GdmExpandVarFunc expand_func, gpointer user_data) { GFileInfo *info = NULL; @@ -1049,7 +1055,7 @@ gdm_load_env_dir (GFile *dir, for (i = 0; i < names->len; i++) { name = g_ptr_array_index (names, i); file = g_file_get_child (dir, name); - load_env_file (file, load_env_func, user_data); + load_env_file (file, load_env_func, expand_func, user_data); g_object_unref (file); } @@ -1060,15 +1066,16 @@ gdm_load_env_dir (GFile *dir, void gdm_load_env_d (GdmLoadEnvVarFunc load_env_func, + GdmExpandVarFunc expand_func, gpointer user_data) { GFile *dir; dir = g_file_new_for_path (DATADIR "/gdm/env.d"); - gdm_load_env_dir (dir, load_env_func, user_data); + gdm_load_env_dir (dir, load_env_func, expand_func, user_data); g_object_unref (dir); dir = g_file_new_for_path (GDMCONFDIR "/env.d"); - gdm_load_env_dir (dir, load_env_func, user_data); + gdm_load_env_dir (dir, load_env_func, expand_func, user_data); g_object_unref (dir); } diff --git a/common/gdm-common.h b/common/gdm-common.h index 6f047603..c42f556a 100644 --- a/common/gdm-common.h +++ b/common/gdm-common.h @@ -92,6 +92,7 @@ gboolean gdm_activate_session_by_id (GDBusConnection *connection, const char *session_id); void gdm_load_env_d (GdmLoadEnvVarFunc load_env_func, + GdmExpandVarFunc expand_func, gpointer user_data); G_END_DECLS -- cgit v1.2.1