Blob Blame History Raw
commit 13040e80dec77d7c9e9e3636f2068fce9e056dc2
Author: Krzysztof Smolinski <krzysztof.smolinski@intel.com>
Date:   Sun Nov 10 18:58:01 2019 +0100

    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>

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