[gnome-session/wip/benzea/systemd-user-switch: 7/7] main: Export autostart dir into environment



commit 6f69bf5f6622683f5b54888d0157e379f1910d11
Author: Benjamin Berg <bberg redhat com>
Date:   Wed Apr 24 15:00:20 2019 +0200

    main: Export autostart dir into environment
    
    The autostart directory that was overriden by GDM needs to be passed to
    the systemd service via environment. Export the parameter when needed so
    that this will work properly.

 gnome-session/main.c | 26 +++++++++++++++++---------
 1 file changed, 17 insertions(+), 9 deletions(-)
---
diff --git a/gnome-session/main.c b/gnome-session/main.c
index f5c40282..a635424a 100644
--- a/gnome-session/main.c
+++ b/gnome-session/main.c
@@ -499,6 +499,23 @@ main (int argc, char **argv)
                 exit (1);
         }
 
+        env_override_autostart_dirs = g_getenv ("GNOME_SESSION_AUTOSTART_DIR");
+
+        if (env_override_autostart_dirs != NULL && env_override_autostart_dirs[0] != '\0') {
+                env_override_autostart_dirs_v = g_strsplit (env_override_autostart_dirs, ":", 0);
+                gsm_util_set_autostart_dirs (env_override_autostart_dirs_v);
+        } else {
+                gsm_util_set_autostart_dirs (override_autostart_dirs);
+
+                /* Export the override autostart dirs parameter to the environment
+                 * in case we are running on systemd. */
+                if (override_autostart_dirs) {
+                        g_autofree char *autostart_dirs = NULL;
+                        autostart_dirs = g_strjoinv (":", override_autostart_dirs);
+                        g_setenv ("GNOME_SESSION_AUTOSTART_DIR", autostart_dirs, TRUE);
+                }
+        }
+
         gsm_util_export_activation_environment (NULL);
 
         session_name = opt_session_name;
@@ -553,15 +570,6 @@ main (int argc, char **argv)
          */
         gsm_util_setenv ("XDG_MENU_PREFIX", "gnome-");
 
-        env_override_autostart_dirs = g_getenv ("GNOME_SESSION_AUTOSTART_DIR");
-
-        if (env_override_autostart_dirs != NULL && env_override_autostart_dirs[0] != '\0') {
-                env_override_autostart_dirs_v = g_strsplit (env_override_autostart_dirs, ":", 0);
-                gsm_util_set_autostart_dirs (env_override_autostart_dirs_v);
-        } else {
-                gsm_util_set_autostart_dirs (override_autostart_dirs);
-        }
-
         /* Talk to logind before acquiring a name, since it does synchronous
          * calls at initialization time that invoke a main loop and if we
          * already owned a name, then we would service too early during


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]