summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorCosimo Cecchi <cosimo@endlessm.com>2018-11-05 08:42:12 -0800
committerRay Strode <halfline@gmail.com>2021-07-09 17:03:59 +0000
commit3096ed862717103e87b78afd94e92dc461e30509 (patch)
tree91e4d06f748d35b149b15cffb07ce3c1bcb52a6b /common
parent48d92c7e9ae12fd203d1ac120467bf2b9c934331 (diff)
downloadgdm-3096ed862717103e87b78afd94e92dc461e30509.tar.gz
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.
Diffstat (limited to 'common')
-rw-r--r--common/gdm-common.c15
-rw-r--r--common/gdm-common.h1
2 files changed, 12 insertions, 4 deletions
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