1 # Copyright 1999-2010 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/net-analyzer/icinga-core/icinga-core-3.1.0.ebuild,v 1.3 2009/02/24 17:07:42 dertobi123 Exp $
7 inherit eutils depend.apache toolchain-funcs
9 SRC_URI="mirror://sourceforge/icinga/icinga-${PV}.tar.gz"
10 DESCRIPTION="Icinga - Check daemon, CGIs, docs, IDOutils"
11 HOMEPAGE="http://www.icinga.org/"
15 KEYWORDS="~amd64 ~x86"
16 IUSE="+apache2 api debug +idoutils lighttpd perl plugins +vim-syntax +web"
17 DEPEND="idoutils? ( dev-db/libdbi-drivers[mysql] )
18 perl? ( >=dev-lang/perl-5.6.1-r7 )
21 >=media-libs/gd-1.8.3-r5[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/bash /var/spool/icinga icinga
38 local strip="$(echo '$(MAKE) strip-post-install')"
39 sed -i -e "s:${strip}::" {cgi,base}/Makefile.in || die "sed failed in
42 sed -i -e 's/USE_ICINGAAPI=no/USE_ICINGAAPI=yes/g' Makefile.in
50 myconf="${myconf} --enable-embedded-perl --with-perlcache"
53 myconf="${myconf} --disable-statuswrl $(use_enable idoutils)"
56 myconf="${myconf} --enable-DEBUG0"
57 myconf="${myconf} --enable-DEBUG1"
58 myconf="${myconf} --enable-DEBUG2"
59 myconf="${myconf} --enable-DEBUG3"
60 myconf="${myconf} --enable-DEBUG4"
61 myconf="${myconf} --enable-DEBUG5"
64 if use !apache2 && use !lighttpd ; then
65 myconf="${myconf} --with-command-group=icinga"
68 myconf="${myconf} --with-command-group=apache"
69 myconf="${myconf} --with-httpd-conf=/etc/apache2/conf.d"
70 elif use lighttpd ; then
71 myconf="${myconf} --with-command-group=lighttpd"
78 --sbindir=/usr/$(get_libdir)/icinga/cgi-bin \
79 --datarootdir=/usr/share/icinga/htdocs \
80 --localstatedir=/var/icinga \
81 --sysconfdir=/etc/icinga \
82 --libexecdir=/usr/$(get_libdir)/icinga/plugins \
83 || die "./configure failed"
85 sed -i -e 's/USE_ICINGAAPI=no/USE_ICINGAAPI=yes/g' Makefile
91 --sbindir=/usr/$(get_libdir)/icinga/cgi-bin \
92 --datarootdir=/usr/share/icinga/htdocs \
93 --localstatedir=/var/icinga \
94 --sysconfdir=/etc/icinga \
95 --libexecdir=/usr/$(get_libdir)/icinga/plugins \
96 || die "./configure failed"
102 emake CC=$(tc-getCC) icinga || die "make failed"
105 # Only compile the CGI's if "web" useflag is set.
106 emake CC=$(tc-getCC) DESTDIR="${D}" cgis || die
109 if use idoutils ; then
110 # Only compile IDOUtils if "idoutils" useflag is set.
111 emake CC=$(tc-getCC) DESTDIR="${D}" idoutils || die
116 dodoc Changelog INSTALLING LEGAL README UPGRADING
119 sed -i -e 's/cd $(SRC_CGI) && $(MAKE) $@/# line removed due missing web use flag/' \
120 -e 's/cd $(SRC_HTM) && $(MAKE) $@/# line removed due missing web use flag/' \
123 sed -i -e 's/^contactgroups$//g' Makefile
125 emake DESTDIR="${D}" install
126 emake DESTDIR="${D}" install-config
127 emake DESTDIR="${D}" install-commandmode
129 if use idoutils ; then
130 emake DESTDIR="${D}" install-idoutils
133 emake DESTDIR="${D}" install-api
136 newinitd "${FILESDIR}"/icinga-init.d icinga
137 newconfd "${FILESDIR}"/icinga-conf.d icinga
138 if use idoutils ; then
139 newinitd "${FILESDIR}"/ido2db-init.d ido2db
140 newconfd "${FILESDIR}"/ido2db-conf.d ido2db
141 mkdir -p "${D}"/usr/share/icinga/contrib/db
142 cp -r "${S}"/module/idoutils/db/* "${D}"/usr/share/icinga/contrib/db/
146 if use apache2 ; then
147 insinto "${APACHE_MODULES_CONFDIR}"
148 newins "${FILESDIR}"/icinga-apache.conf 99_icinga.conf
149 elif use lighttpd ; then
150 insinto /etc/lighttpd
151 newins "${FILESDIR}"/icinga-lighty.conf lighttpd_icinga.conf
153 ewarn "${CATEGORY}/${PF} only supports Apache-2.x or Lighttpd webserver"
154 ewarn "out-of-the-box. Since you are not using one of them, you"
155 ewarn "have to configure your webserver accordingly yourself."
160 for dir in etc/icinga var/icinga ; do
161 chown -R icinga:icinga "${D}/${dir}" || die "Failed chown of ${D}/${dir}"
164 chown -R root:root "${D}"/usr/$(get_libdir)/icinga
165 find "${D}"/usr/$(get_libdir)/icinga -type d -print0 | xargs -0 chmod 755
166 find "${D}"/usr/$(get_libdir)/icinga/cgi-bin -type f -print0 | xargs -0 chmod 755
170 keepdir /var/icinga/archives
171 keepdir /var/icinga/rw
172 keepdir /var/icinga/spool/checkresults
174 if use !apache2 && use !lighttpd; then
175 chown -R icinga:icinga "${D}"/var/icinga/rw || die "Failed chown of ${D}/var/icinga/rw"
177 if use apache2 ; then
178 chown -R icinga:apache "${D}"/var/icinga/rw || die "Failed chown of ${D}/var/icinga/rw"
179 elif use lighttpd ; then
180 chown -R icinga:lighttpd "${D}"/var/icinga/rw || die "Failed chown of ${D}/var/icinga/rw"
184 chmod ug+s "${D}"/var/icinga/rw || die "Failed Chmod of ${D}/var/icinga/rw"
185 chmod 0750 "${D}"/etc/icinga || die "Failed chmod of ${D}/etc/icinga"
189 elog "If you want icinga to start at boot time"
190 elog "remember to execute:"
191 elog " rc-update add icinga default"
195 elog "This does not include cgis that are perl-dependent"
196 elog "Currently traceroute.cgi is perl-dependent"
197 elog "To have ministatus.cgi requires copying of ministatus.c"
198 elog "to cgi directory for compiling."
200 elog "Note that the user your webserver is running at needs"
201 elog "read-access to /etc/icinga."
204 if use apache2 || use lighttpd ; then
205 elog "There are several possible solutions to accomplish this,"
206 elog "choose the one you are most comfortable with:"
208 if use apache2 ; then
209 elog " usermod -G icinga apache"
211 elog " chown icinga:apache /etc/icinga"
213 elog "Also edit /etc/conf.d/apache2 and add \"-D ICINGA\""
214 elif use lighttpd ; then
215 elog " usermod -G icinga lighttpd "
217 elog " chown icinga:lighttpd /etc/icinga"
220 elog "That will make icinga's web front end visable via"
221 elog "http://localhost/icinga/"
224 elog "IMPORTANT: Do not forget to add the user your webserver"
225 elog "is running as to the icinga group!"
229 elog "Please note that you have installed Icinga without web interface."
230 elog "Please don't file any bugs about having no web interface when you do this."
235 elog "If your kernel has /proc protection, icinga"
236 elog "will not be happy as it relies on accessing the proc"
237 elog "filesystem. You can fix this by adding icinga into"
238 elog "the group wheel, but this is not recomended."
240 einfo "Fixing permissions"
241 chown icinga:icinga "${ROOT}"var/icinga