krishnanadh / rpms / rasdaemon

Forked from rpms/rasdaemon a year ago
Clone

Blame SOURCES/0028-Make-paths-in-the-systemd-services-configurable.patch

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