[PATCH xdm] Support installing systemd unit file.

Michał Górny mgorny at gentoo.org
Wed Jun 15 04:59:43 PDT 2011


Signed-off-by: Michał Górny <mgorny at gentoo.org>
Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=38339
---
 Makefile.am     |   10 ++++++++++
 configure.ac    |   12 ++++++++++++
 xdm at .service.in |   10 ++++++++++
 3 files changed, 32 insertions(+), 0 deletions(-)
 create mode 100644 xdm at .service.in

diff --git a/Makefile.am b/Makefile.am
index 0bd7ca9..3bab800 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -38,6 +38,16 @@ lint:
 	(cd chooser && $(MAKE) $(AM_MAKEFLAGS) lint)
 endif LINT
 
+if HAVE_SYSTEMD
+systemdsystemunit_DATA = xdm at .service
+
+xdm at .service: xdm at .service.in
+	$(AM_V_GEN)$(SED) -e 's|BINDIR|$(bindir)|g' < $< > $@
+
+MOSTLYCLEANFILES = xdm at .service
+endif HAVE_SYSTEMD
+EXTRA_DIST = xdm at .service.in
+
 MAINTAINERCLEANFILES = ChangeLog INSTALL
 
 .PHONY: ChangeLog INSTALL
diff --git a/configure.ac b/configure.ac
index 0c79999..1443d9e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -145,6 +145,18 @@ if test "x$USE_SELINUX" != "xno" ; then
     )
 fi
 
+# Check whether to install systemd unit files, as suggest in daemon(7).
+AC_ARG_WITH([systemdsystemunitdir],
+	AS_HELP_STRING([--with-systemdsystemunitdir=DIR],
+		[Directory for systemd service files]),
+	[],
+	[with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)]
+)
+if test "x$with_systemdsystemunitdir" != "xno" ; then
+	AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
+fi
+AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ])
+
 # FIXME: Find better test for which OS'es use su -m  - for now, just try to
 # mirror the Imakefile setting of:
 # if  defined(OpenBSDArchitecture) || defined(NetBSDArchitecture) || defined(FreeBSDArchitecture) || defined(DarwinArchitecture)
diff --git a/xdm at .service.in b/xdm at .service.in
new file mode 100644
index 0000000..2e85c13
--- /dev/null
+++ b/xdm at .service.in
@@ -0,0 +1,10 @@
+[Unit]
+Description=X-Window Display Manager on %I
+Requires=dev-%i.device
+After=dev-%i.device systemd-user-sessions.service
+
+[Service]
+ExecStart=BINDIR/xdm -nodaemon
+
+[Install]
+Alias=graphical.target.wants/xdm at tty7.service
-- 
1.7.5.3



More information about the xorg-devel mailing list