From: Sebastian Harl Date: Wed, 2 Feb 2011 17:35:12 +0000 (+0100) Subject: rules: Cleaned up a bit. X-Git-Tag: v_0_6_11-1~30 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=1d9bc73f014435a5d72bdd7557f7cf5700b662a1;p=pkg-pnp4nagios.git rules: Cleaned up a bit. --- diff --git a/debian/docs b/debian/docs deleted file mode 100644 index e845566..0000000 --- a/debian/docs +++ /dev/null @@ -1 +0,0 @@ -README diff --git a/debian/rules b/debian/rules index 65bb088..9eb2c40 100755 --- a/debian/rules +++ b/debian/rules @@ -1,21 +1,18 @@ #!/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. +# debian/rules for PNP4Nagios +# +# Written by Sven Velt and Sebastian Harl . include /usr/share/quilt/quilt.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 @@ -27,14 +24,14 @@ get-orig-source: 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 \ + + for file in config.guess config.sub; do \ + mv $$file $$file.upstream; \ + ln -s /usr/share/misc/$$file .; \ + done + + ./configure $(CROSS) \ + --with-layout=debian \ --prefix=/usr \ --mandir=\$${prefix}/share/man \ --infodir=\$${prefix}/share/info \ @@ -42,13 +39,18 @@ config.status: configure --with-kohana_system=/usr/share/php/kohana/system \ CFLAGS="$(CFLAGS)" - build: build-stamp build-stamp: $(QUILT_STAMPFN) config.status dh_testdir - # Add here commands to compile the package. + # Check whether all patches have been applied. + ( cd debian/patches/; for patch in *; do \ + if test "$$patch" != "series"; then \ + grep "$$patch" series > /dev/null \ + || ( echo "$$patch not enabled\!"; exit 1 ); \ + fi; done ) + $(MAKE) all touch $@ @@ -56,13 +58,18 @@ build-stamp: $(QUILT_STAMPFN) config.status clean: unpatch dh_testdir dh_testroot - rm -f build-stamp + rm -f build-stamp + + for file in config.guess config.sub; do \ + if [ -e $$file.upstream ]; then \ + rm -f $$file; \ + mv $$file.upstream $$file; \ + fi \ + done - # Add here commands to clean up after the build process. [ ! -f Makefile ] || $(MAKE) distclean -# rm -f config.sub config.guess - dh_clean + dh_clean install: build dh_testdir @@ -70,94 +77,81 @@ install: build 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 - + $(MAKE) DESTDIR=$(CURDIR)/debian/pnp4nagios \ + INSTALL_OPTS="--owner=root --group=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 + touch debian/pnp4nagios/usr/share/pnp4nagios/html/install.ignore - # 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 + # Move template config dir to /etc/pnp4nagios/templates + rmdir debian/pnp4nagios/usr/share/pnp4nagios/html/templates + mkdir debian/pnp4nagios/etc/pnp4nagios/templates + mv debian/pnp4nagios/usr/share/pnp4nagios/html/templates.special \ + debian/pnp4nagios/usr/share/doc/pnp4nagios/examples/ + mkdir debian/pnp4nagios/etc/pnp4nagios/templates.special - 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 debian/pnp4nagios/usr/bin/npcd \ + debian/pnp4nagios/usr/sbin/ + mv debian/pnp4nagios/etc/pnp4nagios/npcd.cfg-sample \ + 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 debian/pnp4nagios/etc/pnp4nagios/process_perfdata.cfg-sample \ + debian/pnp4nagios/etc/pnp4nagios/process_perfdata.cfg - mv $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/rra.cfg-sample \ - $(CURDIR)/debian/pnp4nagios/etc/pnp4nagios/rra.cfg + mv debian/pnp4nagios/etc/pnp4nagios/rra.cfg-sample \ + 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 debian/pnp4nagios/etc/pnp4nagios/nagios.cfg-sample \ + 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 + mv debian/pnp4nagios/etc/pnp4nagios/misccommands.cfg-sample \ + 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 debian/pnp4nagios/usr/share/doc/pnp4nagios/examples/check_commands + mv debian/pnp4nagios/etc/pnp4nagios/check_commands/check_nwstat.cfg-sample \ + 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 + mkdir debian/pnp4nagios/usr/share/doc/pnp4nagios/examples/pages + mv debian/pnp4nagios/etc/pnp4nagios/pages/web_traffic.cfg-sample \ + debian/pnp4nagios/usr/share/doc/pnp4nagios/examples/pages/web_traffic.cfg - cp -av $(CURDIR)/contrib/ssi $(CURDIR)/debian/pnp4nagios/usr/share/doc/pnp4nagios/examples/ + cp -av contrib/ssi 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 + rm -r 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/fpdi /usr/share/pnp4nagios/html/application/vendor/fpdi # Remove external JavaScript files: jQuery and jQuery-UI - rm $(CURDIR)/debian/pnp4nagios/usr/share/pnp4nagios/html/media/js/jquery-min.js - rm $(CURDIR)/debian/pnp4nagios/usr/share/pnp4nagios/html/media/js/jquery-ui.min.js + rm debian/pnp4nagios/usr/share/pnp4nagios/html/media/js/jquery-min.js + rm debian/pnp4nagios/usr/share/pnp4nagios/html/media/js/jquery-ui.min.js # Link them dh_link /usr/share/javascript/jquery/jquery.min.js /usr/share/pnp4nagios/html/media/js/jquery-min.js dh_link /usr/share/javascript/jquery-ui/jquery-ui.js /usr/share/pnp4nagios/html/media/js/jquery-ui.min.js # 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 + rmdir debian/pnp4nagios/usr/bin + mv debian/pnp4nagios/etc/pnp4nagios/check_commands/check_all_local_disks.cfg-sample \ + debian/pnp4nagios/etc/pnp4nagios/check_commands/check_all_local_disks.cfg + rm 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/ + #touch debian/pnp4nagios/etc/pnp4nagios/pages/.placeholder + cp -av debian/nagios.cfg debian/pnp4nagios/etc/pnp4nagios/ + cp -av debian/check_commands/* debian/pnp4nagios/etc/pnp4nagios/check_commands/ - # Apache config file - #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 + cp -av sample-config/httpd.conf 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 + mkdir debian/pnp4nagios/var/spool/pnp4nagios/nagios + mkdir 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/ - - + #rmdir debian/pnp4nagios/usr/share/pnp4nagios/html/application/logs/ + rmdir debian/pnp4nagios/usr/share/pnp4nagios/html/application/cache/ + rmdir debian/pnp4nagios/usr/share/pnp4nagios/html/application/hooks/ + #rmdir debian/pnp4nagios/usr/share/pnp4nagios/html/application/libraries/ # Build architecture-independent files here. binary-indep: build install @@ -168,26 +162,14 @@ binary-arch: build install dh_testdir dh_testroot dh_installchangelogs ChangeLog - dh_installdocs + dh_installdocs README 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 @@ -195,4 +177,4 @@ binary-arch: build install dh_builddeb binary: binary-indep binary-arch -.PHONY: build clean binary-indep binary-arch binary install +.PHONY: build clean binary-indep binary-arch binary install