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 /bin/false /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"
61 elog "That will make icinga's web front end visable via"
62 elog "http://localhost/icinga/"
65 elog "IMPORTANT: Do not forget to add the user your webserver"
66 elog "is running as to the icinga group!"
70 ewarn "Please note that you have installed Icinga without web interface."
71 ewarn "Please don't file any bugs about having no web interface when you do this."
79 sed -i -e 's/\(USE_ICINGAAPI=\)no/\1yes/g' Makefile.in || die "sed failed in Makefile.in"
86 myconf="$(use_enable perl embedded-perl)
87 $(use_with perl perlcache)
88 $(use_enable idoutils)
90 $(use_enable debug DEBUG0)
91 $(use_enable debug DEBUG1)
92 $(use_enable debug DEBUG2)
93 $(use_enable debug DEBUG3)
94 $(use_enable debug DEBUG4)
95 $(use_enable debug DEBUG5)
99 --sbindir=/usr/$(get_libdir)/icinga/cgi-bin
100 --datarootdir=/usr/share/icinga/htdocs
101 --localstatedir=/var/icinga
102 --sysconfdir=/etc/icinga
103 --libexecdir=/usr/$(get_libdir)/icinga/plugins"
105 if use !apache2 && use !lighttpd ; then
106 myconf+=" --with-command-group=icinga"
108 if use apache2 ; then
109 myconf+=" --with-command-group=apache --with-httpd-conf=/etc/apache2/conf.d"
110 elif use lighttpd ; then
111 myconf+=" --with-command-group=lighttpd"
125 emake icinga || die "make failed"
128 emake DESTDIR="${D}" cgis || die
131 if use idoutils ; then
132 emake DESTDIR="${D}" idoutils || die
137 dodoc Changelog README UPGRADING || die
140 sed -i -e '/cd $(SRC_\(CGI\|HTM\))/d' Makefile || die
142 sed -i -e 's/^contactgroups$//g' Makefile || die
144 emake DESTDIR="${D}" install{,-config,-commandmode} || die
146 if use idoutils ; then
147 emake DESTDIR="${D}" install-idoutils || die
150 emake DESTDIR="${D}" install-api || die
153 newinitd "${FILESDIR}"/icinga-init.d icinga || die
154 newconfd "${FILESDIR}"/icinga-conf.d icinga || die
155 if use idoutils ; then
156 newinitd "${FILESDIR}"/ido2db-init.d ido2db || die
157 newconfd "${FILESDIR}"/ido2db-conf.d ido2db || die
158 insinto /usr/share/icinga/contrib/db
159 doins -r module/idoutils/db/* || die
163 if use apache2 ; then
164 insinto "${APACHE_MODULES_CONFDIR}"
165 newins "${FILESDIR}"/icinga-apache.conf 99_icinga.conf || die
166 elif use lighttpd ; then
167 insinto /etc/lighttpd
168 newins "${FILESDIR}"/icinga-lighty.conf lighttpd_icinga.conf || die
170 ewarn "${CATEGORY}/${PF} only supports Apache-2.x or Lighttpd webserver"
171 ewarn "out-of-the-box. Since you are not using one of them, you"
172 ewarn "have to configure your webserver accordingly yourself."
177 fowners -R icinga:icinga /etc/icinga /var/icinga || die "Failed chown of /etc/icinga"
179 fowners -R root:root /usr/$(get_libdir)/icinga
180 find "${D}"/usr/$(get_libdir)/icinga -type d -exec fperms 755 {} +
181 find "${D}"/usr/$(get_libdir)/icinga/cgi-bin -type f -exec fperms 755 {} +
185 keepdir /var/icinga/archives
186 keepdir /var/icinga/rw
187 keepdir /var/icinga/spool/checkresults
189 use apache2 && webserver=apache2 || use lighttpd && webserver=lighttpd || webserver=icinga
190 fowners -R icinga:${webserver} /var/icinga/rw || die "Failed chown of /var/icinga/rw"
192 fperms 6755 /var/icinga/rw || die "Failed Chmod of ${D}/var/icinga/rw"
193 fperms 0750 /etc/icinga || die "Failed chmod of ${D}/etc/icinga"
197 elog "If you want icinga to start at boot time"
198 elog "remember to execute:"
199 elog " rc-update add icinga default"
201 elog "If your kernel has /proc protection, icinga"
202 elog "will not be happy as it relies on accessing the proc"
203 elog "filesystem. You can fix this by adding icinga into"
204 elog "the group wheel, but this is not recomended."