File: rules

package info (click to toggle)
munin 2.0.63-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 7,008 kB
  • sloc: perl: 11,644; java: 1,924; sh: 1,619; makefile: 636; javascript: 365; python: 267
file content (129 lines) | stat: -rwxr-xr-x 5,854 bytes parent folder | download | duplicates (2)
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#! /usr/bin/make -f

# for DEB_VERSION_UPSTREAM
include /usr/share/dpkg/pkg-info.mk

export DH_VERBOSE=1
# Build.PL relies on the munin modules to be found locally
export PERL5LIB=.

MAKEOPTS = CONFIG=debian/Makefile.config INSTALL_PLUGINS="auto manual snmpauto contrib"

%:
	# --no-parallel was introduced with debhelper compat level 10
	# (else it would fail to build) - this will probably also
	# "fix"  #839233
	dh $@ --no-parallel

override_dh_auto_build:
	# ./getversion reads RELEASE if it exists
	echo "$(DEB_VERSION_UPSTREAM)" >RELEASE
	dh_auto_build -- $(MAKEOPTS)

override_dh_auto_install:
	# Install the major munin parts into different packages
	$(MAKE) install-common-prime $(MAKEOPTS) \
		MANDIR=$(CURDIR)/debian/munin-doc/usr/share/man \
		DESTDIR=$(CURDIR)/debian/munin-common

	$(MAKE) install-async-prime $(MAKEOPTS) \
		MANDIR=$(CURDIR)/debian/munin-doc/usr/share/man \
		DESTDIR=$(CURDIR)/debian/munin-async

	$(MAKE) install-master-prime $(MAKEOPTS) \
		MANDIR=$(CURDIR)/debian/munin-doc/usr/share/man \
		DESTDIR=$(CURDIR)/debian/munin

	$(MAKE) install-node-prime $(MAKEOPTS) \
		MANDIR=$(CURDIR)/debian/munin-doc/usr/share/man \
		DESTDIR=$(CURDIR)/debian/munin-node
	# Do not install the program manpages in the munin-doc tree
	# Instead: remove them here and rely on dh_installman.
	# We cannot split the MANDIR target for manpages and module documentation. Thus the
	# separation has to be done manually.
	rm -f debian/munin-doc/usr/share/man/man1/munin-get.1p \
		debian/munin-doc/usr/share/man/man1/munin-node.1p \
		debian/munin-doc/usr/share/man/man1/munin-node-configure.1p \
		debian/munin-doc/usr/share/man/man1/munin-run.1p \
		debian/munin-doc/usr/share/man/man1/munindoc.1p
	rmdir debian/munin-doc/usr/share/man/man1
	# we do not expect other manpages in munin-doc (except for perl module documentation)
	[ -z "$(shell find debian/munin-doc/usr/share/man/ -type f | grep -v 'man3/')" ]

	$(MAKE) install-plugins-prime $(MAKEOPTS) \
		MANDIR=$(CURDIR)/debian/munin-doc/usr/share/man \
		DESTDIR=$(CURDIR)/debian/munin-plugins-core

	$(MAKE) install-plugins-java $(MAKEOPTS) \
		MANDIR=$(CURDIR)/debian/munin-doc/usr/share/man \
		DESTDIR=$(CURDIR)/debian/munin-plugins-java

	# Install apache 2.4 configuration
	install -D -m0644 debian/munin.apache24.conf \
		$(CURDIR)/debian/munin/etc/munin/apache24.conf

	# Remove default .htaccess file from installation, as we include it
	# in the default apache2/conf.d/munin configuration
	rm -v $(CURDIR)/debian/munin/var/cache/munin/www/.htaccess

	# Remove bundled VeraMono.ttf, debian gets this font from
	# the fonts-dejavu-core package. http://bugs.debian.org/548508
	rm -v $(CURDIR)/debian/munin/usr/share/munin/DejaVuSans*.ttf

	# Munin::Plugins & plugins.sh go into munin-common.
	# They are used for munin-plugins-* and we don't want a whole
	# dedicated new package (munin-plugins-common) for that. yet.
	for file in usr/share/perl5/Munin/Plugin.pm usr/share/munin/plugins/plugin.sh; do \
		mkdir -p $(CURDIR)/debian/munin-common/$$(dirname $$file) ;\
		mv $(CURDIR)/debian/munin-plugins-core/$$file \
			$(CURDIR)/debian/munin-common/$$file; \
	done

	# Install debian provided plugin configuration
	install -D -m0644 debian/plugins.conf \
		$(CURDIR)/debian/munin-node/etc/munin/plugin-conf.d/munin-node
	install -D -m0644 debian/plugins.README \
		$(CURDIR)/debian/munin-node/etc/munin/plugin-conf.d/README
	install -D -m0644 debian/plugins-spamstats.conf \
		$(CURDIR)/debian/munin-plugins-extra/etc/munin/plugin-conf.d/spamstats
	install -D -m0644 debian/plugins-dhcpd3.conf \
		$(CURDIR)/debian/munin-plugins-extra/etc/munin/plugin-conf.d/dhcpd3

	# Move plugins not marked "auto" "manual" or "snmpauto" to the
	# "munin-plugins-extra" package.
	mkdir -p $(CURDIR)/debian/munin-plugins-extra/usr/share/munin/plugins
	for file in $$(find debian/munin-plugins-core/usr/share/munin/plugins -type f \
		-not -name plugins.history -and -not -name plugins.sh); do \
		if ! grep -q "#%# family=\(auto\|manual\|snmpauto\)" $$file ; then \
			mv -v $$file $(CURDIR)/debian/munin-plugins-extra/usr/share/munin/plugins; \
		fi; \
	done

	# The upstream Makefile creates /var/lib/munin-async (also known as "SPOOLDIR") during
	# "make install-pre" (referenced by "install-master-prime" and "install-node-prime").
	# This directory is used by the package "munin-async" as the home directory for the
	# "munin-async" user. Thus it should not really exist before the installation of that
	# package. Otherwise a warning is emitted when the user is created.
	# But since "munin-sched" (being part of the "munin-node" package) requires the SPOOLDIR to
	# exist, this directory needs to be shipped with "munin-node". Since "munin-async" depends
	# on "munin-node", the above warning caused by munin-async's postinst script is inevitable
	# under the current circumstances.
	# TODO: "munin-sched" was removed by upstream. Maybe the above complexity can be reduced.
	# Thus we can remove the directory from the package "munin", but we need to continue
	# shipping it as part of "munin-node" in order to ensure that "munin-sched" works.
	# The warning "directory already exists" in munin-async's postinst script is annoying, but
	# can be safely ignored.
	# Hint: munin-sched's use-case is quite exotic and the program is removed for munin 3.0.
	# Thus there does not seem to be real need to fix this mess.
	rmdir $(CURDIR)/debian/munin/var/lib/munin-async

	rmdir $(CURDIR)/debian/munin/var/run/munin
	rmdir $(CURDIR)/debian/munin/var/run
	rmdir $(CURDIR)/debian/munin-node/var/run/munin
	rmdir $(CURDIR)/debian/munin-node/var/run

# "make clean" is being clever. Work around that. ;)
override_dh_auto_clean:
	dh_auto_clean -- $(MAKEOPTS) clean-node clean-master clean-plugins clean-common clean
	find plugins/javalib -name '*.class' -print0 | xargs -0 -r rm -v
	rm RELEASE -f