[gdm/wip/laney/systemd-user] Add systemd units



commit 783f216744506b9fc9f276aca46772cbcb5869f5
Author: Iain Lane <iainl gnome org>
Date:   Wed Jul 4 16:57:26 2018 +0100

    Add systemd units
    
    This is so we can start g-s-d and Shell up under systemd --user for GDM

 configure.ac                    | 21 +++++++++++++++++++++
 data/Makefile.am                |  6 ++++++
 data/gnome-login-wayland.target |  8 ++++++++
 data/gnome-login.target         |  8 ++++++++
 4 files changed, 43 insertions(+)
---
diff --git a/configure.ac b/configure.ac
index 12d9331c..df598ee8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -254,10 +254,22 @@ AC_ARG_WITH(tcp-wrappers,
                            [Use TCP Wrappers @<:@default=auto@:>@]),,
             with_tcp_wrappers=auto)
 
+
 AC_ARG_WITH([udevdir],
             AS_HELP_STRING([--with-udevdir=DIR],
                            [Directory for udev files]),
                 [with_udevdir=$withval], [with_udevdir=$($PKG_CONFIG --variable=udevdir udev)])
+
+# It is correct for this to be in ${prefix}/lib, even on systems where that
+# does not match ${libdir}. This is what systemd uses on such platforms.
+AC_ARG_WITH([systemduserunitdir],
+            AS_HELP_STRING([--with-systemduserunitdir=PATH],
+                           [Directory for systemd user units]
+                           [[default=${prefix}/lib/systemd/user]]),
+                           [systemd_userdir="$withval"],
+                           [systemd_userdir='${prefix}/lib/systemd/user'])
+AC_SUBST([systemduserunitdir])
+
 AC_ARG_WITH([systemdsystemunitdir],
             AS_HELP_STRING([--with-systemdsystemunitdir=DIR],
                            [Directory for systemd service files]),
@@ -870,11 +882,19 @@ AC_PATH_PROG(SYSTEMD_X_SERVER, systemd-multi-seat-x, [/lib/systemd/systemd-multi
 AC_SUBST(SYSTEMD_X_SERVER)
 AC_DEFINE_UNQUOTED(SYSTEMD_X_SERVER,"$SYSTEMD_X_SERVER",[Path to systemd X server wrapper])
 
+
 if test "x$with_udevdir" != xno; then
         AC_SUBST(UDEV_DIR, [$with_udevdir])
 fi
 AM_CONDITIONAL(INSTALL_UDEV_RULES, test x$with_udevdir != xno)
 
+if test "x$with_systemduserunitdir" = xno; then
+        AC_MSG_ERROR([systemd --user support is required])
+else
+        AC_SUBST(SYSTEMD_USER_UNIT_DIR, [$with_systemduserunitdir])
+fi
+
+
 if test "x$with_systemdsystemunitdir" != xno; then
         AC_SUBST(SYSTEMD_SYSTEM_UNIT_DIR, [$with_systemdsystemunitdir])
 fi
@@ -1526,6 +1546,7 @@ echo \
         SELinux support:          ${use_selinux}
         systemd unit dir:         ${with_systemdsystemunitdir}
         udev dir:                 ${with_udevdir}
+        systemd user unit dir:    ${with_systemduserunitdir}
         plymouth support:         ${use_plymouth}
         wayland support:          ${enable_wayland_support}
         Build with RBAC:          ${msg_rbac_shutdown}
diff --git a/data/Makefile.am b/data/Makefile.am
index 162074f1..2e4c593a 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -217,6 +217,12 @@ systemdsystemunit_DATA=$(systemdsystemunit)
 systemdsystemunitdir=$(SYSTEMD_SYSTEM_UNIT_DIR)
 endif
 
+systemduserunit = gnome-login.target gnome-login-wayland.target
+systemduserunit_DATA=$(systemduserunit)
+systemduserunitdir=$(SYSTEMD_USER_UNIT_DIR)
+
+EXTRA_DIST += gnome-login.target gnome-login-wayland.target
+
 Xsession_files =
 if ENABLE_GDM_XSESSION
 
diff --git a/data/gnome-login-wayland.target b/data/gnome-login-wayland.target
new file mode 100644
index 00000000..d4d4e57f
--- /dev/null
+++ b/data/gnome-login-wayland.target
@@ -0,0 +1,8 @@
+[Unit]
+Description=User systemd services for the GDM graphical session (wayland)
+Requires=graphical-session-pre.target
+# start/tear down graphical session target along with our session
+BindsTo=graphical-session.target
+# session leader -- if this dies, die along with it
+BindsTo=gnome-session@gnome-login.service
+Wants=gnome-shell-wayland.target gnome-settings-daemon-gdm-wayland.target
diff --git a/data/gnome-login.target b/data/gnome-login.target
new file mode 100644
index 00000000..36ff39d9
--- /dev/null
+++ b/data/gnome-login.target
@@ -0,0 +1,8 @@
+[Unit]
+Description=User systemd services for the GDM graphical session (x11)
+Requires=graphical-session-pre.target
+# start/tear down graphical session target along with our session
+BindsTo=graphical-session.target
+# session leader -- if this dies, die along with it
+BindsTo=gnome-session@gnome-login.service
+Wants=gnome-shell-x11.target gnome-settings-daemon-gdm-x11.target


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