Signed-off-by: Clemens Gruber <clemens.gru...@pqgruber.com>
---
 rules/rrdtool.in   | 12 ++++++++++++
 rules/rrdtool.make | 11 ++++++++++-
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/rules/rrdtool.in b/rules/rrdtool.in
index fa7e1de1c..fb91a8b84 100644
--- a/rules/rrdtool.in
+++ b/rules/rrdtool.in
@@ -34,6 +34,18 @@ config RRDTOOL_RRDCACHED
          accumulates them and, if enough have been received or a defined
          time has passed, writes the updates to the RRD file.
 
+if RRDTOOL_RRDCACHED
+
+config RRDTOOL_RRDCACHED_SYSTEMD_UNIT
+       bool
+       default y
+       depends on SYSTEMD
+       prompt "install rrdcached systemd unit"
+       help
+         Install and enable a systemd socket-activated service
+
+endif
+
 config RRDTOOL_RRDCGI
        bool
        depends on RRDTOOL_RRD_GRAPH
diff --git a/rules/rrdtool.make b/rules/rrdtool.make
index 2c7453811..59e0f6b14 100644
--- a/rules/rrdtool.make
+++ b/rules/rrdtool.make
@@ -61,7 +61,8 @@ RRDTOOL_CONF_OPT      := \
        --disable-tcl \
        --disable-python \
        --without-libiconv-prefix \
-       --without-libintl-prefix
+       --without-libintl-prefix \
+       --with-systemdsystemunitdir=/usr/lib/systemd/system
 
 ifneq ($(call remove_quotes,$(PTXCONF_RRDTOOL_DEFAULT_FONT)),)
 RRDTOOL_CONF_OPT += --with-rrd-default-font=$(PTXCONF_RRDTOOL_DEFAULT_FONT)
@@ -82,6 +83,14 @@ $(STATEDIR)/rrdtool.targetinstall:
 
 ifdef PTXCONF_RRDTOOL_RRDCACHED
        @$(call install_copy, rrdtool, 0, 0, 0755, -, /usr/bin/rrdcached)
+ifdef PTXCONF_RRDTOOL_RRDCACHED_SYSTEMD_UNIT
+       @$(call install_alternative, rrdtool, 0, 0, 0644, \
+               /usr/lib/systemd/system/rrdcached.service)
+       @$(call install_alternative, rrdtool, 0, 0, 0644, \
+               /usr/lib/systemd/system/rrdcached.socket)
+       @$(call install_link, rrdtool, ../rrdcached.socket, \
+               /usr/lib/systemd/system/sockets.target.wants/rrdcached.socket)
+endif
 endif
 ifdef PTXCONF_RRDTOOL_RRDCGI
        @$(call install_copy, rrdtool, 0, 0, 0755, -, /usr/bin/rrdcgi)
-- 
2.12.2


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

Reply via email to