summaryrefslogtreecommitdiffstats
path: root/contrib/debian/rules
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/debian/rules')
-rwxr-xr-xcontrib/debian/rules19
1 files changed, 19 insertions, 0 deletions
diff --git a/contrib/debian/rules b/contrib/debian/rules
index 09883140d3..bd545b698e 100755
--- a/contrib/debian/rules
+++ b/contrib/debian/rules
@@ -6,6 +6,16 @@ DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
TOP = $(CURDIR)/debian/netdata
TEMPTOP = $(CURDIR)/debian/tmp
+BASE_CONFIG = system/netdata.conf
+
+SYSTEMD_VERSION = $(shell /bin/sh -c "systemd --version 2>&1 | head -n 1 | cut -f 2 -d ' '")
+
+ifeq ($(shell test $(SYSTEMD_VERSION) -ge 235 && echo "1"), 1)
+SYSTEMD_UNIT = system/netdata.service.v235
+else
+SYSTEMD_UNIT = system/netdata.service
+endif
+
%:
# For jessie and beyond
#
@@ -17,6 +27,13 @@ TEMPTOP = $(CURDIR)/debian/tmp
#
#dh $@ --with autoreconf
+override_dh_installinit:
+ echo "SystemD Version: $(SYSTEMD_VERSION)"
+ echo "Using SystemD Unit: $(SYSTEMD_UNIT)"
+ cp -v $(SYSTEMD_UNIT) debian/netdata.service
+
+ dh_installinit
+
override_dh_auto_configure:
packaging/bundle-mosquitto.sh .
packaging/bundle-lws.sh .
@@ -28,6 +45,8 @@ debian/%.postinst: debian/%.postinst.in
sed 's/@DEB_HOST_MULTIARCH@/$(DEB_HOST_MULTIARCH)/g' $< > $@
override_dh_install: debian/netdata.postinst
+ cp -v $(BASE_CONFIG) debian/netdata.conf
+
dh_install
# Set the CUPS plugin install rule