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: Mon, 01 Feb 2016 14:45:46
Message-Id: 1454337912.21dfadf1142d36f3a591ecadb39b28a29aa8c84f.prometheanfire@gentoo
1 commit: 21dfadf1142d36f3a591ecadb39b28a29aa8c84f
2 Author: Matthew Thode <prometheanfire <AT> gentoo <DOT> org>
3 AuthorDate: Mon Feb 1 14:45:12 2016 +0000
4 Commit: Matt Thode <prometheanfire <AT> gentoo <DOT> org>
5 CommitDate: Mon Feb 1 14:45:12 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=21dfadf1
7
8 net-analyzer/pnp4nagios: fixing bug 543120, add icinga2 specifics
9
10 Package-Manager: portage-2.2.26
11
12 .../pnp4nagios/pnp4nagios-0.6.25-r2.ebuild | 109 +++++++++++++++++++++
13 1 file changed, 109 insertions(+)
14
15 diff --git a/net-analyzer/pnp4nagios/pnp4nagios-0.6.25-r2.ebuild b/net-analyzer/pnp4nagios/pnp4nagios-0.6.25-r2.ebuild
16 new file mode 100644
17 index 0000000..4e25195
18 --- /dev/null
19 +++ b/net-analyzer/pnp4nagios/pnp4nagios-0.6.25-r2.ebuild
20 @@ -0,0 +1,109 @@
21 +# Copyright 1999-2016 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 + elif has_version net-analyzer/icinga2; then
75 + var_dir=/var/lib/icing2/
76 + user_group=icinga
77 + else
78 + var_dir=/var/lib/icinga/
79 + user_group=icinga
80 + fi
81 +
82 + econf \
83 + --sysconfdir=/etc/pnp \
84 + --datarootdir=/usr/share/pnp \
85 + --mandir=/usr/share/man \
86 + --with-perfdata-dir=${var_dir}/perfdata \
87 + --with-nagios-user=${user_group} \
88 + --with-nagios-group=${user_group} \
89 + --with-perfdata-logfile=${var_dir}/perfdata.log \
90 + --with-perfdata-spool-dir=/var/spool/pnp
91 +}
92 +
93 +src_compile() {
94 + # The default target just shows a help
95 + emake all
96 +}
97 +
98 +src_install() {
99 + emake DESTDIR="${D}" install install-config
100 + newinitd "${FILESDIR}"/npcd.initd npcd
101 + rm "${D}/usr/share/pnp/install.php" || \
102 + die "unable to remove ${D}/usr/share/pnp/install.php"
103 +
104 + if use apache2 ; then
105 + insinto "${APACHE_MODULES_CONFDIR}"
106 + newins "${FILESDIR}"/98_pnp4nagios-2.4.conf 98_pnp4nagios.conf
107 +
108 + # Allow the apache user to read our config files. This same
109 + # approach is used in net-analyzer/nagios-core.
110 + chgrp -R apache "${D}/etc/pnp" \
111 + || die "failed to change group of ${ROOT}etc/pnp"
112 + fi
113 +
114 + # Bug 430358 - CVE-2012-3457
115 + find "${D}/etc/pnp" -type f -exec chmod 0640 '{}' + || \
116 + die "unable to set file permissions under ${D}/etc/pnp"
117 +
118 + find "${D}/etc/pnp" -type d -exec chmod 0750 '{}' + || \
119 + die "unable to set directory permissions under ${D}/etc/pnp"
120 +}
121 +
122 +pkg_postinst() {
123 + elog "To enable the pnp4nagios web front-end, please visit"
124 + elog "${ROOT}etc/conf.d/apache2 and add \"-D PNP -D PHP5\""
125 + elog "to APACHE2_OPTS. Then pnp4nagios will be available at,"
126 + elog
127 + elog " http://localhost/pnp4nagios"
128 + elog
129 +}