summaryrefslogtreecommitdiff
blob: ee11639fe8d0687b932d57ffe7eec06c1f8e7ae3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI="2"

inherit depend.apache eutils

DESCRIPTION="Icinga Web - new Web Interface"
HOMEPAGE="http://www.icinga.org/"
SRC_URI="mirror://sourceforge/icinga/${P}.tar.gz"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64"
IUSE="pnp"
DEPEND="dev-php/phing
        dev-lang/php[postgres,pdo,json,xsl]
        net-analyzer/icinga[apache2,idoutils,mysql]"
RDEPEND="${DEPEND}"

need_apache2

pkg_setup() {
	depend.apache_pkg_setup
}

src_configure() {
	local myconf

	myconf="--prefix=/usr/share/icinga/icinga-web
	--bindir=/usr/sbin
	--sbindir=/usr/$(get_libdir)/icinga/cgi-bin
	--datarootdir=/usr/share/icinga/htdocs
	--localstatedir=/var/lib/icinga
	--sysconfdir=/etc/icinga
	--libexecdir=/usr/$(get_libdir)/icinga/plugins
	--with-bin-user=icinga
	--with-bin-group=icinga
	--with-api-cmd-file=/var/lib/icinga/rw/icinga.cmd
	--with-conf-dir=/etc/icinga-web
	--with-web-apache-path=${APACHE_MODULES_CONFDIR}
	--with-log-dir=/var/log/icinga-web"

	econf ${myconf}
}

src_install() {
	emake -j1 DESTDIR="${D}" install || die "make failed"

	emake -j1 DESTDIR="${D}" install-javascript || die "make failed"

	dodir ${APACHE_MODULES_CONFDIR}
	emake -j1 DESTDIR="${D}" install-apache-config || die "make failed"
	mv ${D}/${APACHE_MODULES_CONFDIR}/icinga-web.conf ${D}/${APACHE_MODULES_CONFDIR}/99_icinga-web.conf

	insinto /usr/share/icinga/icinga-web/contrib
	doins -r etc/schema/* || die

	sed -i 's/%%USER%%/apache/g'  etc/scheduler/icingaCron
	sed -i 's/%%PATH%%/\/usr\/share\/icinga\/icinga-web/g' etc/scheduler/icingaCron

	insinto /etc/cron.d/
	doins etc/scheduler/icingaCron || die

	diropts -o apache -g apache
	dodir /var/log/icinga-web

	fowners apache:apache /usr/share/icinga/icinga-web/lib/icingaScheduler/res/storage.dat

	if use pnp ; then
		sed -i 's/booleanConditionField/booleanConfitionField/g' contrib/PNP_Integration/templateExtensions/pnp-host-extension.xml
		insinto /usr/share/icinga/icinga-web/app/modules/Cronks/data/xml/extensions/
		doins contrib/PNP_Integration/templateExtensions/pnp-host-extension.xml
		doins contrib/PNP_Integration/templateExtensions/pnp-service-extension.xml
	fi
}

pkg_postinst() {
	elog "do not forget to import the Database!"
	elog
}