1 # Copyright 1999-2010 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
7 inherit eutils depend.apache toolchain-funcs
9 DESCRIPTION="Nagios Fork - Check daemon, CGIs, docs, IDOutils"
10 HOMEPAGE="http://www.icinga.org/"
11 SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
15 KEYWORDS="~amd64 ~x86"
16 IUSE="+apache2 api debug +idoutils lighttpd +mysql perl plugins postgres ssl +vim-syntax +web"
17 DEPEND="idoutils? ( dev-db/libdbi-drivers[mysql?,postgres?] )
18 perl? ( dev-lang/perl )
21 media-libs/gd[jpeg,png]
22 lighttpd? ( www-servers/lighttpd dev-lang/php[cgi] )
23 apache2? ( || ( dev-lang/php[apache2] dev-lang/php[cgi] ) )
25 !net-analyzer/nagios-core"
27 plugins? ( net-analyzer/nagios-plugins )
28 vim-syntax? ( app-vim/nagios-syntax )"
34 enewuser icinga -1 -1 /var/spool/icinga icinga
36 elog "This does not include cgis that are perl-dependent"
37 elog "Currently traceroute.cgi is perl-dependent"
38 elog "To have ministatus.cgi requires copying of ministatus.c"
39 elog "to cgi directory for compiling."
41 elog "Note that the user your webserver is running at needs"
42 elog "read-access to /etc/icinga."
45 if use apache2 || use lighttpd ; then
46 elog "There are several possible solutions to accomplish this,"
47 elog "choose the one you are most comfortable with:"
50 elog " usermod -G icinga apache"
52 elog " chown icinga:apache /etc/icinga"
54 elog "Also edit /etc/conf.d/apache2 and add \"-D ICINGA\""
55 elif use lighttpd ; then
56 elog " usermod -G icinga lighttpd "
58 elog " chown icinga:lighttpd /etc/icinga"
59 elog "Also edit /etc/lighttpd/lighttpd.conf and add 'include \"lighttpd_icinga.conf\"'"
62 elog "That will make icinga's web front end visable via"
63 elog "http://localhost/icinga/"
66 elog "IMPORTANT: Do not forget to add the user your webserver"
67 elog "is running as to the icinga group!"
71 ewarn "Please note that you have installed Icinga without web interface."
72 ewarn "Please don't file any bugs about having no web interface when you do this."
80 sed -i -e 's/\(USE_ICINGAAPI=\)no/\1yes/g' Makefile.in || die "sed failed in Makefile.in"
87 myconf="$(use_enable perl embedded-perl)
88 $(use_with perl perlcache)
89 $(use_enable idoutils)
91 $(use_enable debug DEBUG0)
92 $(use_enable debug DEBUG1)
93 $(use_enable debug DEBUG2)
94 $(use_enable debug DEBUG3)
95 $(use_enable debug DEBUG4)
96 $(use_enable debug DEBUG5)
100 --sbindir=/usr/$(get_libdir)/icinga/cgi-bin
101 --datarootdir=/usr/share/icinga/htdocs
102 --localstatedir=/var/icinga
103 --sysconfdir=/etc/icinga
104 --libexecdir=/usr/$(get_libdir)/icinga/plugins"
106 if use !apache2 && use !lighttpd ; then
107 myconf+=" --with-command-group=icinga"
109 if use apache2 ; then
110 myconf+=" --with-command-group=apache --with-httpd-conf=/etc/apache2/conf.d"
111 elif use lighttpd ; then
112 myconf+=" --with-command-group=lighttpd"
126 emake icinga || die "make failed"
129 emake DESTDIR="${D}" cgis || die
132 if use idoutils ; then
133 emake DESTDIR="${D}" idoutils || die
138 dodoc Changelog README UPGRADING || die
141 sed -i -e '/cd $(SRC_\(CGI\|HTM\))/d' Makefile || die
143 sed -i -e 's/^contactgroups$//g' Makefile || die
145 emake DESTDIR="${D}" install{,-config,-commandmode} || die
147 if use idoutils ; then
148 emake DESTDIR="${D}" install-idoutils || die
151 emake DESTDIR="${D}" install-api || die
154 newinitd "${FILESDIR}"/icinga-init.d icinga || die
155 newconfd "${FILESDIR}"/icinga-conf.d icinga || die
156 if use idoutils ; then
157 newinitd "${FILESDIR}"/ido2db-init.d ido2db || die
158 newconfd "${FILESDIR}"/ido2db-conf.d ido2db || die
159 insinto /usr/share/icinga/contrib/db
160 doins -r module/idoutils/db/* || die
164 if use apache2 ; then
165 insinto "${APACHE_MODULES_CONFDIR}"
166 newins "${FILESDIR}"/icinga-apache.conf 99_icinga.conf || die
167 elif use lighttpd ; then
168 insinto /etc/lighttpd
169 newins "${FILESDIR}"/icinga-lighty.conf lighttpd_icinga.conf || die
171 ewarn "${CATEGORY}/${PF} only supports Apache-2.x or Lighttpd webserver"
172 ewarn "out-of-the-box. Since you are not using one of them, you"
173 ewarn "have to configure your webserver accordingly yourself."
178 fowners -R icinga:icinga /etc/icinga /var/icinga || die "Failed chown of /etc/icinga"
180 fowners -R root:root /usr/$(get_libdir)/icinga
182 find usr/$(get_libdir)/icinga -type d -exec fperms 755 {} +
183 find usr/$(get_libdir)/icinga/cgi-bin -type f -exec fperms 755 {} +
187 keepdir /var/icinga/archives
188 keepdir /var/icinga/rw
189 keepdir /var/icinga/spool/checkresults
191 if use apache2 ; then
193 elif use lighttpd ; then
198 fowners -R icinga:${webserver} /var/icinga/rw || die "Failed chown of /var/icinga/rw"
200 fperms 6755 /var/icinga/rw || die "Failed Chmod of ${D}/var/icinga/rw"
201 fperms 0750 /etc/icinga || die "Failed chmod of ${D}/etc/icinga"
205 elog "If you want icinga to start at boot time"
206 elog "remember to execute:"
207 elog " rc-update add icinga default"
209 elog "If your kernel has /proc protection, icinga"
210 elog "will not be happy as it relies on accessing the proc"
211 elog "filesystem. You can fix this by adding icinga into"
212 elog "the group wheel, but this is not recomended."