1 #!/usr/bin/make -f
2 # -*- makefile -*-
3 # Sample debian/rules that uses debhelper.
4 # This file was originally written by Joey Hess and Craig Small.
5 # As a special exception, when this file is copied by dh-make into a
6 # dh-make output file, you may use that output file without restriction.
7 # This special exception was added by Craig Small in version 0.37 of dh-make.
9 # Uncomment this to turn on verbose mode.
10 #export DH_VERBOSE=1
13 # These are used for cross-compiling and for saving the configure script
14 # from having to guess our platform (since we know it already)
15 DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
16 DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
17 ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
18 CROSS= --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
19 else
20 CROSS= --build $(DEB_BUILD_GNU_TYPE)
21 endif
25 config.status: configure
26 dh_testdir
27 # Add here commands to configure the package.
28 #ifneq "$(wildcard /usr/share/misc/config.sub)" ""
29 # cp -f /usr/share/misc/config.sub config.sub
30 #endif
31 #ifneq "$(wildcard /usr/share/misc/config.guess)" ""
32 # cp -f /usr/share/misc/config.guess config.guess
33 #endif
34 ./configure $(CROSS) --with-layout=debian \
35 --prefix=/usr \
36 --mandir=\$${prefix}/share/man \
37 --infodir=\$${prefix}/share/info \
38 --without-kohana \
39 --with-kohana_system=/usr/share/php/kohana/system \
40 CFLAGS="$(CFLAGS)"
43 build: build-stamp
45 build-stamp: config.status
46 dh_testdir
48 # Add here commands to compile the package.
49 $(MAKE) all
51 touch $@
53 clean:
54 dh_testdir
55 dh_testroot
56 rm -f build-stamp
58 # Add here commands to clean up after the build process.
59 [ ! -f Makefile ] || $(MAKE) distclean
60 # rm -f config.sub config.guess
62 dh_clean
64 install: build
65 dh_testdir
66 dh_testroot
67 dh_prep
68 dh_installdirs
70 # Add here commands to install the package into debian/pnp4nagios.
71 # mkdir -p $(CURDIR)/debian/pnp4nagios/etc/apache2/conf.d/
72 $(MAKE) DESTDIR=$(CURDIR)/debian/pnp4nagios INSTALL_OPTS="-o root -g root" install install-config
74 # Ignore install.php (for future debugging don't delete it)
75 touch $(CURDIR)/debian/pnp4nagios/usr/share/pnp4nagios/html/install.ignore
77 # Move template config dir to /etc/pnp4nagios/templates
78 mv $(CURDIR)/debian/pnp4nagios/usr/share/pnp4nagios/html/templates $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/
79 # ln -s ../../../../etc/pnp4nagios/templates $(CURDIR)/debian/pnp4nagios/usr/share/pnp4nagios/html/templates
80 dh_link /etc/pnp4nagios/templates /usr/share/pnp4nagios/html/templates
82 # Move npcd and npcdmod.o to right path
83 mv $(CURDIR)/debian/pnp4nagios/usr/bin/npcd \
84 $(CURDIR)/debian/pnp4nagios/usr/sbin/
86 mv $(CURDIR)/debian/pnp4nagios/usr/bin/npcdmod.o \
87 $(CURDIR)/debian/pnp4nagios/usr/lib/pnp4nagios/
89 rmdir $(CURDIR)/debian/pnp4nagios/usr/bin
91 # Copy, rename and fix sample configs and examples
92 sed -i -e 's#/nagios/cgi-bin#/cgi-bin/nagios3#' $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/config.php
94 mv $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/npcd.cfg-sample \
95 $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/npcd.cfg
96 sed -i -e 's#/var/spool/pnp4nagios/#&npcd/#' \
97 -e 's#/var/log/pnp4nagios/perfdata.dump#/var/spool/pnp4nagios/nagios/perfdata.dump#' \
98 $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/npcd.cfg
100 mv $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/process_perfdata.cfg-sample \
101 $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/process_perfdata.cfg
102 sed -i -e 's/TIMEOUT = 5/TIMEOUT = 15/' \
103 $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/process_perfdata.cfg
105 mv $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/rra.cfg-sample \
106 $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/rra.cfg
108 mv $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/nagios.cfg-sample \
109 $(CURDIR)/debian/pnp4nagios/usr/share/doc/pnp4nagios/examples/nagios.cfg
111 mv $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/misccommands.cfg-sample \
112 $(CURDIR)/debian/pnp4nagios/usr/share/doc/pnp4nagios/examples/misccommands.cfg
114 mkdir $(CURDIR)/debian/pnp4nagios/usr/share/doc/pnp4nagios/examples/check_commands
115 mv $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/check_commands/check_nwstat.cfg-sample \
116 $(CURDIR)/debian/pnp4nagios/usr/share/doc/pnp4nagios/examples/check_commands/check_nwstat.cfg
118 mkdir $(CURDIR)/debian/pnp4nagios/usr/share/doc/pnp4nagios/examples/pages
119 mv $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/pages/web_traffic.cfg-sample \
120 $(CURDIR)/debian/pnp4nagios/usr/share/doc/pnp4nagios/examples/pages/web_traffic.cfg
122 cp -av $(CURDIR)/contrib/ssi $(CURDIR)/debian/pnp4nagios/usr/share/doc/pnp4nagios/examples/
124 # Add Debian specific config and placeholder files
125 touch $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/pages/.placeholder
126 cp -av $(CURDIR)/debian/nagios.cfg $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/
127 cp -av $(CURDIR)/debian/check_commands/* $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/check_commands/
129 # Apache config file
130 # FIXME
131 sed -i 's#/usr/local/nagios/etc/htpasswd.users#/etc/nagios3/htpasswd.users#' $(CURDIR)/sample-config/httpd.conf
132 cp -av $(CURDIR)/sample-config/httpd.conf $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/apache.conf
134 # Add subdirs to /var/spool/pnp4nagios/ to prepare for different modes
135 mkdir $(CURDIR)/debian/pnp4nagios/var/spool/pnp4nagios/nagios
136 mkdir $(CURDIR)/debian/pnp4nagios/var/spool/pnp4nagios/npcd
138 # Delete not used and empty directories
139 rmdir $(CURDIR)/debian/pnp4nagios/usr/share/pnp4nagios/html/application/logs/
140 rmdir $(CURDIR)/debian/pnp4nagios/usr/share/pnp4nagios/html/application/cache/
141 rmdir $(CURDIR)/debian/pnp4nagios/usr/share/pnp4nagios/html/application/hooks/
142 rmdir $(CURDIR)/debian/pnp4nagios/usr/share/pnp4nagios/html/application/libraries/
146 # Build architecture-independent files here.
147 binary-indep: build install
148 # We have nothing to do by default.
150 # Build architecture-dependent files here.
151 binary-arch: build install
152 dh_testdir
153 dh_testroot
154 dh_installchangelogs ChangeLog
155 dh_installdocs
156 dh_installexamples
157 # dh_install
158 # dh_installmenu
159 # dh_installdebconf
160 # dh_installlogrotate
161 # dh_installemacsen
162 # dh_installpam
163 # dh_installmime
164 # dh_python
165 dh_installinit
166 # dh_installcron
167 # dh_installinfo
168 dh_installman
169 dh_link
170 dh_strip
171 dh_compress
172 dh_fixperms
173 # dh_perl
174 # dh_makeshlibs
175 dh_installdeb
176 dh_shlibdeps
177 dh_gencontrol
178 dh_md5sums
179 dh_builddeb
181 binary: binary-indep binary-arch
182 .PHONY: build clean binary-indep binary-arch binary install