Blame SOURCES/0001-ledmon_paths_in_systemd_service_file_are_generated.patch

9369b9
commit 13040e80dec77d7c9e9e3636f2068fce9e056dc2
9369b9
Author: Krzysztof Smolinski <krzysztof.smolinski@intel.com>
9369b9
Date:   Sun Nov 10 18:58:01 2019 +0100
9369b9
9369b9
    ledmon: paths in systemd service file are generated
9369b9
    
9369b9
    Ledmon service file contained hardcoded path to ledmon executable.
9369b9
    This patch places correct installation path of ledmon in systemd
9369b9
    service file.
9369b9
    
9369b9
    Signed-off-by: Krzysztof Smolinski <krzysztof.smolinski@intel.com>
9369b9
9369b9
diff --git a/Makefile.am b/Makefile.am
9369b9
index 0bfc188..63bf8a3 100644
9369b9
--- a/Makefile.am
9369b9
+++ b/Makefile.am
9369b9
@@ -21,5 +21,5 @@ if SYSTEMD_CONDITION
9369b9
 endif
9369b9
 
9369b9
 SUBDIRS = doc src $(OPTIONAL_SUBDIR)
9369b9
-EXTRA_DIST = config/config.h systemd/ledmon.service
9369b9
+EXTRA_DIST = config/config.h systemd/ledmon.service.in
9369b9
 dist_doc_DATA = README
9369b9
diff --git a/systemd/Makefile.am b/systemd/Makefile.am
9369b9
index 4303628..962b122 100644
9369b9
--- a/systemd/Makefile.am
9369b9
+++ b/systemd/Makefile.am
9369b9
@@ -18,6 +18,12 @@
9369b9
 
9369b9
 # Installation directory of ledmon systemd service unit.
9369b9
 systemddir = @SYSTEMD_PATH@
9369b9
+SED = sed
9369b9
+
9369b9
+CLEANFILES = ledmon.service ledmon.service.tmp
9369b9
 
9369b9
 systemd_DATA = ledmon.service
9369b9
 
9369b9
+ledmon.service : ledmon.service.in
9369b9
+	$(SED) -e 's|@sbindir[@]|$(sbindir)|g' < $< > $@.tmp
9369b9
+	mv $@.tmp $@
9369b9
diff --git a/systemd/ledmon.service b/systemd/ledmon.service.in
9369b9
similarity index 76%
9369b9
rename from systemd/ledmon.service
9369b9
rename to systemd/ledmon.service.in
9369b9
index d2fa08c..059fd95 100644
9369b9
--- a/systemd/ledmon.service
9369b9
+++ b/systemd/ledmon.service.in
9369b9
@@ -7,5 +7,5 @@ WantedBy=multi-user.target
9369b9
 [Service]
9369b9
 Type=simple
9369b9
 User=root
9369b9
-ExecStart=/usr/sbin/ledmon --foreground
9369b9
+ExecStart=@sbindir@/ledmon --foreground
9369b9
 Restart=on-failure