diff -Nur /usr/local/portage/empty/icinga/Manifest /usr/local/portage/net-analyzer/icinga/Manifest --- /usr/local/portage/empty/icinga/Manifest 1970-01-01 01:00:00.000000000 +0100 +++ /usr/local/portage/net-analyzer/icinga/Manifest 2010-08-11 16:22:24.000000000 +0200 @@ -0,0 +1 @@ +EBUILD icinga-1.0.2.ebuild 1710 RMD160 f7af3482e7740a8394c720a652234552d42ae50f SHA1 ce2d2fea1a54b152ff30323a3c0dc86f60e4e7a1 SHA256 a9ae5b1cdab9056ab600dd6cadd32f8bf91e26eb0a0ba5d359e066183dc1175e diff -Nur /usr/local/portage/empty/icinga/icinga-1.0.2.ebuild /usr/local/portage/net-analyzer/icinga/icinga-1.0.2.ebuild --- /usr/local/portage/empty/icinga/icinga-1.0.2.ebuild 1970-01-01 01:00:00.000000000 +0100 +++ /usr/local/portage/net-analyzer/icinga/icinga-1.0.2.ebuild 2010-08-11 16:22:02.000000000 +0200 @@ -0,0 +1,53 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +inherit multilib + +DESCRIPTION="The Icinga metapackage - merge this to pull install all of the icinga packages" +HOMEPAGE="http://www.icinga.org" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="alpha amd64 ~ppc ~ppc64 ~sparc x86" +IUSE="" + +RDEPEND="~net-analyzer/icinga-core-${PV} + >=net-analyzer/nagios-plugins-1.4.13-r1 + >=net-analyzer/nagios-imagepack-1.0-r100" + +pkg_setup() { + # Avoid upgrading from Nagios <3 as the directory structure has changed + if has_version '/icinga &>/dev/null + eend $? +} + + +checkconfig() { + # Silent Check + /icinga -v /icinga.cfg &>/dev/null && return 0 + + # Now we know there's problem - run again and display errors + /icinga -v /icinga.cfg + eend $? "Configuration Error. Please fix your configfile" +} + +start() { + checkconfig || return 1 + ebegin "Starting icinga" + rm -f /rw/icinga.cmd + start-stop-daemon --quiet --start --startas /icinga \ + -e HOME="" --pidfile /icinga.lock \ + -- -d /icinga.cfg + eend $? +} + +stop() { + ebegin "Stopping icinga" + start-stop-daemon --quiet --stop --pidfile /icinga.lock + eend $? +} + +svc_restart() { + checkconfig || return 1 + ebegin "Restarting icinga" + svc_stop + sleep 1 + svc_start + eend $? +} + diff -Nur /usr/local/portage/empty/icinga-core/files/ido2db /usr/local/portage/net-analyzer/icinga-core/files/ido2db --- /usr/local/portage/empty/icinga-core/files/ido2db 1970-01-01 01:00:00.000000000 +0100 +++ /usr/local/portage/net-analyzer/icinga-core/files/ido2db 2010-08-11 19:42:24.000000000 +0200 @@ -0,0 +1,23 @@ +#!/sbin/runscript +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-analyzer/ndoutils/files/ndo2db.init-nagios3,v 1.2 2008/07/19 15:08:25 dertobi123 Exp $ + +depends() { + before icinga +} + +start() { + ebegin "Starting ido2db" + start-stop-daemon --start --quiet --exec /ido2db \ + -- -c /ido2db.cfg + eend $? +} + +stop() { + ebegin "Stopping ido2db" + start-stop-daemon --stop --quiet --exec /ido2db + return=$? + [ -f /ido.sock ] && rm -rf /ido.sock + eend $return +} diff -Nur /usr/local/portage/empty/icinga-core/files/lighttpd_icinga-r1.conf /usr/local/portage/net-analyzer/icinga-core/files/lighttpd_icinga-r1.conf --- /usr/local/portage/empty/icinga-core/files/lighttpd_icinga-r1.conf 1970-01-01 01:00:00.000000000 +0100 +++ /usr/local/portage/net-analyzer/icinga-core/files/lighttpd_icinga-r1.conf 2010-08-11 20:19:22.000000000 +0200 @@ -0,0 +1,24 @@ +server.modules += ("mod_cgi") +server.modules += ("mod_auth") +server.modules += ("mod_alias") + +auth.require += ( "/icinga" => + ( + "method" => "digest", + "realm" => "icinga", + "require" => "valid-user" + ) +) + +$HTTP["url"] =~ "^/icinga/cgi-bin/" { + dir-listing.activate = "disable" + cgi.assign = ( + ".pl" => "/usr/bin/perl", + ".cgi" => "" + ) +} + +alias.url += ( + "/icinga/cgi-bin" => "", + "/icinga" => "" +) diff -Nur /usr/local/portage/empty/icinga-core/icinga-core-1.0.2.ebuild /usr/local/portage/net-analyzer/icinga-core/icinga-core-1.0.2.ebuild --- /usr/local/portage/empty/icinga-core/icinga-core-1.0.2.ebuild 1970-01-01 01:00:00.000000000 +0100 +++ /usr/local/portage/net-analyzer/icinga-core/icinga-core-1.0.2.ebuild 2010-08-11 20:51:59.000000000 +0200 @@ -0,0 +1,258 @@ +# Copyright 1999-2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +EAPI="2" + +inherit eutils depend.apache toolchain-funcs + +MY_P=${PN/-core}-${PV} +DESCRIPTION="A monitoring system based on Nagios" +HOMEPAGE="http://www.icinga.org/" +#SRC_URI="mirror://sourceforge/${PN/-core}/${MY_P}.tar.gz" +SRC_URI="http://ovh.dl.sourceforge.net/project/icinga/icinga/${PV}/icinga-${PV}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="amd64 x86" +# USE oracle gets added when ocilib made it in the repository +IUSE="lighttpd perl cgi mysql apache2 vim-syntax ssl postgres" +DEPEND="virtual/mailx + cgi? ( >=media-libs/gd-1.8.3-r5[jpeg,png] + lighttpd? ( www-servers/lighttpd ) + apache2? ( www-servers/apache ) + ) + perl? ( >=dev-lang/perl-5.6.1-r7 ) + postgres? ( + dev-db/postgresql-base + dev-db/libdbi-drivers[postgres] + ) + mysql? ( + dev-db/mysql + dev-db/libdbi-drivers[mysql] + ) + ssl? ( dev-libs/openssl ) + vim-syntax? ( app-vim/nagios-syntax ) + " +# oracle? ( +# >=dev-db/ocilib-3.7.0 +# ) + +RDEPEND="${DEPEND}" + +want_apache2 + +S="${WORKDIR}/${MY_P}" + +SELF_BINDIR=/usr/bin +SELF_SBINDIR=/usr/$(get_libdir)/icinga/cgi-bin +SELF_DATAROOTDIR=/usr/share/icinga/htdocs +SELF_LOCALSTATEDIR=/var/icinga +SELF_SYSCONFDIR=/etc/icinga +SELF_LIBEXECDIR=/usr/$(get_libdir)/icinga/plugins + +pkg_setup() { + depend.apache_pkg_setup + + enewgroup icinga + enewuser icinga -1 /bin/bash /var/icinga/home icinga +} + +src_prepare() { + local strip="$(echo '$(MAKE) strip-post-install')" + sed -i -e "s:${strip}::" {cgi,base}/Makefile.in || die "sed failed in Makefile.in" +} + +src_configure() { + local myconf + + if use perl ; then + myconf="${myconf} --enable-embedded-perl --with-perlcache" + fi + + if use !apache2 && use !lighttpd ; then + myconf="${myconf} --with-command-group=icinga" + else + if use apache2 ; then + myconf="${myconf} --with-command-group=apache" + myconf="${myconf} --with-httpd-conf=/etc/apache2/modules.d" + elif use lighttpd ; then + myconf="${myconf} --with-command-group=lighttpd" + fi + fi + + if use ssl; then + myconf="${myconf} --enable-ssl" + fi + + if use oracle; then + myconf="${myconf} --enable-oracle" + fi + + if use postgres; then + myconf="${myconf} --enable-pgsql" + fi + + if use mysql || use postgres || use oracle; then + myconf="${myconf} --enable-idoutils" + fi + + econf ${myconf} \ + --prefix=/usr \ + --bindir=$SELF_BINDIR \ + --sbindir=$SELF_SBINDIR \ + --datarootdir=$SELF_DATAROOTDIR \ + --localstatedir=$SELF_LOCALSTATEDIR \ + --sysconfdir=$SELF_SYSCONFDIR \ + --libexecdir=$SELF_LIBEXECDIR \ + --enable-event-broker \ + || die "./configure failed" +} + +src_compile() { + emake CC=$(tc-getCC) icinga || die "make failed" + + if use mysql || use postgres || use oracle; then + # Only compile the idoutils if one database is set. + emake CC=$(tc-getCC) DESTDIR="${D}" idoutils || die "make failed" + fi + if use cgi; then + # Only compile the idoutils if one database is set. + emake CC=$(tc-getCC) DESTDIR="${D}" cgis html || die "make failed" + fi + +} + +src_install() { + local DBMODEL + + dodoc Changelog INSTALLING LEGAL README UPGRADING + + emake DESTDIR="${D}" install + emake DESTDIR="${D}" install-config + emake DESTDIR="${D}" install-commandmode + + TEMP_INSTALL_FILES=${T}/gentoo_install_files + mkdir $TEMP_INSTALL_FILES + cp ${FILESDIR}/* $TEMP_INSTALL_FILES/ + + # substitude dirs + sed -i -e "s::${SELF_BINDIR}:g" \ + -e "s::$SELF_SBINDIR:g" \ + -e "s::$SELF_DATAROOTDIR:g" \ + -e "s::$SELF_LOCALSTATEDIR:g" \ + -e "s::$SELF_SYSCONFDIR:g" \ + ${TEMP_INSTALL_FILES}/* + + newinitd "${TEMP_INSTALL_FILES}"/icinga icinga + newconfd "${TEMP_INSTALL_FILES}"/conf.d icinga + + if use mysql || use postgres || use oracle; then + emake DESTDIR="${D}" install-idoutils + newinitd "${TEMP_INSTALL_FILES}"/ido2db ido2db + fi + + # Apache Module + if use cgi ; then + emake DESTDIR="${D}" install-cgis + touch ${D}/etc/icinga/htpasswd.users + if use apache2 ; then + sed -i -e 's|$(HTTPD_CONF)/\(icinga.conf\)$|$(HTTPD_CONF)/99_\1|' Makefile + emake DESTDIR="${D}" install-webconf + elif use lighttpd ; then + insinto /etc/lighttpd + newins "${FILESDIR}/lighttpd_icinga-r1.conf" icinga.conf + else + ewarn "${CATEGORY}/${PF} only supports Apache-2.x or Lighttpd webserver" + ewarn "out-of-the-box. Since you are not using one of them, you" + ewarn "have to configure your webserver accordingly yourself." + fi + + fi + + for dir in etc/icinga var/icinga ; do + chown -R icinga:icinga "${D}/${dir}" || die "Failed chown of ${D}/${dir}" + done + + chown -R root:root "${D}"/usr/$(get_libdir)/icinga + find "${D}"/usr/$(get_libdir)/icinga -type d -print0 | xargs -0 chmod 755 + find "${D}"/usr/$(get_libdir)/icinga/cgi-bin -type f -print0 | xargs -0 chmod 755 + + keepdir /etc/icinga + keepdir /var/icinga + keepdir /var/icinga/archives + keepdir /var/icinga/rw + keepdir /var/icinga/spool/checkresults + + if use !apache2 && use !lighttpd; then + chown -R icinga:icinga "${D}"/var/icinga/rw || die "Failed chown of ${D}/var/icinga/rw" + else + if use apache2 ; then + chown -R icinga:apache "${D}"/var/icinga/rw || die "Failed chown of ${D}/var/icinga/rw" + elif use lighttpd ; then + chown -R icinga:lighttpd "${D}"/var/icinga/rw || die "Failed chown of ${D}/var/icinga/rw" + fi + fi + + chmod ug+s "${D}"/var/icinga/rw || die "Failed chmod of ${D}/var/icinga/rw" + chmod 0755 "${D}"/etc/icinga || die "Failed chmod of ${D}/etc/icinga" +} + +pkg_postinst() { + einfo "Fixing permissions" + chown icinga:icinga "${ROOT}"var/icinga + + + elog "If you want icinga to start at boot time" + elog "remember to execute:" + elog " rc-update add icinga default" + elog + + if use mysql || use postgres || use oracle; then + elog "remember to execute:" + elog " rc-update add ido2db default" + elog "to activate idoutils" + elog + fi + + if use cgi ; then + elog "This does not include cgis that are perl-dependent" + elog "Note that the user your webserver is running at needs" + elog "read-access to /etc/icinga." + elog + + if use apache2 || use lighttpd ; then + elog "There are several possible solutions to accomplish this," + elog "choose the one you are most comfortable with:" + elog + if use apache2 ; then + elog " usermod -G icinga apache" + elog "or" + elog " chown icinga:apache /etc/icinga" + elif use lighttpd ; then + elog " usermod -G icinga lighttpd " + elog "or" + elog " chown icinga:lighttpd /etc/icinga" + fi + elog + elog "That will make icinga's web front end visable via" + elog "http://localhost/icinga/" + elog + else + elog "IMPORTANT: Do not forget to add the user your webserver" + elog "is running as to the icinga group!" + fi + + else + elog "Please note that you have installed Icinga without web interface." + elog "Please don't file any bugs about having no web interface when you do this." + elog "Thank you!" + fi + + elog + elog "If your kernel has /proc protection, icinga" + elog "will not be happy as it relies on accessing the proc" + elog "filesystem. You can fix this by adding icinga into" + elog "the group wheel, but this is not recomended." + elog +}