#!/usr/bin/make -f # Sample debian/rules that uses debhelper. # GNU copyright 1997 to 1999 by Joey Hess. # Uncomment this to turn on verbose mode. export DH_VERBOSE=1 # This is the debhelper compatability version to use. export DH_COMPAT=1 srcdir = $(shell pwd) SHELL = /bin/sh -e CONFIGURE=./configure --prefix=/usr \ --mandir=/usr/share/man \ --bindir=/usr/sbin \ --sbindir=/usr/lib/cgi-bin/nagios \ --datadir=/usr/share/nagios/htdocs \ --libexecdir=/usr/lib/nagios/plugins \ --sysconfdir=/etc/nagios \ --mandir=/usr/share/man \ --infodir=/usr/share/info \ --localstatedir=/var/log/nagios \ --with-ping-command="/bin/ping -n %s -c %d" \ --with-template-extinfo \ --with-template-objects \ --with-perlcache \ --with-nagios-user=nagios \ --with-nagios-grp=nagios # the dbs rules include debian/scripts/dbs-build.mk # --------- CLEAN TARGETS clean-src: dh_testdir -a rm -Rf $(SOURCE_DIR) $(STAMP_DIR) clean: clean-src dh_testdir -a dh_testroot -a rm -Rf docs examples debian/files \ debian/nagios-{text,pgsql,mysql}.{init,postinst,postrm,conffiles,dirs} dh_clean -k # --------- BINARY TARGETS binary-nagios-text: $(patched) dh_testdir -a @( cd build-tree/nagios-[0-9]*/; \ $(CONFIGURE); \ set -e; $(MAKE) all && echo $?; \ cd .. && mv nagios-[0-9]* ../binary/binary-nagios-text; \ ) binary-nagios-pgsql: $(patched) dh_testdir -a @( cd build-tree/nagios-[0-9]*/; \ $(CONFIGURE) --with-pgsql-comments \ --with-pgsql-downtime \ --with-pgsql-extinfo \ --with-pgsql-retention \ --with-pgsql-status \ --with-pgsql-xdata; \ set -e; $(MAKE) all && echo $?; \ cd .. && mv nagios-[0-9]* ../binary/binary-nagios-pgsql; \ ) binary-nagios-mysql: $(patched) dh_testdir -a @( cd build-tree/nagios-[0-9]*/; \ $(CONFIGURE) --with-mysql-comments \ --with-mysql-downtime \ --with-mysql-extinfo \ --with-mysql-retention \ --with-mysql-status \ --with-mysql-xdata; \ set -e; $(MAKE) all && echo $?; \ cd .. && mv nagios-[0-9]* ../binary/binary-nagios-mysql; \ ) binary-indep: # We have nothing to do by default. duplicate: duplicate-stamp duplicate-stamp: # Duplicate the init script for pkg in text pgsql mysql; do \ cp debian/nagios.init.script debian/nagios-$$pkg.init; \ for file in postinst postrm conffiles dirs; do \ cp debian/$$file debian/nagios-$$pkg.$$file; \ done \ done -mkdir $(srcdir)/docs $(srcdir)/examples $(srcdir)/binary touch duplicate-stamp build: duplicate binary-nagios-text binary-nagios-pgsql binary-nagios-mysql binary-arch: build install dh_testdir -a # Chown all files recursivly chown -R root.root $(srcdir)/debian/tmp $(srcdir)/debian/nagios-{mysql,pgsql} # Copy the apache.conf to each package for dir in tmp nagios-mysql nagios-pgsql; do \ cp $(srcdir)/debian/apache.conf $(srcdir)/debian/$$dir/etc/nagios; \ done dh_installdebconf -a dh_installdocs -a dh_installexamples -a dh_installmenu -a dh_installinit -a # The init script should just be named 'nagios' (not nagios-PKG). for pkg in tmp nagios-pgsql nagios-mysql; do \ mv debian/$$pkg/etc/init.d/nagios-* \ debian/$$pkg/etc/init.d/nagios; \ done dh_installcron -a dh_installmanpages -a dh_installinfo -a dh_installchangelogs -a dh_link -A dh_strip -a dh_compress -a dh_fixperms -a dh_installdeb -a # Copy the templates file into nagios-{mysql,pgsql} for dir in mysql pgsql; do \ cp $(srcdir)/debian/templates $(srcdir)/debian/nagios-$$dir/DEBIAN; \ done dh_shlibdeps -a dh_gencontrol -a dh_md5sums -a dh_builddeb -a install: dh_testdir -a # Add here commands to install the package into debian/tmp. dh_installdirs -A @( for dir in text pgsql mysql; do \ cd build-tree/nagios-$$dir/; \ set -e; $(MAKE) install install-config DESTDIR=$(srcdir)/debian/tmp && echo $?; \ install -m 755 base/nagios $(srcdir)/debian/tmp/usr/lib/cgi-bin/nagios/; \ cp html/{index,main,side}.html html/robots.txt $(srcdir)/debian/tmp/etc/nagios; \ for file in `find $(srcdir)/debian/tmp/etc/nagios -name '*-sample'`; do \ new=`echo $$file | sed 's@-sample@@'`; \ mv $$file $$new; \ done; \ cp README UPGRADING $(srcdir)/docs; \ cp sample-config/nagios.cfg sample-config/resource.cfg \ sample-config/template-object/hosts.cfg $(srcdir)/examples; \ install -m 755 $(srcdir)/debian/update-nagios $(srcdir)/debian/tmp/usr/sbin/; \ install -m 755 $(srcdir)/debian/upgrade-netsaint2nagios $(srcdir)/debian/tmp/usr/sbin/; \ mv $(srcdir)/debian/tmp/usr/share/nagios/htdocs/{robots.txt,*.html} \ $(srcdir)/debian/tmp/etc/nagios; \ done; \ ) binary: binary-indep binary-arch .PHONY: clean binary-indep binary-arch binary install