]> gitweb.michael.orlitzky.com - mjo-overlay.git/blob - net-analyzer/pnp4nagios/pnp4nagios-0.6.25.ebuild
net-analyzer/pnp4nagios: version bump fixing nagios dep and permissions.
[mjo-overlay.git] / net-analyzer / pnp4nagios / pnp4nagios-0.6.25.ebuild
1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: $
4
5 EAPI=5
6
7 inherit depend.apache eutils
8
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"
12
13 LICENSE="GPL-2"
14 SLOT="0"
15 IUSE=""
16 KEYWORDS="~amd64 ~ppc ~ppc64 ~sparc ~x86"
17
18 # A lot of things (sync mode, for one) are broken with nagios-4.x.
19 DEPEND="
20 dev-lang/php[json,simplexml,zlib,xml,filter]
21 >=dev-lang/php-5.3
22 >=net-analyzer/rrdtool-1.2[graph,perl]
23 || ( <net-analyzer/nagios-core-4 net-analyzer/icinga net-analyzer/icinga2 )"
24
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
29
30 RDEPEND="${DEPEND}
31 virtual/perl-Getopt-Long
32 virtual/perl-Time-HiRes
33 media-fonts/dejavu
34 apache2? ( >=www-servers/apache-2.4[${APACHE_MODS}] )"
35
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.
38 want_apache2
39
40 pkg_setup() {
41 depend.apache_pkg_setup
42 }
43
44 src_prepare() {
45 epatch "${FILESDIR}/${PN}-0.6.14-makefile.patch"
46 }
47
48 src_configure() {
49 local var_dir=
50 local user_group=
51
52 if has_version net-analyzer/nagios-core; then
53 var_dir=/var/nagios/
54 user_group=nagios
55 else
56 var_dir=/var/lib/icinga/
57 user_group=icinga
58 fi
59
60 econf \
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
69 }
70
71 src_compile() {
72 # The default target just shows a help
73 emake all
74 }
75
76 src_install() {
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"
81
82 if use apache2 ; then
83 insinto "${APACHE_MODULES_CONFDIR}"
84 newins "${FILESDIR}"/98_pnp4nagios-2.4.conf 98_pnp4nagios.conf
85
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"
90 fi
91
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"
95
96 find "${D}/etc/pnp" -type d -exec chmod 0750 '{}' + || \
97 die "unable to set directory permissions under ${D}/etc/pnp"
98 }
99
100 pkg_postinst() {
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,"
104 elog
105 elog " http://localhost/pnp4nagios"
106 elog
107 }