From 8a6c86311831919c79c94f0b4744e05691fe5045 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 2 Nov 2017 12:33:39 -0400 Subject: net-analyzer/pnp4nagios: new revision to fix nagios/icinga "or" dependency. Previous revisions of pnp4nagios have an "or" dependency on either Nagios or Icinga, || ( net-analyzer/nagios-core net-analyzer/icinga ... The way "or" dependencies work is that they are considered satisfied if any elements of the associated group are installed. Thus the above stanza allows Nagios and Icinga to be swapped out without rebuilding pnp4nagios. That is incorrect, since later in the ebuild, nagios- or icinga-specific paths are compiled into pnp4nagios. The usual solution to that problem is to choose a default package that satisfies the "one of these" dependency, but to allow the user to specify one with a USE flag. This new revision adds three USE flags: icinga, icinga2, and nagios. The "nagios" flag is enabled by default, and builds pnp4nagios against net-analyzer/nagios. The other flags build against the associated package. In the process, the dependency on nagios-3.x was loosened to accept nagios-4.x as well. The nagios-3.x series has been end-of-life'd, and has multiple open security bugs. Bug: https://bugs.gentoo.org/628086 Bug: https://bugs.gentoo.org/629380 Bug: https://bugs.gentoo.org/636234 Closes: https://bugs.gentoo.org/600424 Package-Manager: Portage-2.3.8, Repoman-2.3.3 --- net-analyzer/pnp4nagios/metadata.xml | 16 ++++ .../pnp4nagios/pnp4nagios-0.6.26-r1.ebuild | 105 +++++++++++++++++++++ net-analyzer/pnp4nagios/pnp4nagios-0.6.26.ebuild | 98 ------------------- 3 files changed, 121 insertions(+), 98 deletions(-) create mode 100644 net-analyzer/pnp4nagios/pnp4nagios-0.6.26-r1.ebuild delete mode 100644 net-analyzer/pnp4nagios/pnp4nagios-0.6.26.ebuild (limited to 'net-analyzer') diff --git a/net-analyzer/pnp4nagios/metadata.xml b/net-analyzer/pnp4nagios/metadata.xml index 379fdde3e076..d5799ab49c93 100644 --- a/net-analyzer/pnp4nagios/metadata.xml +++ b/net-analyzer/pnp4nagios/metadata.xml @@ -5,7 +5,23 @@ sysadmin@gentoo.org Gentoo Sysadmin Project + + + + Build against net-analyzer/nagios-core (the default) + + + Build against net-analyzer/icinga instead of + net-analyzer/nagios-core + + + Build against net-analyzer/icinga2 instead of + net-analyzer/nagios-core + + + pnp4nagios + lingej/pnp4nagios diff --git a/net-analyzer/pnp4nagios/pnp4nagios-0.6.26-r1.ebuild b/net-analyzer/pnp4nagios/pnp4nagios-0.6.26-r1.ebuild new file mode 100644 index 000000000000..c15a8c98de6f --- /dev/null +++ b/net-analyzer/pnp4nagios/pnp4nagios-0.6.26-r1.ebuild @@ -0,0 +1,105 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +DESCRIPTION="A performance data analyzer for nagios" +HOMEPAGE="http://www.pnp4nagios.org/" +SRC_URI="mirror://sourceforge/${PN}/PNP-0.6/${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +IUSE="apache2 icinga icinga2 +nagios" +KEYWORDS="~amd64 ~ppc ~ppc64 ~sparc ~x86" + +REQUIRED_USE="^^ ( icinga icinga2 nagios )" + +# Some things (sync mode, for one) are broken with nagios-4.x, but since +# nagios-3.x has been end-of-life'd, we don't have much choice here but +# to accept it. +DEPEND=" + dev-lang/php:*[filter,gd,json,simplexml,xml,zlib] + >=net-analyzer/rrdtool-1.2[graph,perl] + icinga? ( net-analyzer/icinga ) + icinga2? ( net-analyzer/icinga2 ) + nagios? ( net-analyzer/nagios-core )" + +# A list of modules used in our Apache config file. +APACHE_MODS="apache2_modules_alias," # "Alias" directive +APACHE_MODS+="apache2_modules_authz_core," # "Require" directive +APACHE_MODS+="apache2_modules_rewrite" # "RewriteEngine" and friends + +RDEPEND="${DEPEND} + virtual/perl-Getopt-Long + virtual/perl-Time-HiRes + media-fonts/dejavu + apache2? ( >=www-servers/apache-2.4[${APACHE_MODS}] )" + +PATCHES=( "${FILESDIR}/${PN}-0.6.14-makefile.patch" ) + +src_configure() { + local var_dir user_group + + if use icinga; then + var_dir=/var/lib/icinga + user_group=icinga + elif use icinga2; then + var_dir=/var/lib/icinga2 + user_group=icinga + else + # Thanks to REQUIRED_USE, "use nagios" is the only other case. + var_dir=/var/nagios + user_group=nagios + fi + + econf \ + --sysconfdir="${EPREFIX}"/etc/pnp \ + --datarootdir="${EPREFIX}"/usr/share/pnp \ + --with-perfdata-dir="${EPREFIX}"${var_dir}/perfdata \ + --with-nagios-user=${user_group} \ + --with-nagios-group=${user_group} \ + --with-perfdata-logfile="${EPREFIX}"${var_dir}/perfdata.log \ + --with-perfdata-spool-dir="${EPREFIX}"/var/spool/pnp +} + +src_compile() { + # The default target just shows a help + emake all +} + +src_install() { + emake DESTDIR="${D}" install install-config + einstalldocs + newinitd "${FILESDIR}"/npcd.initd npcd + rm "${ED%/}/usr/share/pnp/install.php" || \ + die "unable to remove ${ED%/}/usr/share/pnp/install.php" + + if use apache2 ; then + insinto "${APACHE_MODULES_CONFDIR}" + newins "${FILESDIR}"/98_pnp4nagios-2.4.conf 98_pnp4nagios.conf + + # Allow the apache user to read our config files. This same + # approach is used in net-analyzer/nagios-core. + chgrp -R apache "${ED%/}/etc/pnp" \ + || die "failed to change group of ${ED%/}/etc/pnp" + fi + + # Bug 430358 - CVE-2012-3457 + local f + while IFS="" read -d $'\0' -r f ; do + chmod 0640 "${f}" || die + done < <(find "${ED%/}/etc/pnp" -type f) + + while IFS="" read -d $'\0' -r f ; do + chmod 0750 "${f}" || die + done < <(find "${ED%/}/etc/pnp" -type d) +} + +pkg_postinst() { + elog "To enable the pnp4nagios web front-end, please visit" + elog "${EROOT%/}/etc/conf.d/apache2 and add \"-D PNP -D PHP5\"" + elog "to APACHE2_OPTS. Then pnp4nagios will be available at," + elog + elog " http://localhost/pnp4nagios" + elog +} diff --git a/net-analyzer/pnp4nagios/pnp4nagios-0.6.26.ebuild b/net-analyzer/pnp4nagios/pnp4nagios-0.6.26.ebuild deleted file mode 100644 index 06416fc0d985..000000000000 --- a/net-analyzer/pnp4nagios/pnp4nagios-0.6.26.ebuild +++ /dev/null @@ -1,98 +0,0 @@ -# Copyright 1999-2017 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -EAPI=6 - -DESCRIPTION="A performance data analyzer for nagios" -HOMEPAGE="http://www.pnp4nagios.org/" -SRC_URI="mirror://sourceforge/${PN}/PNP-0.6/${P}.tar.gz" - -LICENSE="GPL-2" -SLOT="0" -IUSE="apache2" -KEYWORDS="~amd64 ~ppc ~ppc64 ~sparc ~x86" - -# A lot of things (sync mode, for one) are broken with nagios-4.x. -DEPEND=" - dev-lang/php:*[filter,gd,json,simplexml,xml,zlib] - >=net-analyzer/rrdtool-1.2[graph,perl] - || (