#!/usr/bin/make -f # -*- makefile -*- # Sample debian/rules that uses debhelper. # This file was originally written by Joey Hess and Craig Small. # As a special exception, when this file is copied by dh-make into a # dh-make output file, you may use that output file without restriction. # This special exception was added by Craig Small in version 0.37 of dh-make. # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 # These are used for cross-compiling and for saving the configure script # from having to guess our platform (since we know it already) DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE)) CROSS= --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE) else CROSS= --build $(DEB_BUILD_GNU_TYPE) endif config.status: configure dh_testdir # Add here commands to configure the package. #ifneq "$(wildcard /usr/share/misc/config.sub)" "" # cp -f /usr/share/misc/config.sub config.sub #endif #ifneq "$(wildcard /usr/share/misc/config.guess)" "" # cp -f /usr/share/misc/config.guess config.guess #endif ./configure $(CROSS) --with-layout=debian \ --prefix=/usr \ --mandir=\$${prefix}/share/man \ --infodir=\$${prefix}/share/info \ --without-kohana \ --with-kohana_system=/usr/share/php/kohana/system \ CFLAGS="$(CFLAGS)" build: build-stamp build-stamp: config.status dh_testdir # Add here commands to compile the package. $(MAKE) all touch $@ clean: dh_testdir dh_testroot rm -f build-stamp # Add here commands to clean up after the build process. [ ! -f Makefile ] || $(MAKE) distclean # rm -f config.sub config.guess dh_clean install: build dh_testdir dh_testroot dh_prep dh_installdirs # Add here commands to install the package into debian/pnp4nagios. # mkdir -p $(CURDIR)/debian/pnp4nagios/etc/apache2/conf.d/ $(MAKE) DESTDIR=$(CURDIR)/debian/pnp4nagios INSTALL_OPTS="-o root -g root" install install-config # Ignore install.php (for future debugging don't delete it) touch $(CURDIR)/debian/pnp4nagios/usr/share/pnp4nagios/html/install.ignore # Move template config dir to /etc/pnp4nagios/templates rmdir $(CURDIR)/debian/pnp4nagios/usr/share/pnp4nagios/html/templates mkdir $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/templates mv $(CURDIR)/debian/pnp4nagios/usr/share/pnp4nagios/html/templates.special \ $(CURDIR)/debian/pnp4nagios/usr/share/doc/pnp4nagios/examples/ mkdir $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/templates.special # Copy, rename and fix sample configs and examples sed -i -e 's#/nagios/cgi-bin#/cgi-bin/nagios3#' $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/config.php mv $(CURDIR)/debian/pnp4nagios/usr/bin/npcd \ $(CURDIR)/debian/pnp4nagios/usr/sbin/ mv $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/npcd.cfg-sample \ $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/npcd.cfg sed -i -e 's#/var/spool/pnp4nagios/#&npcd/#' \ -e 's#/var/log/pnp4nagios/perfdata.dump#/var/spool/pnp4nagios/nagios/perfdata.dump#' \ $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/npcd.cfg mv $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/process_perfdata.cfg-sample \ $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/process_perfdata.cfg sed -i -e 's/TIMEOUT = 5/TIMEOUT = 15/' \ $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/process_perfdata.cfg mv $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/rra.cfg-sample \ $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/rra.cfg mv $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/nagios.cfg-sample \ $(CURDIR)/debian/pnp4nagios/usr/share/doc/pnp4nagios/examples/nagios.cfg mv $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/misccommands.cfg-sample \ $(CURDIR)/debian/pnp4nagios/usr/share/doc/pnp4nagios/examples/misccommands.cfg mkdir $(CURDIR)/debian/pnp4nagios/usr/share/doc/pnp4nagios/examples/check_commands mv $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/check_commands/check_nwstat.cfg-sample \ $(CURDIR)/debian/pnp4nagios/usr/share/doc/pnp4nagios/examples/check_commands/check_nwstat.cfg mkdir $(CURDIR)/debian/pnp4nagios/usr/share/doc/pnp4nagios/examples/pages mv $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/pages/web_traffic.cfg-sample \ $(CURDIR)/debian/pnp4nagios/usr/share/doc/pnp4nagios/examples/pages/web_traffic.cfg cp -av $(CURDIR)/contrib/ssi $(CURDIR)/debian/pnp4nagios/usr/share/doc/pnp4nagios/examples/ # Remove external PHP classes/libraries: FPDF, FPDF-TPL, FPDI rm -r $(CURDIR)/debian/pnp4nagios/usr/share/pnp4nagios/html/application/vendor/fpdf # Link them into ".../vendor/" dh_link /usr/share/php/fpdf /usr/share/pnp4nagios/html/application/vendor/fpdf dh_link /usr/share/php/fpdf_tpl /usr/share/pnp4nagios/html/application/vendor/fpdf-tpl dh_link /usr/share/php/fpdi /usr/share/pnp4nagios/html/application/vendor/fpdi # Clean up some files rmdir $(CURDIR)/debian/pnp4nagios/usr/bin mv $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/check_commands/check_all_local_disks.cfg-sample \ $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/check_commands/check_all_local_disks.cfg rm $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/check_commands/check_nrpe.cfg-sample # Add Debian specific config and placeholder files #touch $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/pages/.placeholder cp -av $(CURDIR)/debian/nagios.cfg $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/ cp -av $(CURDIR)/debian/check_commands/* $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/check_commands/ # Apache config file # FIXME sed -i 's#/usr/local/nagios/etc/htpasswd.users#/etc/nagios3/htpasswd.users#' $(CURDIR)/sample-config/httpd.conf cp -av $(CURDIR)/sample-config/httpd.conf $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/apache.conf # Add subdirs to /var/spool/pnp4nagios/ to prepare for different modes mkdir $(CURDIR)/debian/pnp4nagios/var/spool/pnp4nagios/nagios mkdir $(CURDIR)/debian/pnp4nagios/var/spool/pnp4nagios/npcd # Delete not used and empty directories #rmdir $(CURDIR)/debian/pnp4nagios/usr/share/pnp4nagios/html/application/logs/ rmdir $(CURDIR)/debian/pnp4nagios/usr/share/pnp4nagios/html/application/cache/ rmdir $(CURDIR)/debian/pnp4nagios/usr/share/pnp4nagios/html/application/hooks/ #rmdir $(CURDIR)/debian/pnp4nagios/usr/share/pnp4nagios/html/application/libraries/ # Build architecture-independent files here. binary-indep: build install # We have nothing to do by default. # Build architecture-dependent files here. binary-arch: build install dh_testdir dh_testroot dh_installchangelogs ChangeLog dh_installdocs dh_installexamples # dh_install # dh_installmenu # dh_installdebconf # dh_installlogrotate # dh_installemacsen # dh_installpam # dh_installmime # dh_python dh_installinit # dh_installcron # dh_installinfo dh_installman dh_link dh_strip dh_compress dh_fixperms # dh_perl # dh_makeshlibs dh_installdeb dh_shlibdeps dh_gencontrol dh_md5sums dh_builddeb binary: binary-indep binary-arch .PHONY: build clean binary-indep binary-arch binary install