summaryrefslogtreecommitdiffstats
path: root/debian/rules
blob: 040eb35dcfb0ccfb4fa8e4b64659c720c4d438dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/make -f

# Find the arch we are building for, as this determines
# the location of plugins in /usr/lib
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
TOP = $(CURDIR)/debian/netdata
WEB = $(TOP)-data/usr/share/web/

export DH_VERBOSE = 1
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

export DEB_CFLAGS_MAINT_APPEND  = -Wall -O3
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

MULTIARCH_INSTALL = debian/netdata.postinst

EXISTING_LINKS = $(WEB)lib/bootstrap.min.js \
	$(WEB)fonts/glyphicons-halflings-regular.ttf \
	$(WEB)css/bootstrap-theme.min.css \
	$(WEB)css/bootstrap.min.css \
	$(WEB)lib/jquery-1.12.0.min.js \
	$(WEB)lib/d3.min.js \
	$(WEB)lib/raphael-min.js \
	$(WEB)fonts/FontAwesome.otf \
	$(WEB)fonts/fontawesome-webfont.ttf \
	$(WEB)css/font-awesome.min.css

%:
	# For jessie and beyond
	#
	dh $@ --with autoreconf,systemd

	# For wheezy or other non-systemd distributions use the following. You
	# should also see contrib/README.md which gives details of updates to
	# make to debian/control.
	#
	#dh $@ --with autoreconf

override_dh_auto_configure:
	dh_auto_configure -- --with-math

$(MULTIARCH_INSTALL): % : %.in
	sed 's/@DEB_HOST_MULTIARCH@/$(DEB_HOST_MULTIARCH)/g' $< > $@

override_dh_install: $(MULTIARCH_INSTALL)
	dh_install

	# Remove unneeded .keep files
	#
	find "$(TOP)" -name .keep -exec rm '{}' ';'
	rm -rf $(TOP)-data/usr/share/netdata/web/old

	rm -f $(EXISTING_LINKS)

	# Update postinst to set correct group for www files on installation.
	# Should probably be dpkg-statoverride really, but that gets *really*
	# messy. We also set all web files in /var as conffiles so an upgrade
	# doesn't splat them.
	#
	#for D in $$(find "$(TOP)/var/lib/netdata/www/" -maxdepth 1 -type f -printf '%f '); do \
	#	echo Updating postinst for $$D; \
	#	sed -i "s/^#PERMS#/chgrp netdata \/var\/lib\/netdata\/www\/$$D\n#PERMS#/g" \
	#		$(CURDIR)/debian/netdata.postinst; \
	#	echo "/var/lib/netdata/www/$$D" >> $(CURDIR)/debian/netdata.conffiles; \
	#done
	#sed -i "/^#PERMS#/d" $(CURDIR)/debian/netdata.postinst

override_dh_fixperms:
	dh_fixperms

	# apps.plugin should only be runnable by the netdata user. It will be
	# given extra capabilities in the postinst script.
	#
	chmod 0754 $(TOP)/usr/lib/$(DEB_HOST_MULTIARCH)/netdata/plugins.d/apps.plugin