From 72ef07f4fc63c653bc92f701addf2f02fd469cd5 Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Thu, 3 Feb 2011 12:23:18 +0100 Subject: [PATCH] Split package into "pnp4nagios-bin" and "pnp4nagios-web". In theory, this allows to run the two parts on different hosts. Also, this way, the rather large /usr/share is shipped in an arch=all package. --- debian/control | 41 ++++- debian/dirs | 2 - ...4nagios.default => pnp4nagios-bin.default} | 0 .../{pnp4nagios.init => pnp4nagios-bin.init} | 2 +- debian/pnp4nagios-bin.install | 10 ++ debian/pnp4nagios-bin.postinst | 70 +++++++++ debian/{postrm => pnp4nagios-bin.postrm} | 12 +- debian/pnp4nagios-web.install | 13 ++ debian/pnp4nagios-web.links | 4 + debian/{postinst => pnp4nagios-web.postinst} | 12 +- debian/pnp4nagios-web.postrm | 48 ++++++ debian/rules | 140 ++++++++++-------- 12 files changed, 261 insertions(+), 93 deletions(-) delete mode 100644 debian/dirs rename debian/{pnp4nagios.default => pnp4nagios-bin.default} (100%) rename debian/{pnp4nagios.init => pnp4nagios-bin.init} (99%) create mode 100644 debian/pnp4nagios-bin.install create mode 100644 debian/pnp4nagios-bin.postinst rename debian/{postrm => pnp4nagios-bin.postrm} (79%) create mode 100644 debian/pnp4nagios-web.install create mode 100644 debian/pnp4nagios-web.links rename debian/{postinst => pnp4nagios-web.postinst} (84%) create mode 100644 debian/pnp4nagios-web.postrm diff --git a/debian/control b/debian/control index ab07b89..80691ec 100644 --- a/debian/control +++ b/debian/control @@ -8,14 +8,47 @@ Standards-Version: 3.9.1 Homepage: http://www.pnp4nagios.org/ Package: pnp4nagios +Architecture: all +Depends: pnp4nagios-bin, pnp4nagios-web, ${misc:Depends} +Description: Nagios addon to create graphs from performance data + PNP is a graphing tool for Nagios that analyzes performance data provided by + plugins and stores them automatically into Round Robin Databases (RRD). It + fully integrates itself into the Nagios Monitoring Website. + . + PNP's goal is to be easily configurable and maintainable. + . + This is a metapackage depending on all parts of PNP4Nagios. + +Package: pnp4nagios-bin Architecture: any -Depends: rrdtool, librrds-perl, libapache2-mod-php5 | php5, php5-gd, - libfpdi-php, libkohana-php, +Depends: librrds-perl, adduser, ${shlibs:Depends}, ${misc:Depends} +Recommends: pnp4nagios-web, nagios3 | icinga +Suggests: rrdcached +Description: Nagios addon to create graphs from performance data (binaries) + PNP is a graphing tool for Nagios that analyzes performance data provided by + plugins and stores them automatically into Round Robin Databases (RRD). It + fully integrates itself into the Nagios Monitoring Website. + . + PNP's goal is to be easily configurable and maintainable. + . + This package contains the NPCD-related binaries and process_perfdata.pl. + +Package: pnp4nagios-web +Architecture: all +Depends: libapache2-mod-php5 | php5, php5-gd, + libkohana-php, + libfpdi-php, libjs-jquery, libjs-jquery-ui, - adduser, ${shlibs:Depends}, ${misc:Depends} -Description: Nagios addon to create graphs from performance data + rrdtool, + adduser, + ${misc:Depends} +Recommends: pnp4nagios-bin +Suggests: rrdcached +Description: Nagios addon to create graphs from performance data (web interface) PNP is a graphing tool for Nagios that analyzes performance data provided by plugins and stores them automatically into Round Robin Databases (RRD). It fully integrates itself into the Nagios Monitoring Website. . PNP's goal is to be easily configurable and maintainable. + . + This package contains the web-interface for PNP4Nagios. diff --git a/debian/dirs b/debian/dirs deleted file mode 100644 index 1e4d277..0000000 --- a/debian/dirs +++ /dev/null @@ -1,2 +0,0 @@ -usr/sbin -usr/share/doc/pnp4nagios/examples/ diff --git a/debian/pnp4nagios.default b/debian/pnp4nagios-bin.default similarity index 100% rename from debian/pnp4nagios.default rename to debian/pnp4nagios-bin.default diff --git a/debian/pnp4nagios.init b/debian/pnp4nagios-bin.init similarity index 99% rename from debian/pnp4nagios.init rename to debian/pnp4nagios-bin.init index 0021d0f..bfb1113 100644 --- a/debian/pnp4nagios.init +++ b/debian/pnp4nagios-bin.init @@ -7,7 +7,7 @@ # Copyright (c) 2009 Sven Velt # ### BEGIN INIT INFO -# Provides: pnp4nagios +# Provides: pnp4nagios-bin # Required-Start: $network $local_fs $remote_fs # Required-Stop: $network $local_fs $remote_fs # Should-Start: diff --git a/debian/pnp4nagios-bin.install b/debian/pnp4nagios-bin.install new file mode 100644 index 0000000..97e44ae --- /dev/null +++ b/debian/pnp4nagios-bin.install @@ -0,0 +1,10 @@ +etc/pnp4nagios/nagios.cfg +etc/pnp4nagios/check_commands/ +etc/pnp4nagios/*.cfg +usr/lib/pnp4nagios/ +usr/sbin/npcd +usr/share/doc/pnp4nagios/examples/*.cfg +usr/share/doc/pnp4nagios/examples/check_commands/ +var/log/pnp4nagios/stats/ +var/lib/pnp4nagios/perfdata/ +var/spool/pnp4nagios/ diff --git a/debian/pnp4nagios-bin.postinst b/debian/pnp4nagios-bin.postinst new file mode 100644 index 0000000..d3bc340 --- /dev/null +++ b/debian/pnp4nagios-bin.postinst @@ -0,0 +1,70 @@ +#!/bin/sh +# postinst script for pnp4nagios-bin +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `configure' +# * `abort-upgrade' +# * `abort-remove' `in-favour' +# +# * `abort-remove' +# * `abort-deconfigure' `in-favour' +# `removing' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + +setperm() { + user="$1" + group="$2" + mode="$3" + file="$4" + shift 4 + # only do something when no setting exists + if ! dpkg-statoverride --list "$file" >/dev/null 2>&1; then + chown "$user":"$group" "$file" + chmod "$mode" "$file" + fi +} + +case "$1" in + configure) + if ! getent passwd nagios > /dev/null ; then + echo 'Adding system-user for nagios' 1>&2 + adduser --system --group --home /var/lib/nagios \ + --disabled-login --force-badname nagios > /dev/null + fi + setperm nagios www-data 750 /var/lib/pnp4nagios + setperm nagios nagios 755 /var/lib/pnp4nagios/perfdata + setperm nagios www-data 750 /var/log/pnp4nagios + setperm nagios nagios 750 /var/log/pnp4nagios/stats + setperm nagios nagios 770 /var/spool/pnp4nagios + setperm nagios nagios 770 /var/spool/pnp4nagios/nagios + setperm nagios nagios 770 /var/spool/pnp4nagios/npcd + + if [ -d /etc/nagios3/conf.d/ ]; then + if [ ! -e /etc/nagios3/conf.d/pnp4nagios.cfg ]; then + ln -s /etc/pnp4nagios/nagios.cfg /etc/nagios3/conf.d/pnp4nagios.cfg + fi + fi + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 + diff --git a/debian/postrm b/debian/pnp4nagios-bin.postrm similarity index 79% rename from debian/postrm rename to debian/pnp4nagios-bin.postrm index d8f0d3e..7e12fcd 100644 --- a/debian/postrm +++ b/debian/pnp4nagios-bin.postrm @@ -1,5 +1,5 @@ #!/bin/sh -# postrm script for pnp4nagios +# postrm script for pnp4nagios-bin # # see: dh_installdeb(1) @@ -29,15 +29,6 @@ case "$1" in fi fi fi - - if [ -d /etc/apache2/conf.d/ ]; then - if [ -L /etc/apache2/conf.d/pnp4nagios.cfg ]; then - ls -l /etc/apache2/conf.d/pnp4nagios.cfg | grep -q /etc/pnp4nagios/apache.cfg - if [ $? -eq 0 ]; then - rm -f /etc/apache2/conf.d/pnp4nagios.cfg - fi - fi - fi ;; upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) ;; @@ -55,4 +46,3 @@ esac exit 0 - diff --git a/debian/pnp4nagios-web.install b/debian/pnp4nagios-web.install new file mode 100644 index 0000000..84b5156 --- /dev/null +++ b/debian/pnp4nagios-web.install @@ -0,0 +1,13 @@ +etc/pnp4nagios/apache.conf +etc/pnp4nagios/background.pdf +etc/pnp4nagios/templates/ +etc/pnp4nagios/pages/ +etc/pnp4nagios/templates.special/ +etc/pnp4nagios/pnp4nagios_release +etc/pnp4nagios/config.php +usr/share/doc/pnp4nagios/examples/templates.special/ +usr/share/doc/pnp4nagios/examples/pages/ +usr/share/doc/pnp4nagios/examples/ssi/ +usr/share/pnp4nagios/html/ +var/log/pnp4nagios/kohana/ +var/lib/pnp4nagios/ diff --git a/debian/pnp4nagios-web.links b/debian/pnp4nagios-web.links new file mode 100644 index 0000000..9864443 --- /dev/null +++ b/debian/pnp4nagios-web.links @@ -0,0 +1,4 @@ +/usr/share/php/fpdf /usr/share/pnp4nagios/html/application/vendor/fpdf +/usr/share/php/fpdi /usr/share/pnp4nagios/html/application/vendor/fpdi +/usr/share/javascript/jquery/jquery.min.js /usr/share/pnp4nagios/html/media/js/jquery-min.js +/usr/share/javascript/jquery-ui/jquery-ui.js /usr/share/pnp4nagios/html/media/js/jquery-ui.min.js diff --git a/debian/postinst b/debian/pnp4nagios-web.postinst similarity index 84% rename from debian/postinst rename to debian/pnp4nagios-web.postinst index a9c3e82..d2fd8aa 100644 --- a/debian/postinst +++ b/debian/pnp4nagios-web.postinst @@ -1,5 +1,5 @@ #!/bin/sh -# postinst script for pnp4nagios +# postinst script for pnp4nagios-web # # see: dh_installdeb(1) @@ -41,15 +41,6 @@ case "$1" in setperm nagios nagios 755 /var/lib/pnp4nagios/perfdata setperm nagios www-data 750 /var/log/pnp4nagios setperm nagios nagios 750 /var/log/pnp4nagios/stats - setperm nagios nagios 770 /var/spool/pnp4nagios - setperm nagios nagios 770 /var/spool/pnp4nagios/nagios - setperm nagios nagios 770 /var/spool/pnp4nagios/npcd - - if [ -d /etc/nagios3/conf.d/ ]; then - if [ ! -e /etc/nagios3/conf.d/pnp4nagios.cfg ]; then - ln -s /etc/pnp4nagios/nagios.cfg /etc/nagios3/conf.d/pnp4nagios.cfg - fi - fi a2reload="false" @@ -88,4 +79,3 @@ esac exit 0 - diff --git a/debian/pnp4nagios-web.postrm b/debian/pnp4nagios-web.postrm new file mode 100644 index 0000000..40781ab --- /dev/null +++ b/debian/pnp4nagios-web.postrm @@ -0,0 +1,48 @@ +#!/bin/sh +# postrm script for pnp4nagios-web +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `remove' +# * `purge' +# * `upgrade' +# * `failed-upgrade' +# * `abort-install' +# * `abort-install' +# * `abort-upgrade' +# * `disappear' +# +# for details, see http://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + purge|remove) + if [ -d /etc/apache2/conf.d/ ]; then + if [ -L /etc/apache2/conf.d/pnp4nagios.cfg ]; then + ls -l /etc/apache2/conf.d/pnp4nagios.cfg | grep -q /etc/pnp4nagios/apache.cfg + if [ $? -eq 0 ]; then + rm -f /etc/apache2/conf.d/pnp4nagios.cfg + fi + fi + fi + ;; + upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) + ;; + + *) + echo "postrm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 + diff --git a/debian/rules b/debian/rules index 6962bd4..7f945b2 100755 --- a/debian/rules +++ b/debian/rules @@ -77,104 +77,116 @@ install: build dh_prep dh_installdirs - $(MAKE) DESTDIR=$(CURDIR)/debian/pnp4nagios \ + $(MAKE) DESTDIR=$(CURDIR)/debian/tmp \ INSTALL_OPTS="--owner=root --group=root" install install-config # Ignore install.php (for future debugging don't delete it) - touch debian/pnp4nagios/usr/share/pnp4nagios/html/install.ignore + touch debian/tmp/usr/share/pnp4nagios/html/install.ignore + + mkdir -p debian/tmp/usr/share/doc/pnp4nagios/examples/ # 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 + rmdir debian/tmp/usr/share/pnp4nagios/html/templates + mkdir debian/tmp/etc/pnp4nagios/templates + mv debian/tmp/usr/share/pnp4nagios/html/templates.special \ + debian/tmp/usr/share/doc/pnp4nagios/examples/ + mkdir debian/tmp/etc/pnp4nagios/templates.special - mv debian/pnp4nagios/usr/bin/npcd \ - debian/pnp4nagios/usr/sbin/ - mv debian/pnp4nagios/etc/pnp4nagios/npcd.cfg-sample \ - debian/pnp4nagios/etc/pnp4nagios/npcd.cfg + mkdir -p debian/tmp/usr/sbin/ + mv debian/tmp/usr/bin/npcd \ + debian/tmp/usr/sbin/ + mv debian/tmp/etc/pnp4nagios/npcd.cfg-sample \ + debian/tmp/etc/pnp4nagios/npcd.cfg - mv debian/pnp4nagios/etc/pnp4nagios/process_perfdata.cfg-sample \ - debian/pnp4nagios/etc/pnp4nagios/process_perfdata.cfg + mv debian/tmp/etc/pnp4nagios/process_perfdata.cfg-sample \ + debian/tmp/etc/pnp4nagios/process_perfdata.cfg - mv debian/pnp4nagios/etc/pnp4nagios/rra.cfg-sample \ - debian/pnp4nagios/etc/pnp4nagios/rra.cfg + mv debian/tmp/etc/pnp4nagios/rra.cfg-sample \ + debian/tmp/etc/pnp4nagios/rra.cfg - mv debian/pnp4nagios/etc/pnp4nagios/nagios.cfg-sample \ - debian/pnp4nagios/usr/share/doc/pnp4nagios/examples/nagios.cfg + mv debian/tmp/etc/pnp4nagios/nagios.cfg-sample \ + debian/tmp/usr/share/doc/pnp4nagios/examples/nagios.cfg - mv debian/pnp4nagios/etc/pnp4nagios/misccommands.cfg-sample \ - debian/pnp4nagios/usr/share/doc/pnp4nagios/examples/misccommands.cfg + mv debian/tmp/etc/pnp4nagios/misccommands.cfg-sample \ + debian/tmp/usr/share/doc/pnp4nagios/examples/misccommands.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 debian/tmp/usr/share/doc/pnp4nagios/examples/check_commands + mv debian/tmp/etc/pnp4nagios/check_commands/check_nwstat.cfg-sample \ + debian/tmp/usr/share/doc/pnp4nagios/examples/check_commands/check_nwstat.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 + mkdir debian/tmp/usr/share/doc/pnp4nagios/examples/pages + mv debian/tmp/etc/pnp4nagios/pages/web_traffic.cfg-sample \ + debian/tmp/usr/share/doc/pnp4nagios/examples/pages/web_traffic.cfg - cp -av contrib/ssi debian/pnp4nagios/usr/share/doc/pnp4nagios/examples/ + cp -av contrib/ssi debian/tmp/usr/share/doc/pnp4nagios/examples/ # Remove external PHP classes/libraries: FPDF, FPDF-TPL, FPDI - 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 + rm -r debian/tmp/usr/share/pnp4nagios/html/application/vendor/fpdf # Remove external JavaScript files: jQuery and jQuery-UI - 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 + rm debian/tmp/usr/share/pnp4nagios/html/media/js/jquery-min.js + rm debian/tmp/usr/share/pnp4nagios/html/media/js/jquery-ui.min.js # Clean up some files - 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 + rmdir debian/tmp/usr/bin + mv debian/tmp/etc/pnp4nagios/check_commands/check_all_local_disks.cfg-sample \ + debian/tmp/etc/pnp4nagios/check_commands/check_all_local_disks.cfg + rm debian/tmp/etc/pnp4nagios/check_commands/check_nrpe.cfg-sample # Add Debian specific config and placeholder files - #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/ + #touch debian/tmp/etc/pnp4nagios/pages/.placeholder + cp -av debian/nagios.cfg debian/tmp/etc/pnp4nagios/ + cp -av debian/check_commands/* debian/tmp/etc/pnp4nagios/check_commands/ - cp -av sample-config/httpd.conf debian/pnp4nagios/etc/pnp4nagios/apache.conf + cp -av sample-config/httpd.conf debian/tmp/etc/pnp4nagios/apache.conf # Add subdirs to /var/spool/pnp4nagios/ to prepare for different modes - mkdir debian/pnp4nagios/var/spool/pnp4nagios/nagios - mkdir debian/pnp4nagios/var/spool/pnp4nagios/npcd + mkdir debian/tmp/var/spool/pnp4nagios/nagios + mkdir debian/tmp/var/spool/pnp4nagios/npcd # Delete not used and empty directories - #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/ + #rmdir debian/tmp/usr/share/pnp4nagios/html/application/logs/ + rmdir debian/tmp/usr/share/pnp4nagios/html/application/cache/ + rmdir debian/tmp/usr/share/pnp4nagios/html/application/hooks/ + #rmdir debian/tmp/usr/share/pnp4nagios/html/application/libraries/ + + dh_install --sourcedir=debian/tmp --fail-missing # Build architecture-independent files here. binary-indep: build install -# We have nothing to do by default. + dh_testdir + dh_testroot + dh_installchangelogs -i ChangeLog + dh_installdocs -A -i AUTHORS README + dh_installexamples -i + dh_installinit -i + dh_installman -i + dh_link -i + dh_compress -i + dh_fixperms -i + dh_installdeb -i + dh_gencontrol -i + dh_md5sums -i + dh_builddeb -i # Build architecture-dependent files here. binary-arch: build install dh_testdir dh_testroot - dh_installchangelogs ChangeLog - dh_installdocs AUTHORS README - dh_installexamples - dh_installinit - dh_installman - dh_link - dh_strip - dh_compress - dh_fixperms - dh_installdeb - dh_shlibdeps - dh_gencontrol - dh_md5sums - dh_builddeb + dh_installchangelogs -a ChangeLog + dh_installdocs -A -a AUTHORS README + dh_installexamples -a + dh_installinit -a + dh_installman -a + dh_link -a + dh_strip -a + dh_compress -a + dh_fixperms -a + dh_installdeb -a + dh_shlibdeps -a + dh_gencontrol -a + dh_md5sums -a + dh_builddeb -a binary: binary-indep binary-arch .PHONY: build clean binary-indep binary-arch binary install -- 2.30.2