Gentoo Archives: gentoo-commits

From: Matt Thode <prometheanfire@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-analyzer/pnp4nagios/
Date: Wed, 16 Dec 2015 22:12:04
Message-Id: 1450303886.e754036202667776fef04ba66c0dd04bc8dd76ea.prometheanfire@gentoo
1 commit: e754036202667776fef04ba66c0dd04bc8dd76ea
2 Author: Matthew Thode <prometheanfire <AT> gentoo <DOT> org>
3 AuthorDate: Wed Dec 16 22:11:26 2015 +0000
4 Commit: Matt Thode <prometheanfire <AT> gentoo <DOT> org>
5 CommitDate: Wed Dec 16 22:11:26 2015 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e7540362
7
8 net-analyzer/pnp4nagios: fix bug 568444
9
10 Package-Manager: portage-2.2.24
11
12 .../pnp4nagios/pnp4nagios-0.6.25-r1.ebuild | 106 +++++++++++++++++++++
13 1 file changed, 106 insertions(+)
14
15 diff --git a/net-analyzer/pnp4nagios/pnp4nagios-0.6.25-r1.ebuild b/net-analyzer/pnp4nagios/pnp4nagios-0.6.25-r1.ebuild
16 new file mode 100644
17 index 0000000..7bbcb57
18 --- /dev/null
19 +++ b/net-analyzer/pnp4nagios/pnp4nagios-0.6.25-r1.ebuild
20 @@ -0,0 +1,106 @@
21 +# Copyright 1999-2015 Gentoo Foundation
22 +# Distributed under the terms of the GNU General Public License v2
23 +# $Id$
24 +
25 +EAPI=5
26 +
27 +inherit depend.apache eutils
28 +
29 +DESCRIPTION="A performance data analyzer for nagios"
30 +HOMEPAGE="http://www.pnp4nagios.org/"
31 +SRC_URI="mirror://sourceforge/${PN}/PNP-0.6/${P}.tar.gz"
32 +
33 +LICENSE="GPL-2"
34 +SLOT="0"
35 +IUSE=""
36 +KEYWORDS="~amd64 ~ppc ~ppc64 ~sparc ~x86"
37 +
38 +# A lot of things (sync mode, for one) are broken with nagios-4.x.
39 +DEPEND="
40 + dev-lang/php:*[filter,gd,json,simplexml,xml,zlib]
41 + >=net-analyzer/rrdtool-1.2[graph,perl]
42 + || ( <net-analyzer/nagios-core-4 net-analyzer/icinga net-analyzer/icinga2 )"
43 +
44 +# A list of modules used in our Apache config file.
45 +APACHE_MODS="apache2_modules_alias," # "Alias" directive
46 +APACHE_MODS+="apache2_modules_authz_core," # "Require" directive
47 +APACHE_MODS+="apache2_modules_rewrite" # "RewriteEngine" and friends
48 +
49 +RDEPEND="${DEPEND}
50 + virtual/perl-Getopt-Long
51 + virtual/perl-Time-HiRes
52 + media-fonts/dejavu
53 + apache2? ( >=www-servers/apache-2.4[${APACHE_MODS}] )"
54 +
55 +# There is no want_apache2_4, but we needed to specify that manually
56 +# anyway to be able to include the list of modules.
57 +want_apache2
58 +
59 +pkg_setup() {
60 + depend.apache_pkg_setup
61 +}
62 +
63 +src_prepare() {
64 + epatch "${FILESDIR}/${PN}-0.6.14-makefile.patch"
65 +}
66 +
67 +src_configure() {
68 + local var_dir=
69 + local user_group=
70 +
71 + if has_version net-analyzer/nagios-core; then
72 + var_dir=/var/nagios/
73 + user_group=nagios
74 + else
75 + var_dir=/var/lib/icinga/
76 + user_group=icinga
77 + fi
78 +
79 + econf \
80 + --sysconfdir=/etc/pnp \
81 + --datarootdir=/usr/share/pnp \
82 + --mandir=/usr/share/man \
83 + --with-perfdata-dir=${var_dir}/perfdata \
84 + --with-nagios-user=${user_group} \
85 + --with-nagios-group=${user_group} \
86 + --with-perfdata-logfile=${var_dir}/perfdata.log \
87 + --with-perfdata-spool-dir=/var/spool/pnp
88 +}
89 +
90 +src_compile() {
91 + # The default target just shows a help
92 + emake all
93 +}
94 +
95 +src_install() {
96 + emake DESTDIR="${D}" install install-config
97 + newinitd "${FILESDIR}"/npcd.initd npcd
98 + rm "${D}/usr/share/pnp/install.php" || \
99 + die "unable to remove ${D}/usr/share/pnp/install.php"
100 +
101 + if use apache2 ; then
102 + insinto "${APACHE_MODULES_CONFDIR}"
103 + newins "${FILESDIR}"/98_pnp4nagios-2.4.conf 98_pnp4nagios.conf
104 +
105 + # Allow the apache user to read our config files. This same
106 + # approach is used in net-analyzer/nagios-core.
107 + chgrp -R apache "${D}/etc/pnp" \
108 + || die "failed to change group of ${ROOT}etc/pnp"
109 + fi
110 +
111 + # Bug 430358 - CVE-2012-3457
112 + find "${D}/etc/pnp" -type f -exec chmod 0640 '{}' + || \
113 + die "unable to set file permissions under ${D}/etc/pnp"
114 +
115 + find "${D}/etc/pnp" -type d -exec chmod 0750 '{}' + || \
116 + die "unable to set directory permissions under ${D}/etc/pnp"
117 +}
118 +
119 +pkg_postinst() {
120 + elog "To enable the pnp4nagios web front-end, please visit"
121 + elog "${ROOT}etc/conf.d/apache2 and add \"-D PNP -D PHP5\""
122 + elog "to APACHE2_OPTS. Then pnp4nagios will be available at,"
123 + elog
124 + elog " http://localhost/pnp4nagios"
125 + elog
126 +}