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/ndoutils/files/, net-analyzer/ndoutils/
Date: Tue, 07 Nov 2017 12:35:24
Message-Id: 1510058063.a76473925572d2be605f50db49f33d2a19efbafd.mjo@gentoo
1 commit: a76473925572d2be605f50db49f33d2a19efbafd
2 Author: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
3 AuthorDate: Tue Nov 7 00:37:59 2017 +0000
4 Commit: Michael Orlitzky <mjo <AT> gentoo <DOT> org>
5 CommitDate: Tue Nov 7 12:34:23 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a7647392
7
8 net-analyzer/ndoutils: new version 2.1.3.
9
10 This is somewhat of a work in progress. The new version 2.1.3 is
11 intended mainly to fix the compatibility with modern versions of
12 nagios-core. However, there are still several fixes in the pipeline
13 that we're having to carry patches for in the meantime:
14
15 * format-security warnings (upstream pull request 42)
16 * default PID file location (upstream pull request 44)
17 * asprintf compile warnings (upstream issue 43)
18 * openrc service file improvements (not yet submitted)
19
20 The last patch has not been submitted because I'm waiting on a
21 response for upstream issue 45 that affects the init scripts.
22 Regardless, we might as well push out v2.1.3 now, since it has
23 to work better than v2.0.0.
24
25 Closes: https://bugs.gentoo.org/599452
26 Package-Manager: Portage-2.3.8, Repoman-2.3.3
27
28 net-analyzer/ndoutils/Manifest | 2 +-
29 net-analyzer/ndoutils/files/format-security.patch | 115 +++++++++++++++++++++
30 net-analyzer/ndoutils/files/ndo2db.init-nagios3 | 24 -----
31 .../ndoutils/files/ndoutils-2.0.0-asprintf.patch | 6 ++
32 .../ndoutils/files/ndoutils-2.0.0-sleep.patch | 10 --
33 net-analyzer/ndoutils/files/openrc-init.patch | 100 ++++++++++++++++++
34 .../ndoutils/files/sample-config-piddir.patch | 32 ++++++
35 net-analyzer/ndoutils/ndoutils-2.0.0.ebuild | 67 ------------
36 net-analyzer/ndoutils/ndoutils-2.1.3.ebuild | 89 ++++++++++++++++
37 9 files changed, 343 insertions(+), 102 deletions(-)
38
39 diff --git a/net-analyzer/ndoutils/Manifest b/net-analyzer/ndoutils/Manifest
40 index 9f9ca5c4aaa..89f7e750e6a 100644
41 --- a/net-analyzer/ndoutils/Manifest
42 +++ b/net-analyzer/ndoutils/Manifest
43 @@ -1 +1 @@
44 -DIST ndoutils-2.0.0.tar.gz 2207263 SHA256 b95047c812fb61465e66a9e1a6d4a42bf00620f334f08a6faf5afe20bdd43ba1 SHA512 c899c9f9d0a14995ae7e3fc9f8566891acef9186cc53f05e4f509e9dd01a19a17d32c746a4a1c125342ebffad65946c7a3ea11da68ce0ff240bd37e85334545c WHIRLPOOL d3e41eb5e2a3ea9a5ca0d24fc8319beaa914d2bcb16c187ab6c5f5a3f133c27756ecdc2b6302a75c015294a1b2c3cc48d3c87a540ae1b9b07a21eb427b45d181
45 +DIST ndoutils-2.1.3.tar.gz 2182999 SHA256 2517ee737359f16d7f24b13ef2a9a41775bf7e8396a3ecaa7c45758d3ca9ce0a SHA512 727f2051876ff32cafaf9993a69b721ae4ea81031fade12262dbb4c5399c601f3c1af362d9d550e1d6d56fac8fe044d515dc10fc43e7d4d3e981bc9a89db88de WHIRLPOOL 9fb7cf6438da9baad6036b91bac62b8df1a494f0be00d3926e6603fe3783bd8722107ee63280c25f377d942f4a720d9aed04991ff24e2817b045161d142d34a7
46
47 diff --git a/net-analyzer/ndoutils/files/format-security.patch b/net-analyzer/ndoutils/files/format-security.patch
48 new file mode 100644
49 index 00000000000..75be7dc3210
50 --- /dev/null
51 +++ b/net-analyzer/ndoutils/files/format-security.patch
52 @@ -0,0 +1,115 @@
53 +From 07891e8fcf692552c57e64429fd52da9e682f6d2 Mon Sep 17 00:00:00 2001
54 +From: Michael Orlitzky <michael@××××××××.com>
55 +Date: Sat, 22 Jul 2017 16:38:03 -0400
56 +Subject: [PATCH 1/1] src/queue.c: fix format-security warnings with explicit
57 + "%s" format string.
58 +
59 +The syslog() function takes as its second argument a format string (a
60 +la printf), but if the third parameter is a string, then the format
61 +string can be omitted. This has led to security vulnerabilities in the
62 +past, and compilers can now warn about it. In particular, GCC has the
63 +-Wformat-security option, which can be made an error with
64 +-Werror=format-security.
65 +
66 +A few such two-argument calls were present in src/queue.c, where
67 +constant strings were being logged to syslog. This commit adds the
68 +second format string parameter (simply "%s" in this case) to avoid the
69 +compiler warnings.
70 +
71 +More information about format-security can be found in Fedora's FAQ:
72 +
73 + https://fedoraproject.org/wiki/Format-Security-FAQ
74 +---
75 + src/queue.c | 22 +++++++++++-----------
76 + 1 file changed, 11 insertions(+), 11 deletions(-)
77 +
78 +diff --git a/src/queue.c b/src/queue.c
79 +index 8cb7445..50bb519 100644
80 +--- a/src/queue.c
81 ++++ b/src/queue.c
82 +@@ -50,7 +50,7 @@ void del_queue() {
83 + struct msqid_ds buf;
84 +
85 + if (msgctl(queue_id,IPC_RMID,&buf) < 0) {
86 +- syslog(LOG_ERR,"Error: queue remove error.\n");
87 ++ syslog(LOG_ERR, "%s", "Error: queue remove error.\n");
88 + }
89 + }
90 +
91 +@@ -58,7 +58,7 @@ int get_queue_id(int id) {
92 + key_t key = ftok(NDO_QUEUE_PATH, NDO_QUEUE_ID+id);
93 +
94 + if ((queue_id = msgget(key, IPC_CREAT | 0600)) < 0) {
95 +- syslog(LOG_ERR,"Error: queue init error.\n");
96 ++ syslog(LOG_ERR, "%s", "Error: queue init error.\n");
97 + }
98 + }
99 +
100 +@@ -99,7 +99,7 @@ void log_retry( void) {
101 + if(msgctl(queue_id, IPC_STAT, &queue_stats)) {
102 + sprintf(curstats, "Unable to determine current message queue usage: error reading IPC_STAT: %d", errno);
103 + sprintf(logmsg, logfmt, curstats);
104 +- syslog(LOG_ERR, logmsg);
105 ++ syslog(LOG_ERR, "%s", logmsg);
106 + }
107 + else {
108 + #if defined( __linux__)
109 +@@ -108,24 +108,24 @@ void log_retry( void) {
110 + if( msgmni < 0) {
111 + sprintf(curstats, "Unable to determine current message queue usage: error reading IPC_INFO: %d", errno);
112 + sprintf(logmsg, logfmt, curstats);
113 +- syslog(LOG_ERR, logmsg);
114 ++ syslog(LOG_ERR, "%s", logmsg);
115 + }
116 + else {
117 + sprintf(curstats, statsfmt, queue_stats.msg_qnum,
118 + (unsigned long)msgmni, queue_stats.__msg_cbytes,
119 + queue_stats.msg_qbytes);
120 + sprintf(logmsg, logfmt, curstats);
121 +- syslog(LOG_ERR, logmsg);
122 ++ syslog(LOG_ERR, "%s", logmsg);
123 + }
124 + #else
125 + sprintf(logmsg, logfmt, "");
126 +- syslog(LOG_ERR, logmsg);
127 ++ syslog(LOG_ERR, "%s", logmsg);
128 + #endif
129 + }
130 + last_retry_log_time = now;
131 + }
132 + else {
133 +- syslog(LOG_ERR,"Warning: queue send error, retrying...\n");
134 ++ syslog(LOG_ERR, "%s", "Warning: queue send error, retrying...\n");
135 + }
136 + }
137 +
138 +@@ -155,14 +155,14 @@ void push_into_queue (char* buf) {
139 + #endif
140 + }
141 + if (retrynum < MAX_RETRIES) {
142 +- syslog(LOG_ERR,"Message sent to queue.\n");
143 ++ syslog(LOG_ERR, "%s", "Message sent to queue.\n");
144 + }
145 + else {
146 +- syslog(LOG_ERR,"Error: max retries exceeded sending message to queue. Kernel queue parameters may need to be tuned. See README.\n");
147 ++ syslog(LOG_ERR, "%s", "Error: max retries exceeded sending message to queue. Kernel queue parameters may need to be tuned. See README.\n");
148 + }
149 + }
150 + else {
151 +- syslog(LOG_ERR,"Error: queue send error.\n");
152 ++ syslog(LOG_ERR, "%s", "Error: queue send error.\n");
153 + }
154 + }
155 +
156 +@@ -175,7 +175,7 @@ char* pop_from_queue() {
157 + zero_string(msg.text, NDO_MAX_MSG_SIZE);
158 +
159 + if (msgrcv(queue_id, &msg, queue_buff_size, NDO_MSG_TYPE, MSG_NOERROR) < 0) {
160 +- syslog(LOG_ERR,"Error: queue recv error.\n");
161 ++ syslog(LOG_ERR, "%s", "Error: queue recv error.\n");
162 + }
163 +
164 + int size = strlen(msg.text);
165 +--
166 +2.13.0
167 +
168
169 diff --git a/net-analyzer/ndoutils/files/ndo2db.init-nagios3 b/net-analyzer/ndoutils/files/ndo2db.init-nagios3
170 deleted file mode 100644
171 index 3e1e262f6e0..00000000000
172 --- a/net-analyzer/ndoutils/files/ndo2db.init-nagios3
173 +++ /dev/null
174 @@ -1,24 +0,0 @@
175 -#!/sbin/openrc-run
176 -# Copyright 1999-2010 Gentoo Foundation
177 -# Distributed under the terms of the GNU General Public License v2
178 -
179 -depends() {
180 - before nagios
181 - need mysql
182 -}
183 -
184 -start() {
185 - ebegin "Starting ndo2db"
186 - if [ -S /var/nagios/ndo.sock ] ; then
187 - rm -f /var/nagios/ndo.sock
188 - fi
189 - start-stop-daemon --start --quiet --exec /usr/bin/ndo2db \
190 - -- -c /etc/nagios/ndo2db.cfg
191 - eend $?
192 -}
193 -
194 -stop() {
195 - ebegin "Stopping ndo2db"
196 - start-stop-daemon --stop --quiet --exec /usr/bin/ndo2db
197 - eend $?
198 -}
199
200 diff --git a/net-analyzer/ndoutils/files/ndoutils-2.0.0-asprintf.patch b/net-analyzer/ndoutils/files/ndoutils-2.0.0-asprintf.patch
201 index 146132c21de..21cf837ba36 100644
202 --- a/net-analyzer/ndoutils/files/ndoutils-2.0.0-asprintf.patch
203 +++ b/net-analyzer/ndoutils/files/ndoutils-2.0.0-asprintf.patch
204 @@ -1,3 +1,9 @@
205 +This is a fix for the QA warnings that result from using asprintf()
206 +without defining it. That happens because asprintf() is a GNU
207 +extension, but somehow gets used before _GNU_SOURCE is defined.
208 +
209 +Upstream-Bug: https://github.com/NagiosEnterprises/ndoutils/issues/43
210 +
211 --- a/include/config.h.in
212 +++ b/include/config.h.in
213 @@ -9,6 +9,7 @@
214
215 diff --git a/net-analyzer/ndoutils/files/ndoutils-2.0.0-sleep.patch b/net-analyzer/ndoutils/files/ndoutils-2.0.0-sleep.patch
216 deleted file mode 100644
217 index 61694baee9e..00000000000
218 --- a/net-analyzer/ndoutils/files/ndoutils-2.0.0-sleep.patch
219 +++ /dev/null
220 @@ -1,10 +0,0 @@
221 ---- a/src/queue.c
222 -+++ b/src/queue.c
223 -@@ -8,6 +8,7 @@
224 - #include "../include/queue.h"
225 - #include <errno.h>
226 - #include <time.h>
227 -+#include <unistd.h> /* sleep() */
228 -
229 - #define RETRY_LOG_INTERVAL 600 /* Seconds */
230 - #define MAX_RETRIES 20 /* Max number of times to retry sending message */
231
232 diff --git a/net-analyzer/ndoutils/files/openrc-init.patch b/net-analyzer/ndoutils/files/openrc-init.patch
233 new file mode 100644
234 index 00000000000..07fcc63b7f3
235 --- /dev/null
236 +++ b/net-analyzer/ndoutils/files/openrc-init.patch
237 @@ -0,0 +1,100 @@
238 +From 61c6e9295bae755713b403626f702b5ac90f2448 Mon Sep 17 00:00:00 2001
239 +From: Michael Orlitzky <michael@××××××××.com>
240 +Date: Sat, 22 Jul 2017 17:25:29 -0400
241 +Subject: [PATCH 1/1] startup: simplify the OpenRC init scripts and conf file.
242 +
243 +This commit largely rewrites the OpenRC init script with the goal of
244 +simplifying it. The end result should be functionally the same, but is
245 +much shorter. The changes are as follows:
246 +
247 + 1. Replace the deprecated /sbin/runscript shebang with /sbin/openrc-run.
248 +
249 + 2. Replace the existing dependencies with "need mysql nagios". The
250 + ndo2db daemon needs Nagios to create the TCP or Unix socket over
251 + which it will communicate, and obviously it needs mysql to be
252 + up and running in order to save any data. The dependencies
253 + of mysql and nagios themselves will bring up whatever else is
254 + required; nothing else needs to be listed as a dependency of
255 + ndo2db.
256 +
257 + 3. Use the "command", "command_args", and "pidfile" OpenRC
258 + variables. OpenRC is smart enough to start and stop a well-behaved
259 + daemon on its own without a custom start/stop function. By
260 + specifying those three variables, we are able to eliminate much of
261 + the custom start/stop code in the init script.
262 +
263 +Finally, the default value of NDO2DB_CFG in the associated conf file has
264 +been updated to use @sysconfdir@ instead of @pkgsysconfdir@, which wasn't
265 +having any effect.
266 +---
267 + startup/openrc-conf.in | 6 ++----
268 + startup/openrc-init.in | 42 +++++++++---------------------------------
269 + 2 files changed, 11 insertions(+), 37 deletions(-)
270 +
271 +diff --git a/startup/openrc-conf.in b/startup/openrc-conf.in
272 +index d7b5474..69b15b5 100644
273 +--- a/startup/openrc-conf.in
274 ++++ b/startup/openrc-conf.in
275 +@@ -1,4 +1,2 @@
276 +-# /etc/conf.d/ndo2db : config file for /etc/init.d/ndo2db
277 +-
278 +-# Configuration file - default is @sysconfdir@/ndo2db.cfg
279 +-NDO2DB_CFG="@pkgsysconfdir@/ndo2db.cfg"
280 ++# The configuration file to use for ndo2db.
281 ++NDO2DB_CFG="@sysconfdir@/ndo2db.cfg"
282 +diff --git a/startup/openrc-init.in b/startup/openrc-init.in
283 +index 119e074..7b3fb40 100644
284 +--- a/startup/openrc-init.in
285 ++++ b/startup/openrc-init.in
286 +@@ -1,39 +1,15 @@
287 +-#!/sbin/runscript
288 ++#!/sbin/openrc-run
289 + #
290 +-# Copyright (c) 2016 Nagios(R) Core(TM) Development Team
291 ++# Copyright (c) 2017 Nagios(R) Core(TM) Development Team
292 + #
293 +-# Start/stop the Nagios Data Out Daemon.
294 +-#
295 +-# Goes in /etc/init.d - Config is in /etc/conf.d/ndo2db
296 +
297 +-NDO2DB_BIN="@sbindir@/ndo2db"
298 +-NDO2DB_PID="@piddir@/ndo2db.pid"
299 ++command="@sbindir@/ndo2db"
300 ++command_args="-c ${NDO2DB_CFG}"
301 ++description="Nagios Data Out daemon"
302 ++pidfile="@piddir@/ndo2db.pid"
303 +
304 + depend() {
305 +- use logger dns net localmount netmount nfsmount
306 +-}
307 +-
308 +-checkconfig() {
309 +- # Make sure the config file exists
310 +- if [ ! -f $NDO2DB_CFG ]; then
311 +- eerror "You need to setup $NDO2DB_CFG.
312 +- return 1
313 +- fi
314 +- return 0
315 +-}
316 +-
317 +-start() {
318 +- checkconfig || return 1
319 +- ebegin "Starting ndo2db"
320 +- # Make sure we have a sane current directory
321 +- cd /
322 +- start-stop-daemon --start --exec $NDO2DB_BIN --pidfile $PID_FILE \
323 +- -- -c $NDO2DB_CFG -f
324 +- eend $?
325 +-}
326 +-
327 +-stop() {
328 +- ebegin "Stopping ndo2db"
329 +- start-stop-daemon --stop --exec $NDO2DB_BIN --pidfile $PID_FILE
330 +- eend $?
331 ++ # The Nagios core daemon creates the socket that ndo2db tries to
332 ++ # connect to upon starting.
333 ++ need mysql nagios
334 + }
335 +--
336 +2.13.0
337 +
338
339 diff --git a/net-analyzer/ndoutils/files/sample-config-piddir.patch b/net-analyzer/ndoutils/files/sample-config-piddir.patch
340 new file mode 100644
341 index 00000000000..90203820498
342 --- /dev/null
343 +++ b/net-analyzer/ndoutils/files/sample-config-piddir.patch
344 @@ -0,0 +1,32 @@
345 +From 560db1e2bc79bb3321c5f431e149418ec3c28a98 Mon Sep 17 00:00:00 2001
346 +From: Michael Orlitzky <michael@××××××××.com>
347 +Date: Sun, 23 Jul 2017 07:13:46 -0400
348 +Subject: [PATCH 1/1] config/ndo2db.cfg-sample.in: use @piddir@ for the pid
349 + file.
350 +
351 +The "lock_file" setting in ndo2db.cfg specifies where the daemon's pid
352 +file should be stored. In the past, it was stored in @localstatedir@,
353 +but @piddir@ is more appropriate. As evidence, all of the init scripts
354 +in the "startup" directory reference @piddir@ and not @localstatedir@
355 +for the location of the pid file. This commit updates the sample
356 +config to agree with the init scripts.
357 +---
358 + config/ndo2db.cfg-sample.in | 2 +-
359 + 1 file changed, 1 insertion(+), 1 deletion(-)
360 +
361 +diff --git a/config/ndo2db.cfg-sample.in b/config/ndo2db.cfg-sample.in
362 +index 75266dc..5b46fc9 100644
363 +--- a/config/ndo2db.cfg-sample.in
364 ++++ b/config/ndo2db.cfg-sample.in
365 +@@ -10,7 +10,7 @@
366 + # This is the lockfile that NDO2DB will use to store its PID number
367 + # in when it is running in daemon mode.
368 +
369 +-lock_file=@localstatedir@/ndo2db.pid
370 ++lock_file=@piddir@/ndo2db.pid
371 +
372 +
373 +
374 +--
375 +2.13.0
376 +
377
378 diff --git a/net-analyzer/ndoutils/ndoutils-2.0.0.ebuild b/net-analyzer/ndoutils/ndoutils-2.0.0.ebuild
379 deleted file mode 100644
380 index b813b079881..00000000000
381 --- a/net-analyzer/ndoutils/ndoutils-2.0.0.ebuild
382 +++ /dev/null
383 @@ -1,67 +0,0 @@
384 -# Copyright 1999-2014 Gentoo Foundation
385 -# Distributed under the terms of the GNU General Public License v2
386 -
387 -EAPI=5
388 -inherit eutils user
389 -
390 -MY_P=${P/_beta/b}
391 -
392 -DESCRIPTION="Nagios addon to store Nagios data in a MySQL database"
393 -HOMEPAGE="http://www.nagios.org"
394 -SRC_URI="mirror://sourceforge/nagios/${MY_P}.tar.gz"
395 -
396 -LICENSE="GPL-2"
397 -SLOT="0"
398 -KEYWORDS="~amd64 ~x86 ~ppc"
399 -
400 -DEPEND="
401 - dev-perl/DBD-mysql
402 - dev-perl/DBI
403 - virtual/mysql
404 -"
405 -RDEPEND="
406 - ${DEPEND}
407 - >=net-analyzer/nagios-core-3.0
408 -"
409 -
410 -S="${WORKDIR}/${MY_P}"
411 -
412 -pkg_setup() {
413 - enewgroup nagios
414 - enewuser nagios -1 /bin/bash /var/nagios/home nagios
415 -}
416 -
417 -src_prepare() {
418 - epatch \
419 - "${FILESDIR}"/${P}-asprintf.patch \
420 - "${FILESDIR}"/${P}-sleep.patch
421 -}
422 -
423 -src_configure() {
424 - econf \
425 - --sysconfdir=/etc/nagios \
426 - --enable-mysql
427 -}
428 -
429 -DOCS=(
430 - 'docs/NDOUTILS DB Model.pdf'
431 - 'docs/NDOUtils Documentation.pdf'
432 - Changelog
433 - README
434 - REQUIREMENTS
435 - TODO
436 - UPGRADING
437 -)
438 -
439 -src_install() {
440 - default
441 - emake DESTDIR="${D}" install-config
442 -
443 - newinitd "${FILESDIR}"/ndo2db.init-nagios3 ndo2db
444 -}
445 -
446 -pkg_postinst() {
447 - elog "To include NDO in your Nagios setup you'll need to activate the NDO broker module"
448 - elog "in /etc/nagios/nagios.cfg:"
449 - elog "\tbroker_module=/usr/bin/ndomod-3x.o config_file=/etc/nagios/ndomod.cfg"
450 -}
451
452 diff --git a/net-analyzer/ndoutils/ndoutils-2.1.3.ebuild b/net-analyzer/ndoutils/ndoutils-2.1.3.ebuild
453 new file mode 100644
454 index 00000000000..1872b7849d8
455 --- /dev/null
456 +++ b/net-analyzer/ndoutils/ndoutils-2.1.3.ebuild
457 @@ -0,0 +1,89 @@
458 +# Copyright 1999-2017 Gentoo Foundation
459 +# Distributed under the terms of the GNU General Public License v2
460 +
461 +EAPI=6
462 +inherit systemd
463 +
464 +DESCRIPTION="Nagios addon to store Nagios data in a MySQL database"
465 +HOMEPAGE="http://www.nagios.org/"
466 +SRC_URI="https://github.com/NagiosEnterprises/${PN}/archive/${P}.tar.gz"
467 +
468 +LICENSE="GPL-2"
469 +SLOT="0"
470 +KEYWORDS="~amd64 ~ppc ~x86"
471 +
472 +# We require the "nagios" user from net-analyzer/nagios-core at build
473 +# time.
474 +DEPEND="dev-perl/DBD-mysql
475 + dev-perl/DBI
476 + >=net-analyzer/nagios-core-4
477 + virtual/mysql"
478 +RDEPEND="${DEPEND}"
479 +
480 +S="${WORKDIR}/${PN}-${P}"
481 +
482 +DOCS=(
483 + Changelog
484 + README
485 + THANKS
486 + TODO
487 + UPGRADING
488 + "docs/NDOUTILS DB Model.pdf"
489 + "docs/NDOUtils Documentation.pdf"
490 +)
491 +
492 +PATCHES=(
493 + "${FILESDIR}/format-security.patch"
494 + "${FILESDIR}/ndoutils-2.0.0-asprintf.patch"
495 + "${FILESDIR}/sample-config-piddir.patch"
496 + "${FILESDIR}/openrc-init.patch"
497 +)
498 +
499 +src_configure() {
500 + # The localstatedir is where our socket will be created by the
501 + # nagios daemon, so we put it in /var/nagios where the "nagios" user
502 + # will be able to write.
503 + #
504 + # And normally, we would use /run for the pid file, but the daemon
505 + # drops permissions before creating it, the the piddir also needs
506 + # to be writable by the nagios user.
507 + econf --enable-mysql \
508 + --localstatedir=/var/nagios \
509 + --sysconfdir=/etc/nagios \
510 + --with-piddir=/var/nagios
511 +}
512 +
513 +src_compile() {
514 + # Avoid "emake all" so that we don't build the stuff for nagios-2.x
515 + # and nagios-3.x, some of which throws QA warnings. We don't use it
516 + # anyway.
517 + pushd src
518 + emake file2sock log2ndo ndo2db-4x ndomod-4x.o sockdebug
519 + popd
520 +}
521 +
522 +src_install() {
523 + default
524 + insinto /etc/nagios
525 + newins config/ndo2db.cfg-sample ndo2db.cfg
526 + newins config/ndomod.cfg-sample ndomod.cfg
527 + newinitd "startup/openrc-init" ndo2db
528 + newconfd "startup/openrc-conf" ndo2db
529 + systemd_newunit "startup/default-service" "${PN}.service"
530 +
531 + # The documentation isn't installed by the build system
532 + dodoc -r docs/html
533 +
534 + # Use symlinks because the installdb/upgradedb scripts use relative
535 + # paths to the SQL queries.
536 + insinto "/usr/share/${PN}"
537 + doins -r db
538 + dosym "/usr/share/${PN}/db/installdb" /usr/bin/ndoutils-installdb
539 + dosym "/usr/share/${PN}/db/upgradedb" /usr/bin/ndoutils-upgradedb
540 +}
541 +
542 +pkg_postinst() {
543 + elog "To include NDO in your Nagios setup, you'll need to activate"
544 + elog "the NDO broker module in /etc/nagios/nagios.cfg:"
545 + elog " broker_module=/usr/bin/ndomod.o config_file=/etc/nagios/ndomod.cfg"
546 +}