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: Sun, 10 May 2020 11:26:24
Message-Id: 1589109920.0e6eece7f3c5e2e1bc1f6d2b55287bd995ce1e12.mjo@gentoo
1 commit: 0e6eece7f3c5e2e1bc1f6d2b55287bd995ce1e12
2 Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
3 AuthorDate: Sat May 9 22:59:12 2020 +0000
4 Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
5 CommitDate: Sun May 10 11:25:20 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0e6eece7
7
8 net-analyzer/nagios-core: new EAPI=7 version 4.4.6 with gcc-10.x fix.
9
10 Package-Manager: Portage-2.3.99, Repoman-2.3.22
11 Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>
12
13 net-analyzer/nagios-core/Manifest | 1 +
14 net-analyzer/nagios-core/nagios-core-4.4.6.ebuild | 252 ++++++++++++++++++++++
15 2 files changed, 253 insertions(+)
16
17 diff --git a/net-analyzer/nagios-core/Manifest b/net-analyzer/nagios-core/Manifest
18 index ee90e3714d7..98f6770b493 100644
19 --- a/net-analyzer/nagios-core/Manifest
20 +++ b/net-analyzer/nagios-core/Manifest
21 @@ -1,2 +1,3 @@
22 DIST nagios-4.4.5.tar.gz 11304463 BLAKE2B e1152c2cd14aa790fbdb84c0d7b3eb4691b05793640bf2871bc4ab1e2d645bb52bb2d1660b7389fb26d599d015f71820988ed1cd58003ed978dd9df38c357675 SHA512 14372e2e4470229bd000a8ad94def6ae504ce3f8e2cf94a9da73736560d1e3b2633302fe232ee7099d88ba00aecde5a9e352901828d6d9a9cd1fdce203deca30
23 +DIST nagios-4.4.6.tar.gz 11333414 BLAKE2B b64d34c9267349582cb43500b7b90f7948152b5fd9b28ecb0a376d0255ec9774e693beba9205512294b07dddc4702f37d0f45b3c3fcc6abbf8e8b4d9236d0ace SHA512 6ceb582816ec741439963bde1fe8d85fa3bc4ed3c2238fb818db0c4f4224a4333d153040c11a7f4d783e919c11f9ff45907bdc478504e4155f64a4c575f80550
24 DIST nagios-core-gentoo-icons-20141125.tar 40960 BLAKE2B 31c1953e1160c7c7b89606b72b1a80407e4c1b7a7938b40bd1c577cd0c309dd88ca6b775d692a9b846dbf67736537fa9c91e56aa15fdd447769608ca525bff09 SHA512 bf109879cddd6136b76baba55d0b60b2596e37431dcf5ce0905d34a9fa292ebf7e4bde82d9a084362c486e8fac344c76d88f9298b1b85541ed70ffd608493766
25
26 diff --git a/net-analyzer/nagios-core/nagios-core-4.4.6.ebuild b/net-analyzer/nagios-core/nagios-core-4.4.6.ebuild
27 new file mode 100644
28 index 00000000000..e6228fde403
29 --- /dev/null
30 +++ b/net-analyzer/nagios-core/nagios-core-4.4.6.ebuild
31 @@ -0,0 +1,252 @@
32 +# Copyright 1999-2020 Gentoo Authors
33 +# Distributed under the terms of the GNU General Public License v2
34 +
35 +EAPI=7
36 +
37 +inherit toolchain-funcs
38 +
39 +MY_P="${PN/-core}-${PV}"
40 +DESCRIPTION="Nagios core - monitoring daemon, web GUI, and documentation"
41 +HOMEPAGE="https://www.nagios.org/"
42 +
43 +# The name of the directory into which our Gentoo icons will be
44 +# extracted, and also the basename of the archive containing it.
45 +GENTOO_ICONS="${PN}-gentoo-icons-20141125"
46 +SRC_URI="mirror://sourceforge/nagios/${MY_P}.tar.gz
47 + web? ( https://dev.gentoo.org/~mjo/distfiles/${GENTOO_ICONS}.tar )"
48 +
49 +LICENSE="GPL-2"
50 +SLOT="0"
51 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~ppc ~ppc64 ~sparc ~x86"
52 +IUSE="apache2 classicui lighttpd perl +web vim-syntax"
53 +
54 +# In pkg_postinst(), we change the group of the Nagios configuration
55 +# directory to that of the web server user. It can't belong to both
56 +# apache/lighttpd groups at the same time, so we block this combination
57 +# for our own sanity.
58 +#
59 +# This could be made to work, but we would need a better way to allow
60 +# the web user read-only access to Nagios's configuration directory.
61 +#
62 +REQUIRED_USE="apache2? ( !lighttpd )"
63 +
64 +#
65 +# Note, we require one of the apache2 CGI modules:
66 +#
67 +# * mod_cgi (USE=apache2_modules_cgi)
68 +# * mod_cgid (USE=apache2_modules_cgid)
69 +# * mod_fcgid (www-apache/mod_fcgid)
70 +#
71 +# We just don't care /which/ one. And of course PHP supports both CGI
72 +# (USE=cgi) and FastCGI (USE=fpm). We're pretty lenient with the
73 +# dependencies, and expect the user not to do anything /too/
74 +# stupid. (For example, installing Apache with only FastCGI support, and
75 +# PHP with only CGI support.)
76 +#
77 +# Another annoyance is that the upstream Makefile uses app-arch/unzip to
78 +# extract a snapshot of AngularJS, but that's only needed when USE=web.
79 +#
80 +MOD_ALIAS=apache2_modules_alias
81 +
82 +# The dependencies checked by the configure script. All of these are
83 +# also runtime dependencies; that's why ./configure checks for them.
84 +CONFIGURE_DEPEND="acct-group/nagios
85 + acct-user/nagios
86 + virtual/mailx
87 + perl? ( dev-lang/perl:= )"
88 +
89 +# In addition to the things that the ./configure script checks for,
90 +# we also need to be able to unzip stuff on the build host.
91 +BDEPEND="${CONFIGURE_DEPEND} web? ( app-arch/unzip )"
92 +
93 +# This is linked into /usr/bin/nagios{,tats}
94 +DEPEND="dev-libs/libltdl:0"
95 +
96 +RDEPEND="${CONFIGURE_DEPEND}
97 + ${DEPEND}
98 + web? (
99 + media-libs/gd[jpeg,png]
100 + lighttpd? ( www-servers/lighttpd[php] )
101 + apache2? (
102 + || (
103 + www-servers/apache[${MOD_ALIAS},apache2_modules_cgi]
104 + www-servers/apache[${MOD_ALIAS},apache2_modules_cgid]
105 + ( www-servers/apache[${MOD_ALIAS}] www-apache/mod_fcgid ) )
106 + || (
107 + dev-lang/php:*[apache2]
108 + dev-lang/php:*[cgi]
109 + dev-lang/php:*[fpm] )
110 + )
111 + )
112 + vim-syntax? ( app-vim/nagios-syntax )"
113 +
114 +S="${WORKDIR}/${MY_P}"
115 +
116 +src_configure() {
117 + local myconf
118 +
119 + if use perl; then
120 + myconf="${myconf} --enable-embedded-perl --with-perlcache"
121 + fi
122 +
123 + if use !apache2 && use !lighttpd ; then
124 + myconf="${myconf} --with-command-group=nagios"
125 + else
126 + if use apache2 ; then
127 + myconf="${myconf} --with-command-group=apache"
128 + myconf="${myconf} --with-httpd-conf=/etc/apache2/conf.d"
129 + elif use lighttpd ; then
130 + myconf="${myconf} --with-command-group=lighttpd"
131 + fi
132 + fi
133 +
134 + econf ${myconf} \
135 + --prefix="${EPREFIX}/usr" \
136 + --bindir="${EPREFIX}/usr/sbin" \
137 + --localstatedir="${EPREFIX}/var/lib/nagios" \
138 + --sysconfdir="${EPREFIX}/etc/nagios" \
139 + --libexecdir="${EPREFIX}/usr/$(get_libdir)/nagios/plugins" \
140 + --with-cgibindir="${EPREFIX}/usr/$(get_libdir)/nagios/cgi-bin" \
141 + --with-webdir="${EPREFIX}/usr/share/nagios/htdocs"
142 +
143 + # The paths in the web server configuration files need to match
144 + # those passed to econf above.
145 + cp "${FILESDIR}/99_nagios4-r1.conf" \
146 + "${FILESDIR}/lighttpd_nagios4-r1.conf" \
147 + "${T}/" || die "failed to create copies of web server conf files"
148 +
149 + sed -e "s|@CGIBINDIR@|${EPREFIX}/usr/$(get_libdir)/nagios/cgi-bin|g" \
150 + -e "s|@WEBDIR@|${EPREFIX}/usr/share/nagios/htdocs|" \
151 + -i "${T}/99_nagios4-r1.conf" \
152 + -i "${T}/lighttpd_nagios4-r1.conf" \
153 + || die "failed to substitute paths into web server conf files"
154 +
155 +}
156 +
157 +src_compile() {
158 + emake CC=$(tc-getCC) nagios
159 +
160 + if use web; then
161 + # Only compile the CGIs/HTML when USE=web is set.
162 + emake CC=$(tc-getCC) DESTDIR="${D}" cgis html
163 + fi
164 +}
165 +
166 +src_install() {
167 + dodoc Changelog CONTRIBUTING.md README.md THANKS UPGRADING
168 +
169 + # There is no way to install the CGIs unstripped from the top-level
170 + # makefile, so descend into base/ here. The empty INSTALL_OPTS
171 + # ensures that root:root: owns the nagios executables.
172 + cd "${S}/base" || die
173 + emake INSTALL_OPTS="" DESTDIR="${D}" install-unstripped
174 + cd "${S}" || die
175 +
176 + # Otherwise this gets installed as 770 and you get "access denied"
177 + # for some reason or other when starting nagios. The permissions
178 + # on nagiostats are just for consistency (these should both get
179 + # fixed upstream).
180 + fperms 775 /usr/sbin/nagios /usr/sbin/nagiostats
181 +
182 + # INSTALL_OPTS are needed for most of install-basic, but we don't
183 + # want them on the LIBEXECDIR, argh.
184 + emake DESTDIR="${D}" install-basic
185 + fowners root:root /usr/$(get_libdir)/nagios/plugins
186 +
187 + # Don't make the configuration owned by the nagios user, because
188 + # then he can edit nagios.cfg and trick nagios into running as root
189 + # and doing his bidding.
190 + emake INSTALL_OPTS="" DESTDIR="${D}" install-config
191 +
192 + # No INSTALL_OPTS used in install-commandmode, thankfully.
193 + emake DESTDIR="${D}" install-commandmode
194 +
195 + # The build system installs these directories, but portage assumes
196 + # that the build system doesn't know what it's doing so we have to
197 + # keepdir them, too. I guess you'll have to manually re-check the
198 + # upstream build system forever to see if this is still necessary.
199 + keepdir /var/lib/nagios{,/archives,/rw,/spool,/spool/checkresults}
200 +
201 + if use web; then
202 + # There is no way to install the CGIs unstripped from the
203 + # top-level makefile, so descend into cgi/ here. The empty
204 + # INSTALL_OPTS ensures that root:root: owns the CGI executables.
205 + cd "${S}/cgi" || die
206 + emake INSTALL_OPTS="" DESTDIR="${D}" install-unstripped
207 + cd "${S}" || die
208 +
209 + # install-html installs the new exfoliation theme
210 + emake INSTALL_OPTS="" DESTDIR="${D}" install-html
211 +
212 + if use classicui; then
213 + # This overwrites the already-installed exfoliation theme
214 + emake INSTALL_OPTS="" DESTDIR="${D}" install-classicui
215 + fi
216 +
217 + # Install cute Gentoo icons (bug #388323), setting their
218 + # owner, group, and mode to match those of the rest of Nagios's
219 + # images.
220 + insinto /usr/share/nagios/htdocs/images/logos
221 + doins "${WORKDIR}/${GENTOO_ICONS}"/*.*
222 + fi
223 +
224 + newinitd startup/openrc-init nagios
225 +
226 + if use web ; then
227 + if use apache2 ; then
228 + # Install the Nagios configuration file for Apache.
229 + insinto "/etc/apache2/modules.d"
230 + newins "${T}/99_nagios4-r1.conf" "99_nagios4.conf"
231 + elif use lighttpd ; then
232 + # Install the Nagios configuration file for Lighttpd.
233 + insinto /etc/lighttpd
234 + newins "${T}/lighttpd_nagios4-r1.conf" nagios.conf
235 + else
236 + ewarn "${CATEGORY}/${PF} only supports apache or lighttpd"
237 + ewarn "out of the box. Since you are not using one of them, you"
238 + ewarn "will have to configure your webserver yourself."
239 + fi
240 + fi
241 +}
242 +
243 +pkg_postinst() {
244 +
245 + if use web; then
246 + if use apache2 || use lighttpd ; then
247 + if use apache2; then
248 + elog "To enable the Nagios web front-end, please edit"
249 + elog "${ROOT}/etc/conf.d/apache2 and add \"-D NAGIOS -D PHP\""
250 + elog "to APACHE2_OPTS. Then Nagios will be available at,"
251 + elog
252 + elif use lighttpd; then
253 + elog "To enable the Nagios web front-end, please add"
254 + elog "'include \"nagios.conf\"' to the lighttpd configuration"
255 + elog "file at ${ROOT}/etc/lighttpd/lighttpd.conf. Then Nagios"
256 + elog "will be available at,"
257 + elog
258 + fi
259 +
260 + elog " http://localhost/nagios/"
261 + fi
262 + fi
263 +
264 + elog
265 + elog "If your kernel has /proc protection, nagios"
266 + elog "will not be happy as it relies on accessing the proc"
267 + elog "filesystem. You can fix this by adding nagios into"
268 + elog "the group wheel, but this is not recomended."
269 + elog
270 +
271 + if [ -n "${REPLACING_VERSIONS}" ]; then
272 + ewarn "The local state directory for nagios has changed in v4.4.5,"
273 + ewarn "from ${EROOT}/var/nagios to ${EROOT}/var/lib/nagios. If you"
274 + ewarn "wish to migrate your state to the new location, first stop"
275 + ewarn "nagios and then run"
276 + ewarn ""
277 + ewarn " diff --recursive --brief ${EROOT}/var/nagios ${EROOT}/var/lib/nagios"
278 + ewarn ""
279 + ewarn "to identify any files that should be moved to the new"
280 + ewarn "location. They can simply be moved with \"mv\" before"
281 + ewarn "restarting nagios."
282 + fi
283 +}