3 # Find the arch we are building for, as this determines
4 # the location of plugins in /usr/lib
5 DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
6 TOP = $(CURDIR)/debian/netdata
9 # For jessie and beyond
11 dh $@ --with autoreconf,systemd
13 # For wheezy or other non-systemd distributions use the following. You
14 # should also see contrib/README.md which gives details of updates to
15 # make to debian/control.
17 #dh $@ --with autoreconf
19 override_dh_auto_configure:
20 dh_auto_configure -- --with-math --with-webdir=/var/lib/netdata/www
22 debian/%.postinst: debian/%.postinst.in
23 sed 's/@DEB_HOST_MULTIARCH@/$(DEB_HOST_MULTIARCH)/g' $< > $@
25 override_dh_install: debian/netdata.postinst
28 # Remove unneeded .keep files
30 find "$(TOP)" -name .keep -exec rm '{}' ';'
32 # Move files that local user shouldn't be editing to /usr/share/netdata
34 mkdir -p "$(TOP)/usr/share/netdata"
35 for D in $$(find "$(TOP)/var/lib/netdata/www/" -maxdepth 1 -type d -printf '%f '); do \
36 echo Relocating $$D; \
37 mv "$(TOP)/var/lib/netdata/www/$$D" "$(TOP)/usr/share/netdata/$$D"; \
38 ln -s "/usr/share/netdata/$$D" "$(TOP)/var/lib/netdata/www/$$D"; \
41 # Update postinst to set correct group for www files on installation.
42 # Should probably be dpkg-statoverride really, but that gets *really*
43 # messy. We also set all web files in /var as conffiles so an upgrade
46 for D in $$(find "$(TOP)/var/lib/netdata/www/" -maxdepth 1 -type f -printf '%f '); do \
47 echo Updating postinst for $$D; \
48 sed -i "s/^#PERMS#/chgrp netdata \/var\/lib\/netdata\/www\/$$D\n#PERMS#/g" \
49 $(CURDIR)/debian/netdata.postinst; \
50 echo "/var/lib/netdata/www/$$D" >> $(CURDIR)/debian/netdata.conffiles; \
52 sed -i "/^#PERMS#/d" $(CURDIR)/debian/netdata.postinst
54 override_dh_installdocs:
57 # Docs should not be under /usr/lib
59 mv $(TOP)/usr/lib/$(DEB_HOST_MULTIARCH)/netdata/plugins.d/README.md \
60 $(TOP)/usr/share/doc/netdata/README.plugins.md
61 mv $(TOP)/usr/lib/$(DEB_HOST_MULTIARCH)/netdata/charts.d/README.md \
62 $(TOP)/usr/share/doc/netdata/README.charts.md
64 # This doc is currently empty, so no point installing it.
66 rm $(TOP)/usr/lib/$(DEB_HOST_MULTIARCH)/netdata/node.d/README.md
71 # apps.plugin should only be runnable by the netdata user. It will be
72 # given extra capabilities in the postinst script.
74 chmod 0754 $(TOP)/usr/lib/$(DEB_HOST_MULTIARCH)/netdata/plugins.d/apps.plugin
76 override_dh_installlogrotate:
77 cp system/netdata.logrotate debian/netdata.logrotate
83 # Tidy up copied/generated files
85 -[ -r $(CURDIR)/debian/netdata.logrotate ] && rm $(CURDIR)/debian/netdata.logrotate
86 -[ -r $(CURDIR)/debian/netdata.postinst ] && rm $(CURDIR)/debian/netdata.postinst
87 -[ -r $(CURDIR)/debian/netdata.conffiles ] && rm $(CURDIR)/debian/netdata.conffiles