Gentoo Archives: gentoo-commits

From: "Tobias Scherbaum (dertobi123)" <dertobi123@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in net-analyzer/nagios-core: nagios-core-3.0.6-r2.ebuild ChangeLog nagios-core-3.1.2.ebuild nagios-core-2.12-r1.ebuild nagios-core-3.1.0.ebuild
Date: Wed, 24 Jun 2009 21:27:27
Message-Id: E1MJa01-0001X4-5z@stork.gentoo.org
1 dertobi123 09/06/24 21:27:21
2
3 Modified: ChangeLog
4 Added: nagios-core-3.0.6-r2.ebuild
5 nagios-core-3.1.2.ebuild nagios-core-2.12-r1.ebuild
6 Removed: nagios-core-3.1.0.ebuild
7 Log:
8 Revbumps to 2.12-r1, 3.0.6-r2 and also bump to 3.1.2. Includes fix for #275288 (remote code execution in statuswml.cgi).
9 (Portage version: 2.2_rc33/cvs/Linux x86_64)
10
11 Revision Changes Path
12 1.148 net-analyzer/nagios-core/ChangeLog
13
14 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-analyzer/nagios-core/ChangeLog?rev=1.148&view=markup
15 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-analyzer/nagios-core/ChangeLog?rev=1.148&content-type=text/plain
16 diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-analyzer/nagios-core/ChangeLog?r1=1.147&r2=1.148
17
18 Index: ChangeLog
19 ===================================================================
20 RCS file: /var/cvsroot/gentoo-x86/net-analyzer/nagios-core/ChangeLog,v
21 retrieving revision 1.147
22 retrieving revision 1.148
23 diff -u -r1.147 -r1.148
24 --- ChangeLog 26 May 2009 17:05:27 -0000 1.147
25 +++ ChangeLog 24 Jun 2009 21:27:21 -0000 1.148
26 @@ -1,6 +1,17 @@
27 # ChangeLog for net-analyzer/nagios-core
28 # Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2
29 -# $Header: /var/cvsroot/gentoo-x86/net-analyzer/nagios-core/ChangeLog,v 1.147 2009/05/26 17:05:27 arfrever Exp $
30 +# $Header: /var/cvsroot/gentoo-x86/net-analyzer/nagios-core/ChangeLog,v 1.148 2009/06/24 21:27:21 dertobi123 Exp $
31 +
32 +*nagios-core-3.1.2 (24 Jun 2009)
33 +*nagios-core-3.0.6-r2 (24 Jun 2009)
34 +*nagios-core-2.12-r1 (24 Jun 2009)
35 +
36 + 24 Jun 2009; Tobias Scherbaum <dertobi123@g.o>
37 + +files/statuswml-bug275288.patch, +nagios-core-2.12-r1.ebuild,
38 + +nagios-core-3.0.6-r2.ebuild, -nagios-core-3.1.0.ebuild,
39 + +nagios-core-3.1.2.ebuild:
40 + Revbumps to 2.12-r1, 3.0.6-r2 and also bump to 3.1.2. Includes fix for
41 + #275288 (remote code execution in statuswml.cgi).
42
43 26 May 2009; Arfrever Frehtes Taifersar Arahesis <arfrever@g.o>
44 nagios-core-2.12.ebuild, nagios-core-3.0.6-r1.ebuild,
45
46
47
48 1.1 net-analyzer/nagios-core/nagios-core-3.0.6-r2.ebuild
49
50 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-analyzer/nagios-core/nagios-core-3.0.6-r2.ebuild?rev=1.1&view=markup
51 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-analyzer/nagios-core/nagios-core-3.0.6-r2.ebuild?rev=1.1&content-type=text/plain
52
53 Index: nagios-core-3.0.6-r2.ebuild
54 ===================================================================
55 # Copyright 1999-2009 Gentoo Foundation
56 # Distributed under the terms of the GNU General Public License v2
57 # $Header: /var/cvsroot/gentoo-x86/net-analyzer/nagios-core/nagios-core-3.0.6-r2.ebuild,v 1.1 2009/06/24 21:27:21 dertobi123 Exp $
58
59 EAPI="1"
60
61 inherit eutils depend.apache toolchain-funcs
62
63 MY_P=${PN/-core}-${PV}
64 DESCRIPTION="Nagios Core - Check daemon, CGIs, docs"
65 HOMEPAGE="http://www.nagios.org/"
66 SRC_URI="mirror://sourceforge/nagios/${MY_P}.tar.gz"
67
68 LICENSE="GPL-2"
69 SLOT="0"
70 KEYWORDS="~alpha ~amd64 ~ppc ~ppc64 ~sparc ~x86"
71 IUSE="debug lighttpd perl +web vim-syntax"
72 DEPEND="virtual/mailx
73 web? (
74 >=media-libs/jpeg-6b-r3
75 >=media-libs/libpng-1.2.5-r4
76 >=media-libs/gd-1.8.3-r5
77 lighttpd? ( www-servers/lighttpd )
78 )
79 perl? ( >=dev-lang/perl-5.6.1-r7 )"
80 RDEPEND="${DEPEND}
81 vim-syntax? ( app-vim/nagios-syntax )"
82
83 want_apache2
84
85 S="${WORKDIR}/${MY_P}"
86
87 pkg_setup() {
88 depend.apache_pkg_setup
89
90 # Check if gd has been compiled with jpeg and png support
91 if use web; then
92 if ! built_with_use media-libs/gd jpeg png; then
93 eerror "Your gd has been compiled without jpeg and/or png support."
94 eerror "Please re-emerge gd:"
95 eerror "# USE="jpeg png" emerge gd"
96 die "pkg_setup failed"
97 fi
98 fi
99
100 enewgroup nagios
101 enewuser nagios -1 /bin/bash /var/nagios/home nagios
102 }
103
104 src_unpack() {
105 unpack ${A}
106 cd "${S}"
107
108 local strip="$(echo '$(MAKE) strip-post-install')"
109 sed -i -e "s:${strip}::" {cgi,base}/Makefile.in || die "sed failed in Makefile.in"
110
111 # Fix remote execution in statuswml.cgi, bug #275288
112 epatch "${FILESDIR}/statuswml-bug275288.patch"
113 }
114
115 src_compile() {
116 local myconf
117
118 if use perl ; then
119 myconf="${myconf} --enable-embedded-perl --with-perlcache"
120 fi
121
122 if use debug; then
123 myconf="${myconf} --enable-DEBUG0"
124 myconf="${myconf} --enable-DEBUG1"
125 myconf="${myconf} --enable-DEBUG2"
126 myconf="${myconf} --enable-DEBUG3"
127 myconf="${myconf} --enable-DEBUG4"
128 myconf="${myconf} --enable-DEBUG5"
129 fi
130
131 if use !apache2 && use !lighttpd ; then
132 myconf="${myconf} --with-command-group=nagios"
133 else
134 if use apache2 ; then
135 myconf="${myconf} --with-command-group=apache"
136 myconf="${myconf} --with-httpd-conf=/etc/apache2/conf.d"
137 elif use lighttpd ; then
138 myconf="${myconf} --with-command-group=lighttpd"
139 fi
140 fi
141
142 econf ${myconf} \
143 --prefix=/usr \
144 --bindir=/usr/sbin \
145 --sbindir=/usr/$(get_libdir)/nagios/cgi-bin \
146 --datadir=/usr/share/nagios/htdocs \
147 --localstatedir=/var/nagios \
148 --sysconfdir=/etc/nagios \
149 --libexecdir=/usr/$(get_libdir)/nagios/plugins \
150 || die "./configure failed"
151
152 emake CC=$(tc-getCC) nagios || die "make failed"
153
154 if use web ; then
155 # Only compile the CGI's if "web" useflag is set.
156 emake CC=$(tc-getCC) DESTDIR="${D}" cgis || die
157 fi
158 }
159
160 src_install() {
161 dodoc Changelog INSTALLING LEGAL README UPGRADING
162
163 if ! use web ; then
164 sed -i -e 's/cd $(SRC_CGI) && $(MAKE) $@/# line removed due missing web use flag/' \
165 -e 's/cd $(SRC_HTM) && $(MAKE) $@/# line removed due missing web use flag/' \
166 Makefile
167 fi
168
169 sed -i -e 's/^contactgroups$//g' Makefile
170
171 emake DESTDIR="${D}" install
172 emake DESTDIR="${D}" install-config
173 emake DESTDIR="${D}" install-commandmode
174
175 newinitd "${FILESDIR}"/nagios3 nagios
176 newconfd "${FILESDIR}"/conf.d nagios
177
178 # Apache Module
179 if use web ; then
180 if use apache2 ; then
181 insinto "${APACHE_MODULES_CONFDIR}"
182 doins "${FILESDIR}"/99_nagios3.conf
183 elif use lighttpd ; then
184 insinto /etc/lighttpd
185 newins "${FILESDIR}/lighttpd_nagios3-r1.conf" nagios.conf
186 else
187 ewarn "${CATEGORY}/${PF} only supports Apache-2.x or Lighttpd webserver"
188 ewarn "out-of-the-box. Since you are not using one of them, you"
189 ewarn "have to configure your webserver accordingly yourself."
190 fi
191
192 fi
193
194 for dir in etc/nagios var/nagios ; do
195 chown -R nagios:nagios "${D}/${dir}" || die "Failed chown of ${D}/${dir}"
196 done
197
198 chown -R root:root "${D}"/usr/$(get_libdir)/nagios
199 find "${D}"/usr/$(get_libdir)/nagios -type d -print0 | xargs -0 chmod 755
200 find "${D}"/usr/$(get_libdir)/nagios/cgi-bin -type f -print0 | xargs -0 chmod 755
201
202 keepdir /etc/nagios
203 keepdir /var/nagios
204 keepdir /var/nagios/archives
205 keepdir /var/nagios/rw
206 keepdir /var/nagios/spool/checkresults
207
208 if use !apache2 && use !lighttpd; then
209 chown -R nagios:nagios "${D}"/var/nagios/rw || die "Failed chown of ${D}/var/nagios/rw"
210 else
211 if use apache2 ; then
212 chown -R nagios:apache "${D}"/var/nagios/rw || die "Failed chown of ${D}/var/nagios/rw"
213 elif use lighttpd ; then
214 chown -R nagios:lighttpd "${D}"/var/nagios/rw || die "Failed chown of ${D}/var/nagios/rw"
215 fi
216 fi
217
218 chmod ug+s "${D}"/var/nagios/rw || die "Failed Chmod of ${D}/var/nagios/rw"
219 chmod 0750 "${D}"/etc/nagios || die "Failed chmod of ${D}/etc/nagios"
220 }
221
222 pkg_postinst() {
223 elog "If you want nagios to start at boot time"
224 elog "remember to execute:"
225 elog " rc-update add nagios default"
226 elog
227
228 if use web ; then
229 elog "This does not include cgis that are perl-dependent"
230 elog "Currently traceroute.cgi is perl-dependent"
231 elog "To have ministatus.cgi requires copying of ministatus.c"
232 elog "to cgi directory for compiling."
233
234 elog "Note that the user your webserver is running at needs"
235 elog "read-access to /etc/nagios."
236 elog
237
238 if use apache2 || use lighttpd ; then
239 elog "There are several possible solutions to accomplish this,"
240 elog "choose the one you are most comfortable with:"
241 elog
242 if use apache2 ; then
243 elog " usermod -G nagios apache"
244 elog "or"
245 elog " chown nagios:apache /etc/nagios"
246 elog
247 elog "Also edit /etc/conf.d/apache2 and add \"-D NAGIOS\""
248 elif use lighttpd ; then
249 elog " usermod -G nagios lighttpd "
250 elog "or"
251 elog " chown nagios:lighttpd /etc/nagios"
252 fi
253 elog
254 elog "That will make nagios's web front end visable via"
255 elog "http://localhost/nagios/"
256 elog
257 else
258 elog "IMPORTANT: Do not forget to add the user your webserver"
259 elog "is running as to the nagios group!"
260 fi
261
262 else
263 elog "Please note that you have installed Nagios without web interface."
264 elog "Please don't file any bugs about having no web interface when you do this."
265 elog "Thank you!"
266 fi
267
268 elog
269 elog "If your kernel has /proc protection, nagios"
270 elog "will not be happy as it relies on accessing the proc"
271 elog "filesystem. You can fix this by adding nagios into"
272 elog "the group wheel, but this is not recomended."
273 elog
274 }
275
276 pkg_postinst() {
277 einfo "Fixing permissions"
278 chown nagios:nagios "${ROOT}"var/nagios
279 }
280
281
282
283 1.1 net-analyzer/nagios-core/nagios-core-3.1.2.ebuild
284
285 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-analyzer/nagios-core/nagios-core-3.1.2.ebuild?rev=1.1&view=markup
286 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-analyzer/nagios-core/nagios-core-3.1.2.ebuild?rev=1.1&content-type=text/plain
287
288 Index: nagios-core-3.1.2.ebuild
289 ===================================================================
290 # Copyright 1999-2009 Gentoo Foundation
291 # Distributed under the terms of the GNU General Public License v2
292 # $Header: /var/cvsroot/gentoo-x86/net-analyzer/nagios-core/nagios-core-3.1.2.ebuild,v 1.1 2009/06/24 21:27:21 dertobi123 Exp $
293
294 EAPI="2"
295
296 inherit eutils depend.apache toolchain-funcs
297
298 MY_P=${PN/-core}-${PV}
299 DESCRIPTION="Nagios Core - Check daemon, CGIs, docs"
300 HOMEPAGE="http://www.nagios.org/"
301 SRC_URI="mirror://sourceforge/nagios/${MY_P}.tar.gz"
302
303 LICENSE="GPL-2"
304 SLOT="0"
305 KEYWORDS="~alpha ~amd64 ~ppc ~ppc64 ~sparc ~x86"
306 IUSE="debug lighttpd perl +web vim-syntax"
307 DEPEND="virtual/mailx
308 web? (
309 >=media-libs/gd-1.8.3-r5[jpeg,png]
310 lighttpd? ( www-servers/lighttpd dev-lang/php[cgi] )
311 apache2? ( || ( dev-lang/php[apache2] dev-lang/php[cgi] ) )
312 )
313 perl? ( >=dev-lang/perl-5.6.1-r7 )"
314 RDEPEND="${DEPEND}
315 vim-syntax? ( app-vim/nagios-syntax )"
316
317 want_apache2
318
319 S="${WORKDIR}/${MY_P}"
320
321 pkg_setup() {
322 depend.apache_pkg_setup
323
324 enewgroup nagios
325 enewuser nagios -1 /bin/bash /var/nagios/home nagios
326 }
327
328 src_unpack() {
329 unpack ${A}
330 cd "${S}"
331
332 local strip="$(echo '$(MAKE) strip-post-install')"
333 sed -i -e "s:${strip}::" {cgi,base}/Makefile.in || die "sed failed in Makefile.in"
334 }
335
336 src_compile() {
337 local myconf
338
339 if use perl ; then
340 myconf="${myconf} --enable-embedded-perl --with-perlcache"
341 fi
342
343 if use debug; then
344 myconf="${myconf} --enable-DEBUG0"
345 myconf="${myconf} --enable-DEBUG1"
346 myconf="${myconf} --enable-DEBUG2"
347 myconf="${myconf} --enable-DEBUG3"
348 myconf="${myconf} --enable-DEBUG4"
349 myconf="${myconf} --enable-DEBUG5"
350 fi
351
352 if use !apache2 && use !lighttpd ; then
353 myconf="${myconf} --with-command-group=nagios"
354 else
355 if use apache2 ; then
356 myconf="${myconf} --with-command-group=apache"
357 myconf="${myconf} --with-httpd-conf=/etc/apache2/conf.d"
358 elif use lighttpd ; then
359 myconf="${myconf} --with-command-group=lighttpd"
360 fi
361 fi
362
363 econf ${myconf} \
364 --prefix=/usr \
365 --bindir=/usr/sbin \
366 --sbindir=/usr/$(get_libdir)/nagios/cgi-bin \
367 --datarootdir=/usr/share/nagios/htdocs \
368 --localstatedir=/var/nagios \
369 --sysconfdir=/etc/nagios \
370 --libexecdir=/usr/$(get_libdir)/nagios/plugins \
371 || die "./configure failed"
372
373 emake CC=$(tc-getCC) nagios || die "make failed"
374
375 if use web ; then
376 # Only compile the CGI's if "web" useflag is set.
377 emake CC=$(tc-getCC) DESTDIR="${D}" cgis || die
378 fi
379 }
380
381 src_install() {
382 dodoc Changelog INSTALLING LEGAL README UPGRADING
383
384 if ! use web ; then
385 sed -i -e 's/cd $(SRC_CGI) && $(MAKE) $@/# line removed due missing web use flag/' \
386 -e 's/cd $(SRC_HTM) && $(MAKE) $@/# line removed due missing web use flag/' \
387 Makefile
388 fi
389
390 sed -i -e 's/^contactgroups$//g' Makefile
391
392 emake DESTDIR="${D}" install
393 emake DESTDIR="${D}" install-config
394 emake DESTDIR="${D}" install-commandmode
395
396 newinitd "${FILESDIR}"/nagios3 nagios
397 newconfd "${FILESDIR}"/conf.d nagios
398
399 # Apache Module
400 if use web ; then
401 if use apache2 ; then
402 insinto "${APACHE_MODULES_CONFDIR}"
403 doins "${FILESDIR}"/99_nagios3.conf
404 elif use lighttpd ; then
405 insinto /etc/lighttpd
406 newins "${FILESDIR}/lighttpd_nagios3-r1.conf" nagios.conf
407 else
408 ewarn "${CATEGORY}/${PF} only supports Apache-2.x or Lighttpd webserver"
409 ewarn "out-of-the-box. Since you are not using one of them, you"
410 ewarn "have to configure your webserver accordingly yourself."
411 fi
412
413 fi
414
415 for dir in etc/nagios var/nagios ; do
416 chown -R nagios:nagios "${D}/${dir}" || die "Failed chown of ${D}/${dir}"
417 done
418
419 chown -R root:root "${D}"/usr/$(get_libdir)/nagios
420 find "${D}"/usr/$(get_libdir)/nagios -type d -print0 | xargs -0 chmod 755
421 find "${D}"/usr/$(get_libdir)/nagios/cgi-bin -type f -print0 | xargs -0 chmod 755
422
423 keepdir /etc/nagios
424 keepdir /var/nagios
425 keepdir /var/nagios/archives
426 keepdir /var/nagios/rw
427 keepdir /var/nagios/spool/checkresults
428
429 if use !apache2 && use !lighttpd; then
430 chown -R nagios:nagios "${D}"/var/nagios/rw || die "Failed chown of ${D}/var/nagios/rw"
431 else
432 if use apache2 ; then
433 chown -R nagios:apache "${D}"/var/nagios/rw || die "Failed chown of ${D}/var/nagios/rw"
434 elif use lighttpd ; then
435 chown -R nagios:lighttpd "${D}"/var/nagios/rw || die "Failed chown of ${D}/var/nagios/rw"
436 fi
437 fi
438
439 chmod ug+s "${D}"/var/nagios/rw || die "Failed Chmod of ${D}/var/nagios/rw"
440 chmod 0750 "${D}"/etc/nagios || die "Failed chmod of ${D}/etc/nagios"
441 }
442
443 pkg_postinst() {
444 elog "If you want nagios to start at boot time"
445 elog "remember to execute:"
446 elog " rc-update add nagios default"
447 elog
448
449 if use web ; then
450 elog "This does not include cgis that are perl-dependent"
451 elog "Currently traceroute.cgi is perl-dependent"
452 elog "To have ministatus.cgi requires copying of ministatus.c"
453 elog "to cgi directory for compiling."
454
455 elog "Note that the user your webserver is running at needs"
456 elog "read-access to /etc/nagios."
457 elog
458
459 if use apache2 || use lighttpd ; then
460 elog "There are several possible solutions to accomplish this,"
461 elog "choose the one you are most comfortable with:"
462 elog
463 if use apache2 ; then
464 elog " usermod -G nagios apache"
465 elog "or"
466 elog " chown nagios:apache /etc/nagios"
467 elog
468 elog "Also edit /etc/conf.d/apache2 and add \"-D NAGIOS\""
469 elif use lighttpd ; then
470 elog " usermod -G nagios lighttpd "
471 elog "or"
472 elog " chown nagios:lighttpd /etc/nagios"
473 fi
474 elog
475 elog "That will make nagios's web front end visable via"
476 elog "http://localhost/nagios/"
477 elog
478 else
479 elog "IMPORTANT: Do not forget to add the user your webserver"
480 elog "is running as to the nagios group!"
481 fi
482
483 else
484 elog "Please note that you have installed Nagios without web interface."
485 elog "Please don't file any bugs about having no web interface when you do this."
486 elog "Thank you!"
487 fi
488
489 elog
490 elog "If your kernel has /proc protection, nagios"
491 elog "will not be happy as it relies on accessing the proc"
492 elog "filesystem. You can fix this by adding nagios into"
493 elog "the group wheel, but this is not recomended."
494 elog
495 }
496
497 pkg_postinst() {
498 einfo "Fixing permissions"
499 chown nagios:nagios "${ROOT}"var/nagios
500 }
501
502
503
504 1.1 net-analyzer/nagios-core/nagios-core-2.12-r1.ebuild
505
506 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-analyzer/nagios-core/nagios-core-2.12-r1.ebuild?rev=1.1&view=markup
507 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-analyzer/nagios-core/nagios-core-2.12-r1.ebuild?rev=1.1&content-type=text/plain
508
509 Index: nagios-core-2.12-r1.ebuild
510 ===================================================================
511 # Copyright 1999-2009 Gentoo Foundation
512 # Distributed under the terms of the GNU General Public License v2
513 # $Header: /var/cvsroot/gentoo-x86/net-analyzer/nagios-core/nagios-core-2.12-r1.ebuild,v 1.1 2009/06/24 21:27:21 dertobi123 Exp $
514
515 EAPI="1"
516
517 inherit eutils depend.apache toolchain-funcs
518
519 MY_P=${PN/-core}-${PV/_}
520 DESCRIPTION="Nagios Core - Check daemon, CGIs, docs"
521 HOMEPAGE="http://www.nagios.org/"
522 SRC_URI="mirror://sourceforge/nagios/${MY_P}.tar.gz
523 mirror://gentoo/nagios-2.0b.cfg-sample.gz"
524
525 LICENSE="GPL-2"
526 SLOT="0"
527 KEYWORDS="~alpha ~amd64 ~ppc ~ppc64 ~sparc ~x86"
528 IUSE="debug perl +web vim-syntax"
529 DEPEND="virtual/mailx
530 web? (
531 >=media-libs/jpeg-6b-r3
532 >=media-libs/libpng-1.2.5-r4
533 >=media-libs/gd-1.8.3-r5
534 perl? ( net-analyzer/traceroute )
535 )
536 perl? ( >=dev-lang/perl-5.6.1-r7 )"
537 RDEPEND="${DEPEND}
538 vim-syntax? ( app-vim/nagios-syntax )"
539
540 want_apache2
541
542 S="${WORKDIR}/${MY_P}"
543
544 pkg_setup() {
545 depend.apache_pkg_setup
546
547 # Check if gd has been compiled with jpeg and png support
548 if use web; then
549 if ! built_with_use media-libs/gd jpeg png; then
550 eerror "Your gd has been compiled without jpeg and/or png support."
551 eerror "Please re-emerge gd:"
552 eerror "# USE="jpeg png" emerge gd"
553 die "pkg_setup failed"
554 fi
555 fi
556
557 enewgroup nagios
558 enewuser nagios -1 /bin/bash /var/nagios/home nagios
559 }
560
561 src_unpack() {
562 unpack ${A}
563 cd "${S}"
564
565 epatch "${FILESDIR}"/2.x-series-nsca.patch
566
567 # Fix remote execution in statuswml.cgi, bug #275288
568 epatch "${FILESDIR}/statuswml-bug275288.patch"
569
570 local strip="$(echo '$(MAKE) strip-post-install')"
571 sed -i -e "s:${strip}::" {cgi,base}/Makefile.in || die "sed failed in Makefile.in"
572 }
573
574 src_compile() {
575 local myconf
576
577 if use perl
578 then
579 myconf="${myconf} --enable-embedded-perl --with-perlcache"
580 fi
581
582 if use debug; then
583 myconf="${myconf} --enable-DEBUG0"
584 myconf="${myconf} --enable-DEBUG1"
585 myconf="${myconf} --enable-DEBUG2"
586 myconf="${myconf} --enable-DEBUG3"
587 myconf="${myconf} --enable-DEBUG4"
588 myconf="${myconf} --enable-DEBUG5"
589 fi
590
591 if use apache2 ; then
592 myconf="${myconf} --with-command-group=apache"
593 else
594 myconf="${myconf} --with-command-group=nagios"
595 fi
596
597 econf ${myconf} \
598 --prefix=/usr/nagios \
599 --localstatedir=/var/nagios \
600 --sysconfdir=/etc/nagios \
601 --datadir=/usr/nagios/share \
602 || die "./configure failed"
603
604 emake CC=$(tc-getCC) nagios || die "make failed"
605
606 if use web ; then
607 # Only compile the CGI's if "web" useflag is set.
608 make CC=$(tc-getCC) DESTDIR="${D}" cgis || die
609 fi
610
611 emake -C contrib all || die "contrib make filed"
612
613 }
614
615 src_install() {
616 dodoc Changelog INSTALLING LEGAL README UPGRADING
617 docinto contrib
618 dodoc contrib/README
619
620 if ! use web; then
621 sed -i -e 's/cd $(SRC_CGI) && $(MAKE) $@/# line removed due missing web use flag/' \
622 -e 's/cd $(SRC_HTM) && $(MAKE) $@/# line removed due missing web use flag/' \
623 Makefile
624 fi
625
626 sed -i -e 's/^contactgroups$//g' Makefile
627
628 make DESTDIR="${D}" install
629 make DESTDIR="${D}" install-config
630 make DESTDIR="${D}" install-commandmode
631
632 docinto sample-configs
633 dodoc "${D}"/etc/nagios/*
634 rm "${D}"/etc/nagios/*
635
636 newdoc "${WORKDIR}"/nagios-2.0b.cfg-sample nagios.cfg-sample
637
638 #contribs are not configured by the configure script, we'll configure them overselves...
639 find "${S}"/contrib/ -type f | xargs sed -e 's:/usr/local/nagios/var/rw:/var/nagios/rw:;
640 s:/usr/local/nagios/libexec:/usr/nagios/libexec:;
641 s:/usr/local/nagios/etc:/etc/nagios:;
642 s:/usr/local/nagios/sbin:/usr/nagios/sbin:;' -i
643
644 insinto /usr/share/doc/${PF}/contrib
645 doins -r contrib/eventhandlers
646
647 doinitd "${FILESDIR}"/nagios
648
649 chmod 644 "${S}"/contrib/*.cgi
650 into /usr/nagios
651 for bin in `find contrib/ -type f -perm 0755 -maxdepth 1` ; do
652 dobin "$bin"
653 done
654
655 # Apache Module
656 if use web ; then
657 if use apache2 ; then
658 insinto "${APACHE_MODULES_CONFDIR}"
659 doins "${FILESDIR}"/99_nagios.conf
660 else
661 ewarn "${CATEGORY}/${PF} only supports apache-2.x webserver"
662 ewarn "out-of-the-box. Since you are not using apache, you"
663 ewarn "have to configure your webserver accordingly yourself."
664 fi
665
666 if use perl; then
667 into /usr/nagios ; dosbin contrib/traceroute.cgi
668 fi
669 fi
670
671 for dir in etc/nagios var/nagios ; do
672 chown -R nagios:nagios "${D}/${dir}" || die "Failed chown of ${D}/${dir}"
673 done
674
675 chown -R root:root "${D}"/usr/nagios
676 find "${D}"/usr/nagios -type d -print0 | xargs -0 chmod 755
677 find "${D}"/usr/nagios/*bin -type f -print0 | xargs -0 chmod 755
678 find "${D}"/usr/nagios/share -type f -print0 | xargs -0 chmod 644
679
680 keepdir /etc/nagios
681 keepdir /var/nagios
682 keepdir /var/nagios/archives
683 keepdir /usr/nagios/share/ssi
684 keepdir /var/nagios/rw
685
686 if use apache2 ; then
687 chown -R nagios:apache "${D}"/var/nagios/rw || die "Failed Chown of ${D}/var/nagios/rw"
688 else
689 chown -R nagios:nagios "${D}"/var/nagios/rw || die "Failed Chown of ${D}/var/nagios/rw"
690 fi
691
692 chmod ug+s "${D}"/var/nagios/rw || die "Failed Chmod of ${D}/var/nagios/rw"
693 chmod 0750 "${D}"/etc/nagios || die "Failed chmod of ${D}/etc/nagios"
694
695 cat << EOF > "${T}"/55-nagios-core-revdep
696 SEARCH_DIRS="/usr/nagios/bin /usr/nagios/libexec"
697 EOF
698
699 insinto /etc/revdep-rebuild
700 doins "${T}"/55-nagios-core-revdep
701 }
702
703 pkg_postinst() {
704 elog
705 elog "The example config files are located at /usr/share/doc/${PF}/sample-configs/."
706 elog
707 elog "Also, if you want nagios to start at boot time"
708 elog "remember to execute:"
709 elog " rc-update add nagios default"
710 elog
711
712 if use web; then
713 elog "This does not include cgis that are perl-dependent"
714 elog "Currently traceroute.cgi is perl-dependent"
715 elog "To have ministatus.cgi requires copying of ministatus.c"
716 elog "to cgi directory for compiling."
717
718 elog "Note that the user your webserver is running at needs"
719 elog "read-access to /etc/nagios."
720 elog
721
722 if use apache2 ; then
723 elog "There are several possible solutions to accomplish this,"
724 elog "choose the one you are most comfortable with:"
725 elog " usermod -G nagios apache"
726 elog "or"
727 elog " chown nagios:apache /etc/nagios"
728 elog
729 elog "Also edit /etc/conf.d/apache2 and add \"-D NAGIOS\""
730 elog
731 elog "That will make nagios's web front end visable via"
732 elog "http://localhost/nagios/"
733 elog
734 else
735 elog "IMPORTANT: Do not forget to add the user your webserver"
736 elog "is running as to the nagios group!"
737 fi
738
739 else
740 elog "Please note that you have installed Nagios without web interface."
741 elog "Please don't file any bugs about having no web interface when you do this."
742 elog "Thank you!"
743 fi
744
745 elog
746 elog "If your kernel has /proc protection, nagios"
747 elog "will not be happy as it relies on accessing the proc"
748 elog "filesystem. You can fix this by adding nagios into"
749 elog "the group wheel, but this is not recomended."
750 elog
751
752 elog
753 ewarn "Use /usr/nagios/bin/convertcfg for configuration file conversion"
754 }
755
756 pkg_prerm() {
757 [[ "${ROOT}" == "/" ]] && /etc/init.d/nagios stop
758 }