File ledmon-paths-in-systemd-service-file-are-generated.patch of Package ledmon

From 13040e80dec77d7c9e9e3636f2068fce9e056dc2 Mon Sep 17 00:00:00 2001
From: Krzysztof Smolinski <krzysztof.smolinski@intel.com>
Date: Sun, 10 Nov 2019 18:58:01 +0100
Subject: [PATCH] ledmon: paths in systemd service file are generated

Ledmon service file contained hardcoded path to ledmon executable.
This patch places correct installation path of ledmon in systemd
service file.

Signed-off-by: Krzysztof Smolinski <krzysztof.smolinski@intel.com>
---
 Makefile.am                                   | 2 +-
 systemd/Makefile.am                           | 6 ++++++
 systemd/{ledmon.service => ledmon.service.in} | 2 +-
 3 files changed, 8 insertions(+), 2 deletions(-)
 rename systemd/{ledmon.service => ledmon.service.in} (76%)

diff --git a/Makefile.am b/Makefile.am
index 0bfc188..63bf8a3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -21,5 +21,5 @@ if SYSTEMD_CONDITION
 endif
 
 SUBDIRS = doc src $(OPTIONAL_SUBDIR)
-EXTRA_DIST = config/config.h systemd/ledmon.service
+EXTRA_DIST = config/config.h systemd/ledmon.service.in
 dist_doc_DATA = README
diff --git a/systemd/Makefile.am b/systemd/Makefile.am
index 4303628..962b122 100644
--- a/systemd/Makefile.am
+++ b/systemd/Makefile.am
@@ -18,6 +18,12 @@
 
 # Installation directory of ledmon systemd service unit.
 systemddir = @SYSTEMD_PATH@
+SED = sed
+
+CLEANFILES = ledmon.service ledmon.service.tmp
 
 systemd_DATA = ledmon.service
 
+ledmon.service : ledmon.service.in
+	$(SED) -e 's|@sbindir[@]|$(sbindir)|g' < $< > $@.tmp
+	mv $@.tmp $@
diff --git a/systemd/ledmon.service b/systemd/ledmon.service.in
similarity index 76%
rename from systemd/ledmon.service
rename to systemd/ledmon.service.in
index d2fa08c..059fd95 100644
--- a/systemd/ledmon.service
+++ b/systemd/ledmon.service.in
@@ -7,5 +7,5 @@ WantedBy=multi-user.target
 [Service]
 Type=simple
 User=root
-ExecStart=/usr/sbin/ledmon --foreground
+ExecStart=@sbindir@/ledmon --foreground
 Restart=on-failure
-- 
2.24.0

openSUSE Build Service is sponsored by