1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
7 inherit depend.apache eutils
9 DESCRIPTION="A performance data analyzer for nagios"
10 HOMEPAGE="http://www.pnp4nagios.org/"
11 SRC_URI="mirror://sourceforge/${PN}/PNP-0.6/${P}.tar.gz"
16 KEYWORDS="~amd64 ~ppc ~ppc64 ~sparc ~x86"
18 # A lot of things (sync mode, for one) are broken with nagios-4.x.
20 dev-lang/php[json,simplexml,zlib,xml,filter]
22 >=net-analyzer/rrdtool-1.2[graph,perl]
23 || ( <net-analyzer/nagios-core-4 net-analyzer/icinga net-analyzer/icinga2 )"
25 # A list of modules used in our Apache config file.
26 APACHE_MODS="apache2_modules_alias," # "Alias" directive
27 APACHE_MODS+="apache2_modules_authz_core," # "Require" directive
28 APACHE_MODS+="apache2_modules_rewrite" # "RewriteEngine" and friends
31 virtual/perl-Getopt-Long
32 virtual/perl-Time-HiRes
34 apache2? ( >=www-servers/apache-2.4[${APACHE_MODS}] )"
36 # There is no want_apache2_4, but we needed to specify that manually
37 # anyway to be able to include the list of modules.
41 depend.apache_pkg_setup
45 epatch "${FILESDIR}/${PN}-0.6.14-makefile.patch"
52 if has_version net-analyzer/nagios-core; then
56 var_dir=/var/lib/icinga/
61 --sysconfdir=/etc/pnp \
62 --datarootdir=/usr/share/pnp \
63 --mandir=/usr/share/man \
64 --with-perfdata-dir=${var_dir}/perfdata \
65 --with-nagios-user=${user_group} \
66 --with-nagios-group=${user_group} \
67 --with-perfdata-logfile=${var_dir}/perfdata.log \
68 --with-perfdata-spool-dir=/var/spool/pnp
72 # The default target just shows a help
77 emake DESTDIR="${D}" install install-config
78 newinitd "${FILESDIR}"/npcd.initd npcd
79 rm "${D}/usr/share/pnp/install.php" || \
80 die "unable to remove ${D}/usr/share/pnp/install.php"
83 insinto "${APACHE_MODULES_CONFDIR}"
84 newins "${FILESDIR}"/98_pnp4nagios-2.4.conf 98_pnp4nagios.conf
86 # Allow the apache user to read our config files. This same
87 # approach is used in net-analyzer/nagios-core.
88 chgrp -R apache "${D}/etc/pnp" \
89 || die "failed to change group of ${ROOT}etc/pnp"
92 # Bug 430358 - CVE-2012-3457
93 find "${D}/etc/pnp" -type f -exec chmod 0640 '{}' + || \
94 die "unable to set file permissions under ${D}/etc/pnp"
96 find "${D}/etc/pnp" -type d -exec chmod 0750 '{}' + || \
97 die "unable to set directory permissions under ${D}/etc/pnp"
101 elog "To enable the pnp4nagios web front-end, please visit"
102 elog "${ROOT}etc/conf.d/apache2 and add \"-D PNP -D PHP5\""
103 elog "to APACHE2_OPTS. Then pnp4nagios will be available at,"
105 elog " http://localhost/pnp4nagios"