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