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 rmdir $(CURDIR)/debian/pnp4nagios/usr/bin
88 # Copy, rename and fix sample configs and examples
89 sed -i -e 's#/nagios/cgi-bin#/cgi-bin/nagios3#' $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/config.php
91 mv $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/npcd.cfg-sample \
92 $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/npcd.cfg
93 sed -i -e 's#/var/spool/pnp4nagios/#&npcd/#' \
94 -e 's#/var/log/pnp4nagios/perfdata.dump#/var/spool/pnp4nagios/nagios/perfdata.dump#' \
95 $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/npcd.cfg
97 mv $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/process_perfdata.cfg-sample \
98 $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/process_perfdata.cfg
99 sed -i -e 's/TIMEOUT = 5/TIMEOUT = 15/' \
100 $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/process_perfdata.cfg
102 mv $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/rra.cfg-sample \
103 $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/rra.cfg
105 mv $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/nagios.cfg-sample \
106 $(CURDIR)/debian/pnp4nagios/usr/share/doc/pnp4nagios/examples/nagios.cfg
108 mv $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/misccommands.cfg-sample \
109 $(CURDIR)/debian/pnp4nagios/usr/share/doc/pnp4nagios/examples/misccommands.cfg
111 mkdir $(CURDIR)/debian/pnp4nagios/usr/share/doc/pnp4nagios/examples/check_commands
112 mv $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/check_commands/check_nwstat.cfg-sample \
113 $(CURDIR)/debian/pnp4nagios/usr/share/doc/pnp4nagios/examples/check_commands/check_nwstat.cfg
115 mkdir $(CURDIR)/debian/pnp4nagios/usr/share/doc/pnp4nagios/examples/pages
116 mv $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/pages/web_traffic.cfg-sample \
117 $(CURDIR)/debian/pnp4nagios/usr/share/doc/pnp4nagios/examples/pages/web_traffic.cfg
119 cp -av $(CURDIR)/contrib/ssi $(CURDIR)/debian/pnp4nagios/usr/share/doc/pnp4nagios/examples/
121 # Add Debian specific config and placeholder files
122 touch $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/pages/.placeholder
123 cp -av $(CURDIR)/debian/nagios.cfg $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/
124 cp -av $(CURDIR)/debian/check_commands/* $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/check_commands/
126 # Apache config file
127 # FIXME
128 sed -i 's#/usr/local/nagios/etc/htpasswd.users#/etc/nagios3/htpasswd.users#' $(CURDIR)/sample-config/httpd.conf
129 cp -av $(CURDIR)/sample-config/httpd.conf $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/apache.conf
131 # Add subdirs to /var/spool/pnp4nagios/ to prepare for different modes
132 mkdir $(CURDIR)/debian/pnp4nagios/var/spool/pnp4nagios/nagios
133 mkdir $(CURDIR)/debian/pnp4nagios/var/spool/pnp4nagios/npcd
135 # Delete not used and empty directories
136 rmdir $(CURDIR)/debian/pnp4nagios/usr/share/pnp4nagios/html/application/cache/
137 rmdir $(CURDIR)/debian/pnp4nagios/usr/share/pnp4nagios/html/application/hooks/
138 rmdir $(CURDIR)/debian/pnp4nagios/usr/share/pnp4nagios/html/application/libraries/
142 # Build architecture-independent files here.
143 binary-indep: build install
144 # We have nothing to do by default.
146 # Build architecture-dependent files here.
147 binary-arch: build install
148 dh_testdir
149 dh_testroot
150 dh_installchangelogs ChangeLog
151 dh_installdocs
152 dh_installexamples
153 # dh_install
154 # dh_installmenu
155 # dh_installdebconf
156 # dh_installlogrotate
157 # dh_installemacsen
158 # dh_installpam
159 # dh_installmime
160 # dh_python
161 dh_installinit
162 # dh_installcron
163 # dh_installinfo
164 dh_installman
165 dh_link
166 dh_strip
167 dh_compress
168 dh_fixperms
169 # dh_perl
170 # dh_makeshlibs
171 dh_installdeb
172 dh_shlibdeps
173 dh_gencontrol
174 dh_md5sums
175 dh_builddeb
177 binary: binary-indep binary-arch
178 .PHONY: build clean binary-indep binary-arch binary install