1 #!/usr/bin/make -f
2 # debian/rules for PNP4Nagios
3 #
4 # Written by Sven Velt <sven@velt.de> and Sebastian Harl <tokkee@debian.org>.
6 include /usr/share/quilt/quilt.make
8 # Uncomment this to turn on verbose mode.
9 #export DH_VERBOSE=1
11 # These are used for cross-compiling and for saving the configure script
12 # from having to guess our platform (since we know it already)
13 DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
14 DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
16 ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
17 CROSS= --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
18 else
19 CROSS= --build $(DEB_BUILD_GNU_TYPE)
20 endif
22 get-orig-source:
23 uscan --force --verbose --rename
25 config.status: configure
26 dh_testdir
28 for file in config.guess config.sub; do \
29 mv $$file $$file.upstream; \
30 ln -s /usr/share/misc/$$file .; \
31 done
33 ./configure $(CROSS) \
34 --with-layout=debian \
35 --mandir=/usr/share/man \
36 --infodir=/usr/share/info \
37 --without-kohana \
38 --with-kohana_system=/usr/share/php/kohana2/system \
39 --with-httpd-conf=/etc/apache2/conf.d \
40 CFLAGS="$(CFLAGS)"
42 build: build-stamp
44 build-stamp: $(QUILT_STAMPFN) config.status
45 dh_testdir
47 # Check whether all patches have been applied.
48 ( cd debian/patches/; for patch in *; do \
49 if test "$$patch" != "series"; then \
50 grep "$$patch" series > /dev/null \
51 || ( echo "$$patch not enabled\!"; exit 1 ); \
52 fi; done )
54 $(MAKE) all
56 touch $@
58 clean: unpatch
59 dh_testdir
60 dh_testroot
61 rm -f build-stamp
63 for file in config.guess config.sub; do \
64 if [ -e $$file.upstream ]; then \
65 rm -f $$file; \
66 mv $$file.upstream $$file; \
67 fi \
68 done
70 [ ! -f Makefile ] || $(MAKE) distclean
72 dh_clean
73 debconf-updatepo
75 install: build
76 dh_testdir
77 dh_testroot
78 dh_prep
79 dh_installdirs
81 $(MAKE) DESTDIR=$(CURDIR)/debian/tmp \
82 INSTALL_OPTS="--owner=root --group=root" install install-config
84 # Ignore install.php (for future debugging don't delete it)
85 touch debian/tmp/usr/share/pnp4nagios/html/install.ignore
87 mkdir -p debian/tmp/usr/share/doc/pnp4nagios/examples/
89 # Move template config dir to /etc/pnp4nagios/templates
90 rmdir debian/tmp/usr/share/pnp4nagios/html/templates
91 mkdir debian/tmp/etc/pnp4nagios/templates
92 mv debian/tmp/usr/share/pnp4nagios/html/templates.special \
93 debian/tmp/usr/share/doc/pnp4nagios/examples/
94 mkdir debian/tmp/etc/pnp4nagios/templates.special
96 mkdir -p debian/tmp/usr/sbin/
97 mv debian/tmp/usr/bin/npcd \
98 debian/tmp/usr/sbin/
100 mv debian/tmp/etc/pnp4nagios/rra.cfg-sample \
101 debian/tmp/etc/pnp4nagios/rra.cfg
103 mv debian/tmp/etc/pnp4nagios/nagios.cfg-sample \
104 debian/tmp/usr/share/doc/pnp4nagios/examples/nagios.cfg
106 mv debian/tmp/etc/pnp4nagios/misccommands.cfg-sample \
107 debian/tmp/usr/share/doc/pnp4nagios/examples/misccommands.cfg
109 mkdir debian/tmp/usr/share/doc/pnp4nagios/examples/check_commands
110 mv debian/tmp/etc/pnp4nagios/check_commands/check_nwstat.cfg-sample \
111 debian/tmp/usr/share/doc/pnp4nagios/examples/check_commands/check_nwstat.cfg
113 mkdir debian/tmp/usr/share/doc/pnp4nagios/examples/pages
114 mv debian/tmp/etc/pnp4nagios/pages/web_traffic.cfg-sample \
115 debian/tmp/usr/share/doc/pnp4nagios/examples/pages/web_traffic.cfg
117 cp -av contrib/ssi debian/tmp/usr/share/doc/pnp4nagios/examples/
118 rm -fv debian/tmp/usr/share/doc/pnp4nagios/examples/ssi/*.in
120 # Remove external PHP classes/libraries: FPDF, FPDF-TPL, FPDI
121 rm -r debian/tmp/usr/share/pnp4nagios/html/application/vendor/fpdf
123 # Remove external JavaScript files: jQuery and jQuery-UI
124 rm debian/tmp/usr/share/pnp4nagios/html/media/js/jquery-min.js
125 rm debian/tmp/usr/share/pnp4nagios/html/media/js/jquery-ui.min.js
127 # Clean up some files
128 rmdir debian/tmp/usr/bin
129 mv debian/tmp/etc/pnp4nagios/check_commands/check_all_local_disks.cfg-sample \
130 debian/tmp/etc/pnp4nagios/check_commands/check_all_local_disks.cfg
131 rm debian/tmp/etc/pnp4nagios/check_commands/check_nrpe.cfg-sample
133 # Add Debian specific config and placeholder files
134 #touch debian/tmp/etc/pnp4nagios/pages/.placeholder
135 cp -av debian/nagios.cfg debian/tmp/etc/pnp4nagios/
136 cp -av debian/check_commands/* debian/tmp/etc/pnp4nagios/check_commands/
138 cp -av sample-config/httpd.conf debian/tmp/etc/pnp4nagios/apache.conf
140 # Remove unnecessary config files (duplicates)
141 rm -f debian/tmp/etc/pnp4nagios/config_local.php
142 rm -f debian/tmp/etc/pnp4nagios/config.php.0.6*
144 # Add subdirs to /var/spool/pnp4nagios/ to prepare for different modes
145 mkdir debian/tmp/var/spool/pnp4nagios/nagios
146 mkdir debian/tmp/var/spool/pnp4nagios/npcd
148 # Delete not used and empty directories
149 #rmdir debian/tmp/usr/share/pnp4nagios/html/application/logs/
150 rmdir debian/tmp/usr/share/pnp4nagios/html/application/cache/
151 rmdir debian/tmp/usr/share/pnp4nagios/html/application/hooks/
152 #rmdir debian/tmp/usr/share/pnp4nagios/html/application/libraries/
154 dh_install --sourcedir=debian/tmp --fail-missing
156 # Build architecture-independent files here.
157 binary-indep: build install
158 dh_testdir
159 dh_testroot
160 dh_installchangelogs -i ChangeLog
161 dh_installdocs -A -i AUTHORS README debian/README.Debian
162 dh_installexamples -i
163 dh_installdebconf -i
164 dh_installinit -i
165 dh_installman -i
166 dh_link -i
167 dh_compress -i
168 dh_fixperms -i
169 dh_installdeb -i
170 dh_gencontrol -i
171 dh_md5sums -i
172 dh_builddeb -i
174 # Build architecture-dependent files here.
175 binary-arch: build install
176 dh_testdir
177 dh_testroot
178 dh_installchangelogs -a ChangeLog
179 dh_installdocs -A -a AUTHORS README debian/README.Debian
180 dh_installexamples -a
181 dh_installdebconf -a
182 dh_installinit -ppnp4nagios-bin --name=npcd
183 dh_installinit -ppnp4nagios-bin --name=pnp_gearman_worker
184 dh_installman -a
185 dh_link -a
186 dh_strip -a
187 dh_compress -a
188 dh_fixperms -a
189 dh_installdeb -a
190 dh_shlibdeps -a
191 dh_gencontrol -a
192 dh_md5sums -a
193 dh_builddeb -a
195 binary: binary-indep binary-arch
196 .PHONY: build clean binary-indep binary-arch binary install