Gentoo Archives: gentoo-commits

From: Michael Orlitzky <mjo@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-analyzer/nagios-core/
Date: Mon, 31 Aug 2015 14:13:36
Message-Id: 1441030390.b48fff5bb89a4f4cfdaa8ff4e6c5cacefbbd1257.mjo@gentoo
1 commit: b48fff5bb89a4f4cfdaa8ff4e6c5cacefbbd1257
2 Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
3 AuthorDate: Mon Aug 31 13:24:55 2015 +0000
4 Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
5 CommitDate: Mon Aug 31 14:13:10 2015 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b48fff5b
7
8 net-analyzer/nagios-core: version bump to v4.1.1.
9
10 In addition to the version bump, we now have to make the "html" target
11 in src_compile. This requires DEPEND="app-arch/unzip" to unpack
12 AngularJS. The perf data warnings patch has been applied upstream, so
13 the corresponding epatch has been removed. "Any slot" operators were
14 also added to the dev-lang/php deps to appease repoman.
15
16 Package-Manager: portage-2.2.20.1
17
18 net-analyzer/nagios-core/Manifest | 1 +
19 net-analyzer/nagios-core/nagios-core-4.1.1.ebuild | 268 ++++++++++++++++++++++
20 2 files changed, 269 insertions(+)
21
22 diff --git a/net-analyzer/nagios-core/Manifest b/net-analyzer/nagios-core/Manifest
23 index 7e3a9fd..9927c29 100644
24 --- a/net-analyzer/nagios-core/Manifest
25 +++ b/net-analyzer/nagios-core/Manifest
26 @@ -1,3 +1,4 @@
27 DIST nagios-3.5.1.tar.gz 1763584 SHA256 ca9dd68234fa090b3c35ecc8767b2c9eb743977eaf32612fa9b8341cc00a0f99 SHA512 48e2ecb91002b08203937b12a438c87c62cd3c5c401a0ed9e861cd6d79074c7017ed373e9379f013d87dea1fd7cb8e3d85112d55c87ac91aed96b256868c112d WHIRLPOOL 2c02584702c64dbb0e353e34b758fab079eee0dc7a401e7b5947a21733758d3596401e5519e2dd7f05c89ee4835c21965d2718157fd9d6d3d20af9c853d688ca
28 DIST nagios-4.0.8.tar.gz 1805059 SHA256 8b268d250c97851775abe162f46f64724f95f367d752ae4630280cc5d368ca4b SHA512 d72fdbcc0beb2de72e5aa788b4ccc83aa30c7f4a4460edaa831f012db04647e4836b876bb7dc235e2a1b525827e9a2a0f4d348919f69fbfbfdaa4d13e968e18c WHIRLPOOL bdd9c63e0e495073b7b046952baa50b9e448fa56cda167806546a3b58fdd8fad328c9285ebb6d07da81786676d805671cad7295be389c4b8a4f3971264c97f74
29 +DIST nagios-4.1.1.tar.gz 11142182 SHA256 58218e5e66c8078fc578a60db33b5c3da10fc6a793e97d2b00780517e3efa0a7 SHA512 09e7c335666efd7180dcc8766abfdc6482f9ef4dceb4bee076b99652c04cb2e04555a1afeec2e6ef8c5556f7ae8fb684e17db0aa5e869915e4684af2c2183565 WHIRLPOOL 4b03cb5193284a32a6b0dc979849b7ab31f903f628b449953807b18401307cd7290b91296407d5ce21ebdcd8d7f4d8ed047ea99e0c307327f41fe6b3a69a5b46
30 DIST nagios-core-gentoo-icons-20141125.tar 40960 SHA256 68b715f636eb291343cab3259862bbed8b6b898520b58df522438524de3d8761 SHA512 bf109879cddd6136b76baba55d0b60b2596e37431dcf5ce0905d34a9fa292ebf7e4bde82d9a084362c486e8fac344c76d88f9298b1b85541ed70ffd608493766 WHIRLPOOL 7ec3a944b2a659b456d3168818ca5b1af3a427436e6af2f3e5d6cba6fc7b1c7bad6f552301f064df31988865b3b32fd117d9e6f61c630d6d817a51cbbbcb331d
31
32 diff --git a/net-analyzer/nagios-core/nagios-core-4.1.1.ebuild b/net-analyzer/nagios-core/nagios-core-4.1.1.ebuild
33 new file mode 100644
34 index 0000000..69a4faa
35 --- /dev/null
36 +++ b/net-analyzer/nagios-core/nagios-core-4.1.1.ebuild
37 @@ -0,0 +1,268 @@
38 +# Copyright 1999-2015 Gentoo Foundation
39 +# Distributed under the terms of the GNU General Public License v2
40 +# $Id$
41 +
42 +EAPI=5
43 +
44 +inherit depend.apache eutils multilib toolchain-funcs user
45 +
46 +MY_P=${PN/-core}-${PV}
47 +DESCRIPTION="Nagios core - monitoring daemon, web GUI, and documentation"
48 +HOMEPAGE="http://www.nagios.org/"
49 +
50 +# The name of the directory into which our Gentoo icons will be
51 +# extracted, and also the basename of the archive containing it.
52 +GENTOO_ICONS="${PN}-gentoo-icons-20141125"
53 +SRC_URI="mirror://sourceforge/nagios/${MY_P}.tar.gz
54 + web? ( https://dev.gentoo.org/~mjo/distfiles/${GENTOO_ICONS}.tar )"
55 +
56 +LICENSE="GPL-2"
57 +SLOT="0"
58 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ppc ~ppc64 ~sparc ~x86"
59 +IUSE="classicui lighttpd perl +web vim-syntax"
60 +
61 +# In pkg_postinst(), we change the group of the Nagios configuration
62 +# directory to that of the web server user. It can't belong to both
63 +# apache/lighttpd groups at the same time, so we block this combination
64 +# for our own sanity.
65 +#
66 +# This could be made to work, but we would need a better way to allow
67 +# the web user read-only access to Nagios's configuration directory.
68 +#
69 +REQUIRED_USE="apache2? ( !lighttpd )"
70 +
71 +# sys-devel/libtool dependency is bug #401237.
72 +#
73 +# Note, we require one of the apache2 CGI modules:
74 +#
75 +# * mod_cgi
76 +# * mod_cgid
77 +# * mod_fcgid
78 +#
79 +# We just don't care /which/ one. And of course PHP supports both CGI
80 +# (USE=cgi) and FastCGI (USE=fpm). We're pretty lenient with the
81 +# dependencies, and expect the user not to do anything /too/
82 +# stupid. (For example, installing Apache with only FastCGI support, and
83 +# PHP with only CGI support.)
84 +#
85 +# Another annoyance is that the upstream Makefile uses app-arch/unzip to
86 +# extract a snapshot of AngularJS, but that's only needed when USE=web.
87 +#
88 +MOD_ALIAS=apache2_modules_alias
89 +DEPEND="sys-devel/libtool
90 + virtual/mailx
91 + perl? ( dev-lang/perl )
92 + web? (
93 + app-arch/unzip
94 + media-libs/gd[jpeg,png]
95 + lighttpd? ( www-servers/lighttpd[php] )
96 + apache2? (
97 + || (
98 + >=www-servers/apache-2.4[${MOD_ALIAS},apache2_modules_cgi]
99 + >=www-servers/apache-2.4[${MOD_ALIAS},apache2_modules_cgid]
100 + >=www-servers/apache-2.4[${MOD_ALIAS},apache2_modules_fcgid] )
101 + || (
102 + dev-lang/php:*[apache2]
103 + dev-lang/php:*[cgi]
104 + dev-lang/php:*[fpm] )
105 + )
106 + )"
107 +RDEPEND="${DEPEND}
108 + vim-syntax? ( app-vim/nagios-syntax )"
109 +
110 +want_apache2
111 +
112 +S="${WORKDIR}/${MY_P}"
113 +
114 +pkg_setup() {
115 + depend.apache_pkg_setup
116 +
117 + enewgroup nagios
118 + enewuser nagios -1 /bin/bash /var/nagios/home nagios
119 +}
120 +
121 +src_prepare(){
122 + # Upstream bug, fixes a QA warning:
123 + #
124 + # http://tracker.nagios.org/view.php?id=650
125 + #
126 + epatch "${FILESDIR}"/use-MAKE-instead-of-bare-make.patch
127 +
128 + # Upstream bug:
129 + #
130 + # http://tracker.nagios.org/view.php?id=651
131 + #
132 + # Gentoo bug #388321.
133 + #
134 + epatch "${FILESDIR}"/use-INSTALL-to-install-themes.patch
135 +}
136 +
137 +src_configure() {
138 + local myconf
139 +
140 + if use perl; then
141 + myconf="${myconf} --enable-embedded-perl --with-perlcache"
142 + fi
143 +
144 + if use !apache2 && use !lighttpd ; then
145 + myconf="${myconf} --with-command-group=nagios"
146 + else
147 + if use apache2 ; then
148 + myconf="${myconf} --with-command-group=apache"
149 + myconf="${myconf} --with-httpd-conf=/etc/apache2/conf.d"
150 + elif use lighttpd ; then
151 + myconf="${myconf} --with-command-group=lighttpd"
152 + fi
153 + fi
154 +
155 + econf ${myconf} \
156 + --prefix=/usr \
157 + --bindir=/usr/sbin \
158 + --sbindir=/usr/$(get_libdir)/nagios/cgi-bin \
159 + --datadir=/usr/share/nagios/htdocs \
160 + --localstatedir=/var/nagios \
161 + --sysconfdir=/etc/nagios \
162 + --libexecdir=/usr/$(get_libdir)/nagios/plugins
163 +}
164 +
165 +src_compile() {
166 + emake CC=$(tc-getCC) nagios
167 +
168 + if use web; then
169 + # Only compile the CGIs/HTML when USE=web is set.
170 + emake CC=$(tc-getCC) DESTDIR="${D}" cgis html
171 + fi
172 +}
173 +
174 +src_install() {
175 + dodoc Changelog INSTALLING LEGAL README.asciidoc UPGRADING
176 +
177 + emake DESTDIR="${D}" install-base
178 + emake DESTDIR="${D}" install-basic
179 + emake DESTDIR="${D}" install-config
180 + emake DESTDIR="${D}" install-commandmode
181 +
182 + if use web; then
183 + emake DESTDIR="${D}" install-cgis
184 +
185 + # install-html installs the new exfoliation theme
186 + emake DESTDIR="${D}" install-html
187 +
188 + if use classicui; then
189 + # This overwrites the already-installed exfoliation theme
190 + emake DESTDIR="${D}" install-classicui
191 + fi
192 +
193 + # Install cute Gentoo icons (bug #388323), setting their
194 + # owner, group, and mode to match those of the rest of Nagios's
195 + # images.
196 + insopts --group=nagios --owner=nagios --mode=0664
197 + insinto /usr/share/nagios/htdocs/images/logos
198 + doins "${WORKDIR}/${GENTOO_ICONS}"/*.*
199 + insopts --mode=0644 # Back to the default...
200 + fi
201 +
202 + newinitd "${FILESDIR}"/nagios4 nagios
203 + newconfd "${FILESDIR}"/conf.d nagios
204 +
205 + if use web ; then
206 + if use apache2 ; then
207 + # Install the Nagios configuration file for Apache.
208 + insinto "${APACHE_MODULES_CONFDIR}"
209 + doins "${FILESDIR}"/99_nagios4.conf
210 + elif use lighttpd ; then
211 + # Install the Nagios configuration file for Lighttpd.
212 + insinto /etc/lighttpd
213 + newins "${FILESDIR}/lighttpd_nagios4.conf" nagios.conf
214 + else
215 + ewarn "${CATEGORY}/${PF} only supports apache or lighttpd"
216 + ewarn "out of the box. Since you are not using one of them, you"
217 + ewarn "will have to configure your webserver yourself."
218 + fi
219 + fi
220 +
221 + for dir in etc/nagios var/nagios ; do
222 + chown -R nagios:nagios "${D}/${dir}" \
223 + || die "failed chown of ${D}/${dir}"
224 + done
225 +
226 + chown -R root:root "${D}/usr/$(get_libdir)/nagios" \
227 + || die "failed chown of ${D}/usr/$(get_libdir)/nagios"
228 +
229 + # The following two find...exec statements will die properly as long
230 + # as chmod is only called once (that is, as long as the argument
231 + # list is small enough).
232 + find "${D}/usr/$(get_libdir)/nagios" -type d \
233 + -exec chmod 755 '{}' + || die 'failed to make nagios dirs traversable'
234 +
235 + if use web; then
236 + find "${D}/usr/$(get_libdir)/nagios/cgi-bin" -type f \
237 + -exec chmod 755 '{}' + || die 'failed to make cgi-bins executable'
238 + fi
239 +
240 + keepdir /etc/nagios
241 + keepdir /var/nagios
242 + keepdir /var/nagios/archives
243 + keepdir /var/nagios/rw
244 + keepdir /var/nagios/spool/checkresults
245 +
246 + if use !apache2 && use !lighttpd; then
247 + chown -R nagios:nagios "${D}"/var/nagios/rw \
248 + || die "failed chown of ${D}/var/nagios/rw"
249 + else
250 + if use apache2 ; then
251 + chown -R nagios:apache "${D}"/var/nagios/rw \
252 + || die "failed chown of ${D}/var/nagios/rw"
253 + elif use lighttpd ; then
254 + chown -R nagios:lighttpd "${D}"/var/nagios/rw \
255 + || die "failed chown of ${D}/var/nagios/rw"
256 + fi
257 + fi
258 +
259 + chmod ug+s "${D}"/var/nagios/rw || die "failed chmod of ${D}/var/nagios/rw"
260 + chmod 0750 "${D}"/etc/nagios || die "failed chmod of ${D}/etc/nagios"
261 +}
262 +
263 +pkg_postinst() {
264 +
265 + if use web; then
266 + elog "Note that your web server user requires read-only access to"
267 + elog "${ROOT}etc/nagios."
268 +
269 + if use apache2 || use lighttpd ; then
270 + elog
271 + elog "To that end, we have changed the group of ${ROOT}etc/nagios"
272 + elog "to that of your web server user."
273 + elog
274 + if use apache2; then
275 + chown nagios:apache "${ROOT}etc/nagios" \
276 + || die "failed to change group of ${ROOT}etc/nagios"
277 +
278 + elog "To enable the Nagios web front-end, please edit"
279 + elog "${ROOT}etc/conf.d/apache2 and add \"-D NAGIOS -D PHP5\""
280 + elog "to APACHE2_OPTS. Then Nagios will be available at,"
281 + elog
282 + elif use lighttpd; then
283 + chown nagios:lighttpd "${ROOT}etc/nagios" \
284 + || die "failed to change group of ${ROOT}etc/nagios"
285 + elog "To enable the Nagios web front-end, please add"
286 + elog "'include \"nagios.conf\"' to the lighttpd configuration"
287 + elog "file at ${ROOT}etc/lighttpd/lighttpd.conf. Then Nagios"
288 + elog "will be available at,"
289 + elog
290 + fi
291 +
292 + elog " http://localhost/nagios/"
293 + else
294 + elog "Since you're not using either Apache or Lighttpd, you"
295 + elog "will have to grant the necessary permissions yourself."
296 + fi
297 + fi
298 +
299 + elog
300 + elog "If your kernel has /proc protection, nagios"
301 + elog "will not be happy as it relies on accessing the proc"
302 + elog "filesystem. You can fix this by adding nagios into"
303 + elog "the group wheel, but this is not recomended."
304 + elog
305 +}