| 1 |
# Copyright 1999-2012 Gentoo Foundation
|
| 2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
# $Header: /var/cvsroot/gentoo-x86/net-analyzer/icinga-web/icinga-web-1.7.1-r1.ebuild,v 1.2 2012/07/22 00:33:57 idl0r Exp $
|
| 4 |
|
| 5 |
EAPI="2"
|
| 6 |
|
| 7 |
inherit depend.apache eutils user multilib
|
| 8 |
|
| 9 |
DESCRIPTION="Icinga Web - new Web Interface"
|
| 10 |
HOMEPAGE="http://www.icinga.org/"
|
| 11 |
SRC_URI="mirror://sourceforge/icinga/${P}.tar.gz"
|
| 12 |
LICENSE="GPL-2"
|
| 13 |
SLOT="0"
|
| 14 |
KEYWORDS="~x86 ~amd64"
|
| 15 |
IUSE="apache2 mysql pnp postgres"
|
| 16 |
DEPEND="dev-php/phing
|
| 17 |
dev-lang/php[apache2?,cli,mysql?,pdo,postgres?,json]
|
| 18 |
pnp? ( net-analyzer/pnp4nagios )"
|
| 19 |
RDEPEND="${DEPEND}"
|
| 20 |
|
| 21 |
want_apache2
|
| 22 |
|
| 23 |
pkg_setup() {
|
| 24 |
if use apache2 ; then
|
| 25 |
depend.apache_pkg_setup
|
| 26 |
fi
|
| 27 |
enewgroup icinga
|
| 28 |
enewgroup nagios
|
| 29 |
enewuser icinga -1 -1 /var/lib/icinga "icinga,nagios"
|
| 30 |
}
|
| 31 |
|
| 32 |
src_prepare() {
|
| 33 |
epatch "${FILESDIR}/${P}-disable-compression.patch"
|
| 34 |
}
|
| 35 |
|
| 36 |
src_configure() {
|
| 37 |
local myconf
|
| 38 |
|
| 39 |
myconf="--prefix=/usr/share/icinga/icinga-web
|
| 40 |
--bindir=/usr/sbin
|
| 41 |
--sbindir=/usr/$(get_libdir)/icinga/cgi-bin
|
| 42 |
--datarootdir=/usr/share/icinga/htdocs
|
| 43 |
--localstatedir=/var/lib/icinga
|
| 44 |
--sysconfdir=/etc/icinga
|
| 45 |
--libexecdir=/usr/$(get_libdir)/icinga/plugins
|
| 46 |
--with-bin-user=icinga
|
| 47 |
--with-bin-group=nagios
|
| 48 |
--with-api-cmd-file=/var/lib/icinga/rw/icinga.cmd
|
| 49 |
--with-conf-dir=/etc/icinga-web
|
| 50 |
--with-log-dir=/var/log/icinga-web
|
| 51 |
--with-icinga-objects-dir=/etc/icinga/objects
|
| 52 |
--with-icinga-bin=/usr/sbin/icinga
|
| 53 |
--with-icinga-cfg=/etc/icinga/icinga.cfg"
|
| 54 |
|
| 55 |
if use apache2 ; then
|
| 56 |
myconf+=" --with-web-user=apache
|
| 57 |
--with-web-group=apache
|
| 58 |
--with-web-apache-path=${APACHE_MODULES_CONFDIR}"
|
| 59 |
else
|
| 60 |
myconf+=" --with-web-user=root
|
| 61 |
--with-web-group=root"
|
| 62 |
fi
|
| 63 |
|
| 64 |
if use postgres ; then
|
| 65 |
myconf+=" --with-db-type=pgsql
|
| 66 |
--with-db-port=5432
|
| 67 |
--with-api-subtype=pgsql
|
| 68 |
--with-api-port=5432"
|
| 69 |
fi
|
| 70 |
|
| 71 |
econf ${myconf}
|
| 72 |
}
|
| 73 |
|
| 74 |
src_install() {
|
| 75 |
dodoc README
|
| 76 |
rm -f README
|
| 77 |
|
| 78 |
emake DESTDIR="${D}" install || die "make failed"
|
| 79 |
|
| 80 |
emake DESTDIR="${D}" install-javascript || die "make failed"
|
| 81 |
|
| 82 |
if use apache2 ; then
|
| 83 |
dodir ${APACHE_MODULES_CONFDIR}
|
| 84 |
emake DESTDIR="${D}" install-apache-config || die "make failed"
|
| 85 |
echo '<IfDefine ICINGA_WEB>' > "${D}/${APACHE_MODULES_CONFDIR}/99_icinga-web.conf"
|
| 86 |
cat "${D}/${APACHE_MODULES_CONFDIR}/icinga-web.conf" >> "${D}/${APACHE_MODULES_CONFDIR}/99_icinga-web.conf"
|
| 87 |
echo '</IfDefine>' >> "${D}/${APACHE_MODULES_CONFDIR}/99_icinga-web.conf"
|
| 88 |
fi
|
| 89 |
|
| 90 |
insinto /usr/share/icinga/icinga-web/contrib
|
| 91 |
doins -r etc/schema/* || die
|
| 92 |
|
| 93 |
if use apache2 ; then
|
| 94 |
sed -i 's/%%USER%%/apache/g' etc/scheduler/icingaCron
|
| 95 |
else
|
| 96 |
sed -i 's/%%USER%%/root/g' etc/scheduler/icingaCron
|
| 97 |
fi
|
| 98 |
sed -i 's/%%PATH%%/\/usr\/share\/icinga\/icinga-web/g' etc/scheduler/icingaCron
|
| 99 |
|
| 100 |
insinto /etc/cron.d/
|
| 101 |
doins etc/scheduler/icingaCron || die
|
| 102 |
|
| 103 |
if use apache2 ; then
|
| 104 |
diropts -o apache -g apache
|
| 105 |
else
|
| 106 |
diropts -o root -g root
|
| 107 |
fi
|
| 108 |
dodir /var/log/icinga-web
|
| 109 |
|
| 110 |
if use apache2 ; then
|
| 111 |
fowners apache:apache /usr/share/icinga/icinga-web/lib/icingaScheduler/res/storage.dat
|
| 112 |
else
|
| 113 |
fowners root:root /usr/share/icinga/icinga-web/lib/icingaScheduler/res/storage.dat
|
| 114 |
fi
|
| 115 |
|
| 116 |
if use pnp ; then
|
| 117 |
insinto /usr/share/icinga/icinga-web/app/modules/Cronks/data/xml/extensions/
|
| 118 |
doins contrib/PNP_Integration/templateExtensions/pnp-host-extension.xml
|
| 119 |
doins contrib/PNP_Integration/templateExtensions/pnp-service-extension.xml
|
| 120 |
fi
|
| 121 |
}
|
| 122 |
|
| 123 |
pkg_postinst() {
|
| 124 |
einfo
|
| 125 |
einfo "If this is a new install, you must create a new database for it, e.g. icinga_web."
|
| 126 |
einfo "You can find the database scripts in /usr/share/icinga/icinga-web/contrib/."
|
| 127 |
einfo
|
| 128 |
einfo "Additionally, you need to setup a database user."
|
| 129 |
einfo "The user must have default data privileges like SELECT, UPDATE, INSERT, DELETE."
|
| 130 |
einfo
|
| 131 |
einfo "Example for a MySQL database:"
|
| 132 |
einfo " echo \"CREATE DATABASE icinga_web;\" | mysql"
|
| 133 |
einfo " echo \"GRANT SELECT,UPDATE,INSERT,DELETE ON icinga_web.* TO 'icinga_web'@'localhost' IDENTIFIED BY 'xxxxxx';\" | mysql"
|
| 134 |
einfo " echo \"FLUSH PRIVILEGES;\" | mysql"
|
| 135 |
einfo
|
| 136 |
einfo " cat /usr/share/icinga/icinga-web/contrib/mysql.sql | mysql icinga_web"
|
| 137 |
einfo
|
| 138 |
|
| 139 |
ewarn
|
| 140 |
ewarn "If you're upgrading from a previous release, you must upgrade your database schema."
|
| 141 |
ewarn "You can find upgrade scripts in /usr/share/icinga/icinga-web/contrib/updates/."
|
| 142 |
ewarn
|
| 143 |
ewarn "IMPORTANT: If you are upgrading from an older version and there are other versions in between,"
|
| 144 |
ewarn " be advised that you need to apply those upgrade files with incremental steps!"
|
| 145 |
ewarn
|
| 146 |
ewarn "Example to upgrade a MySQL database:"
|
| 147 |
ewarn " cat /usr/share/icinga/icinga-web/contrib/updates/mysql_<oldversion>_to_<newversion>.sql | mysql icinga_web"
|
| 148 |
ewarn
|
| 149 |
ewarn "Don't forget to clear the config cache."
|
| 150 |
ewarn " /usr/share/icinga/icinga-web/bin/clearcache.sh"
|
| 151 |
ewarn
|
| 152 |
|
| 153 |
einfo
|
| 154 |
einfo "Please note that the magic_quotes_gpc setting must be disabled (in both apache and cli php.ini)."
|
| 155 |
einfo
|
| 156 |
|
| 157 |
if use apache2 ; then
|
| 158 |
einfo
|
| 159 |
einfo "apache config was installed into"
|
| 160 |
einfo "/etc/apache2/modules.d//99_icinga-web.conf"
|
| 161 |
einfo
|
| 162 |
einfo "The apache config value for \'ServerTokens\' must be set to at"
|
| 163 |
einfo "least \'Min\'."
|
| 164 |
einfo
|
| 165 |
else
|
| 166 |
einfo
|
| 167 |
einfo "If you are not using apache you may need to change some"
|
| 168 |
einfo "permissions, so that your web server can access files and logs"
|
| 169 |
einfo
|
| 170 |
fi
|
| 171 |
}
|