97e186
From 4bfa45f56e1500f1cfc8de3fd8d1228b11011e95 Mon Sep 17 00:00:00 2001
97e186
From: Jakub Filak <jfilak@redhat.com>
97e186
Date: Fri, 21 Feb 2014 15:54:09 +0100
97e186
Subject: [PATCH 28/32] Make paths in the systemd services configurable
97e186
97e186
The path to a binary depends on configuration, therefore it is better to
97e186
not use hard coded strings.
97e186
97e186
Signed-off-by: Jakub Filak <jfilak@redhat.com>
97e186
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
97e186
---
97e186
 Makefile.am                |   15 ++++++++++++++-
97e186
 misc/ras-mc-ctl.service    |   10 ----------
97e186
 misc/ras-mc-ctl.service.in |   10 ++++++++++
97e186
 misc/rasdaemon.service     |   10 ----------
97e186
 misc/rasdaemon.service.in  |   10 ++++++++++
97e186
 5 files changed, 34 insertions(+), 21 deletions(-)
97e186
 delete mode 100644 misc/ras-mc-ctl.service
97e186
 create mode 100644 misc/ras-mc-ctl.service.in
97e186
 delete mode 100644 misc/rasdaemon.service
97e186
 create mode 100644 misc/rasdaemon.service.in
97e186
97e186
diff --git a/Makefile.am b/Makefile.am
97e186
index c1668b4..0fa615f 100644
97e186
--- a/Makefile.am
97e186
+++ b/Makefile.am
97e186
@@ -1,6 +1,19 @@
97e186
 ACLOCAL_AMFLAGS=-I m4
97e186
 SUBDIRS = libtrace util man
97e186
-EXTRA_DIST = misc/rasdaemon.service misc/ras-mc-ctl.service
97e186
+SYSTEMD_SERVICES_IN = misc/rasdaemon.service.in misc/ras-mc-ctl.service.in
97e186
+SYSTEMD_SERVICES = $(SYSTEMD_SERVICES_IN:.service.in=.service)
97e186
+EXTRA_DIST = $(SYSTEMD_SERVICES_IN)
97e186
+
97e186
+# This rule is needed because \@sbindir\@ is expanded to \${exec_prefix\}/sbin
97e186
+# during ./configure phase, therefore it is not possible to add .service.in
97e186
+# files to AC_CONFIG_FILES in configure.ac
97e186
+SUFFIXES = .service.in .service
97e186
+.service.in.service:
97e186
+	sed -e s,\@sbindir\@,$(sbindir),g $< > $@
97e186
+
97e186
+# This rule is needed because the service files must be generated on target
97e186
+# system after ./configure phase
97e186
+all-local: $(SYSTEMD_SERVICES)
97e186
 
97e186
 sbin_PROGRAMS = rasdaemon
97e186
 rasdaemon_SOURCES = rasdaemon.c ras-events.c ras-mc-handler.c \
97e186
diff --git a/misc/ras-mc-ctl.service b/misc/ras-mc-ctl.service
97e186
deleted file mode 100644
97e186
index 8a09508..0000000
97e186
--- a/misc/ras-mc-ctl.service
97e186
+++ /dev/null
97e186
@@ -1,10 +0,0 @@
97e186
-[Unit]
97e186
-Description=Initialize EDAC v3.0.0 Drivers For Machine Hardware
97e186
-
97e186
-[Service]
97e186
-Type=oneshot
97e186
-ExecStart=/usr/sbin/ras-mc-ctl --register-labels
97e186
-RemainAfterExit=yes
97e186
-
97e186
-[Install]
97e186
-WantedBy=multi-user.target
97e186
diff --git a/misc/ras-mc-ctl.service.in b/misc/ras-mc-ctl.service.in
97e186
new file mode 100644
97e186
index 0000000..8cb3651
97e186
--- /dev/null
97e186
+++ b/misc/ras-mc-ctl.service.in
97e186
@@ -0,0 +1,10 @@
97e186
+[Unit]
97e186
+Description=Initialize EDAC v3.0.0 Drivers For Machine Hardware
97e186
+
97e186
+[Service]
97e186
+Type=oneshot
97e186
+ExecStart=@sbindir@/ras-mc-ctl --register-labels
97e186
+RemainAfterExit=yes
97e186
+
97e186
+[Install]
97e186
+WantedBy=multi-user.target
97e186
diff --git a/misc/rasdaemon.service b/misc/rasdaemon.service
97e186
deleted file mode 100644
97e186
index 36cdef5..0000000
97e186
--- a/misc/rasdaemon.service
97e186
+++ /dev/null
97e186
@@ -1,10 +0,0 @@
97e186
-[Unit]
97e186
-Description=RAS daemon to log the RAS events
97e186
-After=syslog.target
97e186
-
97e186
-[Service]
97e186
-ExecStart=/usr/local/sbin/rasdaemon -f
97e186
-Restart=on-abort
97e186
-
97e186
-[Install]
97e186
-WantedBy=multi-user.target
97e186
diff --git a/misc/rasdaemon.service.in b/misc/rasdaemon.service.in
97e186
new file mode 100644
97e186
index 0000000..5e1f375
97e186
--- /dev/null
97e186
+++ b/misc/rasdaemon.service.in
97e186
@@ -0,0 +1,10 @@
97e186
+[Unit]
97e186
+Description=RAS daemon to log the RAS events
97e186
+After=syslog.target
97e186
+
97e186
+[Service]
97e186
+ExecStart=@sbindir@/rasdaemon -f
97e186
+Restart=on-abort
97e186
+
97e186
+[Install]
97e186
+WantedBy=multi-user.target
97e186
-- 
97e186
1.7.1
97e186