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



commit 7dbce5b80bfaf9e8b83a418cd10e6facdcc8fd7a
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 | 28 +++++++++++++++++-----------
 1 file changed, 17 insertions(+), 11 deletions(-)
---
diff --git a/gnome-session/main.c b/gnome-session/main.c
index 6112655c..1de0db50 100644
--- a/gnome-session/main.c
+++ b/gnome-session/main.c
@@ -492,6 +492,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);
 
 #ifdef HAVE_SYSTEMD
@@ -522,17 +539,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);
-        }
-
-        session_name = opt_session_name;
-
         /* 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]