krishnanadh / rpms / rasdaemon

Forked from rpms/rasdaemon a year ago
Clone

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

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