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, 06 Nov 2022 11:53:06
Message-Id: 1667735521.29aea15ad534c6493fc27fb921ca37a96eb6f0be.mjo@gentoo
1 commit: 29aea15ad534c6493fc27fb921ca37a96eb6f0be
2 Author: Tomáš Mózes <hydrapolic <AT> gmail <DOT> com>
3 AuthorDate: Sun Nov 6 11:23:13 2022 +0000
4 Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
5 CommitDate: Sun Nov 6 11:52:01 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=29aea15a
7
8 net-analyzer/nagios-core: add 4.4.8
9
10 Signed-off-by: Tomáš Mózes <hydrapolic <AT> gmail.com>
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.8.ebuild | 266 ++++++++++++++++++++++
15 2 files changed, 267 insertions(+)
16
17 diff --git a/net-analyzer/nagios-core/Manifest b/net-analyzer/nagios-core/Manifest
18 index 1e1a39a1a09f..b60d98dfdb81 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.7.tar.gz 11340759 BLAKE2B 4316e6cfc7f576d0fe5ba075aba2931dc850c97fe84b124eceeefaa6c01563c0639c8cecf751e086d5a6f9c0a1079f7e9bd013f961956d7d59536dea4516cf86 SHA512 92adc74e687bcbbd742075c8c7222d42c90795a4eb7582e3f1f492349db8200c61f390bf3c4cab4b023c5c111353a43f5dd687b0ee5ab6a8775444e06d42517b
23 +DIST nagios-4.4.8.tar.gz 11339420 BLAKE2B 785705824a5a47d5f20ac0f3d756d51d6362e230514e486e1dc1fa10488a9f7ca724cc96635f2965aac1bb9dc76dee3cf2ab4e2c1be77b239540b87d1a139a21 SHA512 56448628e54b9467d14978b039fc7b37f48be624757a1bd9fe16810101f3ce4a5d740e1c9c367d2b3a8bc408a56bdf295955d8b73d5d74ee92f4750b908e88a7
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.8.ebuild b/net-analyzer/nagios-core/nagios-core-4.4.8.ebuild
27 new file mode 100644
28 index 000000000000..e0583cea138b
29 --- /dev/null
30 +++ b/net-analyzer/nagios-core/nagios-core-4.4.8.ebuild
31 @@ -0,0 +1,266 @@
32 +# Copyright 1999-2022 Gentoo Authors
33 +# Distributed under the terms of the GNU General Public License v2
34 +
35 +EAPI=8
36 +
37 +inherit systemd 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 +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 + 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 +#
92 +# We need the apache/lighttpd groups in src_install() for the things
93 +# installed as the --with-command-group argument, so they go here too.
94 +# The groups are also needed at runtime, but that is ensured by apache
95 +# and lighttpd themselves being in RDEPEND.
96 +BDEPEND="${CONFIGURE_DEPEND}
97 + apache2? ( acct-group/apache )
98 + lighttpd? ( acct-group/lighttpd )
99 + web? ( app-arch/unzip )"
100 +
101 +# This is linked into /usr/bin/nagios{,tats}
102 +DEPEND="dev-libs/libltdl:0"
103 +
104 +RDEPEND="${CONFIGURE_DEPEND}
105 + ${DEPEND}
106 + web? (
107 + media-libs/gd[jpeg,png]
108 + lighttpd? ( www-servers/lighttpd[php] )
109 + apache2? (
110 + || (
111 + www-servers/apache[${MOD_ALIAS},apache2_modules_cgi]
112 + www-servers/apache[${MOD_ALIAS},apache2_modules_cgid]
113 + ( www-servers/apache[${MOD_ALIAS}] www-apache/mod_fcgid ) )
114 + || (
115 + dev-lang/php:*[apache2]
116 + dev-lang/php:*[cgi]
117 + dev-lang/php:*[fpm] )
118 + )
119 + )
120 + vim-syntax? ( app-vim/nagios-syntax )"
121 +
122 +S="${WORKDIR}/${MY_P}"
123 +
124 +src_configure() {
125 + local myconf
126 +
127 + if use !apache2 && use !lighttpd ; then
128 + myconf="${myconf} --with-command-group=nagios"
129 + else
130 + if use apache2 ; then
131 + myconf="${myconf} --with-command-group=apache"
132 + myconf="${myconf} --with-httpd-conf=/etc/apache2/conf.d"
133 + elif use lighttpd ; then
134 + myconf="${myconf} --with-command-group=lighttpd"
135 + fi
136 + fi
137 +
138 + # We pass "unknown" as the init type because we don't want it to
139 + # guess. Later on, we'll manually install both OpenRC and systemd
140 + # services.
141 + econf ${myconf} \
142 + --prefix="${EPREFIX}/usr" \
143 + --bindir="${EPREFIX}/usr/sbin" \
144 + --localstatedir="${EPREFIX}/var/lib/nagios" \
145 + --sysconfdir="${EPREFIX}/etc/nagios" \
146 + --libexecdir="${EPREFIX}/usr/$(get_libdir)/nagios/plugins" \
147 + --with-cgibindir="${EPREFIX}/usr/$(get_libdir)/nagios/cgi-bin" \
148 + --with-webdir="${EPREFIX}/usr/share/nagios/htdocs" \
149 + --with-init-type="unknown"
150 +
151 + # The paths in the web server configuration files need to match
152 + # those passed to econf above.
153 + cp "${FILESDIR}/99_nagios4-r1.conf" \
154 + "${FILESDIR}/lighttpd_nagios4-r1.conf" \
155 + "${T}/" || die "failed to create copies of web server conf files"
156 +
157 + sed -e "s|@CGIBINDIR@|${EPREFIX}/usr/$(get_libdir)/nagios/cgi-bin|g" \
158 + -e "s|@WEBDIR@|${EPREFIX}/usr/share/nagios/htdocs|" \
159 + -i "${T}/99_nagios4-r1.conf" \
160 + -i "${T}/lighttpd_nagios4-r1.conf" \
161 + || die "failed to substitute paths into web server conf files"
162 +
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)" cgis html
171 + fi
172 +}
173 +
174 +src_install() {
175 + dodoc Changelog CONTRIBUTING.md README.md THANKS UPGRADING
176 +
177 + # There is no way to install the CGIs unstripped from the top-level
178 + # makefile, so descend into base/ here. The empty INSTALL_OPTS
179 + # ensures that root:root: owns the nagios executables.
180 + cd "${S}/base" || die
181 + emake INSTALL_OPTS="" DESTDIR="${D}" install-unstripped
182 + cd "${S}" || die
183 +
184 + # Otherwise this gets installed as 770 and you get "access denied"
185 + # for some reason or other when starting nagios. The permissions
186 + # on nagiostats are just for consistency (these should both get
187 + # fixed upstream).
188 + fperms 775 /usr/sbin/nagios /usr/sbin/nagiostats
189 +
190 + # INSTALL_OPTS are needed for most of install-basic, but we don't
191 + # want them on the LIBEXECDIR, argh.
192 + emake DESTDIR="${D}" install-basic
193 + fowners root:root /usr/$(get_libdir)/nagios/plugins
194 +
195 + # Don't make the configuration owned by the nagios user, because
196 + # then he can edit nagios.cfg and trick nagios into running as root
197 + # and doing his bidding.
198 + emake INSTALL_OPTS="" DESTDIR="${D}" install-config
199 +
200 + # No INSTALL_OPTS used in install-commandmode, thankfully.
201 + emake DESTDIR="${D}" install-commandmode
202 +
203 + # The build system installs these directories, but portage assumes
204 + # that the build system doesn't know what it's doing so we have to
205 + # keepdir them, too. I guess you'll have to manually re-check the
206 + # upstream build system forever to see if this is still necessary.
207 + keepdir /var/lib/nagios{,/archives,/rw,/spool,/spool/checkresults}
208 +
209 + if use web; then
210 + # There is no way to install the CGIs unstripped from the
211 + # top-level makefile, so descend into cgi/ here. The empty
212 + # INSTALL_OPTS ensures that root:root: owns the CGI executables.
213 + cd "${S}/cgi" || die
214 + emake INSTALL_OPTS="" DESTDIR="${D}" install-unstripped
215 + cd "${S}" || die
216 +
217 + # install-html installs the new exfoliation theme
218 + emake INSTALL_OPTS="" DESTDIR="${D}" install-html
219 +
220 + if use classicui; then
221 + # This overwrites the already-installed exfoliation theme
222 + emake INSTALL_OPTS="" DESTDIR="${D}" install-classicui
223 + fi
224 +
225 + # Install cute Gentoo icons (bug #388323), setting their
226 + # owner, group, and mode to match those of the rest of Nagios's
227 + # images.
228 + insinto /usr/share/nagios/htdocs/images/logos
229 + doins "${WORKDIR}/${GENTOO_ICONS}"/*.*
230 + fi
231 +
232 + # The ./configure script for nagios detects the init system on the
233 + # build host, which is wrong for all sorts of reasons. We've gone
234 + # to great lengths above to avoid running "install-init" -- even
235 + # indirectly -- and so now we must install whatever service files
236 + # we need by hand.
237 + newinitd startup/openrc-init nagios
238 + systemd_newunit startup/default-service nagios.service
239 +
240 + if use web ; then
241 + if use apache2 ; then
242 + # Install the Nagios configuration file for Apache.
243 + insinto "/etc/apache2/modules.d"
244 + newins "${T}/99_nagios4-r1.conf" "99_nagios4.conf"
245 + elif use lighttpd ; then
246 + # Install the Nagios configuration file for Lighttpd.
247 + insinto /etc/lighttpd
248 + newins "${T}/lighttpd_nagios4-r1.conf" nagios.conf
249 + else
250 + ewarn "${CATEGORY}/${PF} only supports apache or lighttpd"
251 + ewarn "out of the box. Since you are not using one of them, you"
252 + ewarn "will have to configure your webserver yourself."
253 + fi
254 + fi
255 +}
256 +
257 +pkg_postinst() {
258 +
259 + if use web; then
260 + if use apache2 || use lighttpd ; then
261 + if use apache2; then
262 + elog "To enable the Nagios web front-end, please edit"
263 + elog "${ROOT}/etc/conf.d/apache2 and add \"-D NAGIOS -D PHP\""
264 + elog "to APACHE2_OPTS. Then Nagios will be available at,"
265 + elog
266 + elif use lighttpd; then
267 + elog "To enable the Nagios web front-end, please add"
268 + elog "'include \"nagios.conf\"' to the lighttpd configuration"
269 + elog "file at ${ROOT}/etc/lighttpd/lighttpd.conf. Then Nagios"
270 + elog "will be available at,"
271 + elog
272 + fi
273 +
274 + elog " http://localhost/nagios/"
275 + fi
276 + fi
277 +
278 + elog
279 + elog "If your kernel has /proc protection, nagios"
280 + elog "will not be happy as it relies on accessing the proc"
281 + elog "filesystem. You can fix this by adding nagios into"
282 + elog "the group wheel, but this is not recomended."
283 + elog
284 +
285 + if [ -n "${REPLACING_VERSIONS}" ]; then
286 + ewarn "The local state directory for nagios has changed in v4.4.5,"
287 + ewarn "from ${EROOT}/var/nagios to ${EROOT}/var/lib/nagios. If you"
288 + ewarn "wish to migrate your state to the new location, first stop"
289 + ewarn "nagios and then run"
290 + ewarn ""
291 + ewarn " diff --recursive --brief ${EROOT}/var/nagios ${EROOT}/var/lib/nagios"
292 + ewarn ""
293 + ewarn "to identify any files that should be moved to the new"
294 + ewarn "location. They can simply be moved with \"mv\" before"
295 + ewarn "restarting nagios."
296 + fi
297 +}