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



commit add16b5b4beead583c9b426529344979c32ce0db
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 cc271bf8..66f9bf5c 100644
--- a/gnome-session/main.c
+++ b/gnome-session/main.c
@@ -479,6 +479,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;
@@ -533,15 +550,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]