From 856e442af8f03168b6a8425fcb06bb685c663af8 Mon Sep 17 00:00:00 2001
From: Eric Koegel <eric.koegel@gmail.com>
Date: Mon, 10 Nov 2014 11:58:36 +0300
Subject: [PATCH 02/12] Conditionally add the SystemdService

Add the SystemdService service tag to the consolekit service file
if we're being built with systemd support.
---
 data/Makefile.am                           | 17 ++++++++++++-----
 data/org.freedesktop.ConsoleKit.service.in |  2 +-
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/data/Makefile.am b/data/Makefile.am
index 38876d5..acb381f 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -24,6 +24,12 @@ service_DATA = $(service_in_files:.service.in=.service)
 $(service_DATA): $(service_in_files) Makefile
 	$(edit) $< >$@
 
+edit = sed \
+	-e 's|@sbindir[@]|$(sbindir)|g' \
+	-e 's|@sysconfdir[@]|$(sysconfdir)|g' \
+	-e 's|@localstatedir[@]|$(localstatedir)|g' \
+	-e 's|@CONSOLE_KIT_PID_FILE[@]|$(CONSOLE_KIT_PID_FILE)|g'
+
 if HAVE_SYSTEMD
 systemdsystemunit_DATA = \
 	console-kit-daemon.service \
@@ -65,13 +71,14 @@ install-data-hook:
 	( cd $(DESTDIR)$(systemdsystemunitdir)/kexec.target.wants && \
 		rm -f console-kit-log-system-restart.service && \
 		$(LN_S) ../console-kit-log-system-restart.service )
+
+edit += \
+	-e 's|@SystemdService[@]|SystemdService=console-kit-daemon.service|g'
+else
+edit += \
+	-e 's|@SystemdService[@]||g'
 endif
 
-edit = sed \
-	-e 's|@sbindir[@]|$(sbindir)|g' \
-	-e 's|@sysconfdir[@]|$(sysconfdir)|g' \
-	-e 's|@localstatedir[@]|$(localstatedir)|g' \
-	-e 's|@CONSOLE_KIT_PID_FILE[@]|$(CONSOLE_KIT_PID_FILE)|g'
 
 install-xinitrc:
 	$(INSTALL_PROGRAM) 90-consolekit $(xinitrcdir) && \
diff --git a/data/org.freedesktop.ConsoleKit.service.in b/data/org.freedesktop.ConsoleKit.service.in
index 5e35ebb..f5f55dc 100644
--- a/data/org.freedesktop.ConsoleKit.service.in
+++ b/data/org.freedesktop.ConsoleKit.service.in
@@ -2,4 +2,4 @@
 Name=org.freedesktop.ConsoleKit
 Exec=@sbindir@/console-kit-daemon --no-daemon
 User=root
-SystemdService=console-kit-daemon.service
+@SystemdService@
-- 
2.2.1

