|
| 1 | +# Copyright 1999-2024 Gentoo Authors |
| 2 | +# Distributed under the terms of the GNU General Public License v2 |
| 3 | + |
| 4 | +EAPI=8 |
| 5 | + |
| 6 | +DESCRIPTION="multibackend monitoring webinterface for Nagios/Icinga and others" |
| 7 | +HOMEPAGE="https://www.thruk.org" |
| 8 | +SRC_URI="https://github.com/sni/${PN}/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz" |
| 9 | + |
| 10 | +S="${WORKDIR}/${P//T/t}" |
| 11 | + |
| 12 | +LICENSE="GPL-1" |
| 13 | +SLOT="0" |
| 14 | +KEYWORDS="~amd64" |
| 15 | + |
| 16 | +PATCHES=( |
| 17 | + "${FILESDIR}/01-threads.patch" |
| 18 | + "${FILESDIR}/3.0-themes-precompiled.patch" |
| 19 | +) |
| 20 | + |
| 21 | +DEPEND=" |
| 22 | + dev-perl/Cpanel-JSON-XS |
| 23 | + dev-perl/Date-Calc |
| 24 | + dev-perl/forks |
| 25 | + dev-perl/thruk_libs |
| 26 | + www-apache/mod_fcgid |
| 27 | + www-client/phantomjs-bin |
| 28 | + www-servers/apache |
| 29 | + " |
| 30 | +RDEPEND="${DEPEND}" |
| 31 | +BDEPEND=" |
| 32 | + dev-perl/Module-Install |
| 33 | + " |
| 34 | + |
| 35 | +src_configure() { |
| 36 | + econf \ |
| 37 | + --sysconfdir="${EPREFIX}"/etc/"${PN}" \ |
| 38 | + --datadir="${EPREFIX}"/usr/share/"${PN}" \ |
| 39 | + --localstatedir="${EPREFIX}"/var/lib/"${PN}" \ |
| 40 | + --with-initdir="${EPREFIX}"/usr/share/"${PN}"/etc/init.d/ \ |
| 41 | + --with-tempdir="${EPREFIX}"/usr/share/"${PN}"/tmp/ \ |
| 42 | + --with-logrotatedir="${EPREFIX}"/etc/logrotate.d \ |
| 43 | + --with-logdir="${EPREFIX}"/var/log/"${PN}" \ |
| 44 | + --with-thruk-user=apache \ |
| 45 | + --with-thruk-group=apache |
| 46 | +} |
| 47 | + |
| 48 | +src_install() { |
| 49 | + default |
| 50 | + |
| 51 | + mv "${D}/etc/Thruk/thruk_local.conf" "${D}/etc/Thruk/thruk_local.conf.example" |
| 52 | + |
| 53 | + insinto /etc/apache2/vhosts.d/ |
| 54 | + newins "${FILESDIR}/apache_thruk.conf.example" thruk.conf.example |
| 55 | + |
| 56 | + insinto /etc/logrotate.d/ |
| 57 | + newins "${FILESDIR}/thruk-base.lograte" thruk-base |
| 58 | + |
| 59 | + keepdir /var/log/"${PN}" |
| 60 | + fowners apache:apache /var/log/Thruk/ |
| 61 | + keepdir /usr/share/"${PN}"/var/ |
| 62 | + |
| 63 | + exeinto /usr/share/"${PN}"/bin/ |
| 64 | + doexe script/*.pl |
| 65 | + doexe script/*.sh |
| 66 | + doexe script/[cdegnrt]* |
| 67 | + |
| 68 | + keepdir /usr/share/Thruk/tmp |
| 69 | + fowners apache:apache /usr/share/Thruk/tmp |
| 70 | + |
| 71 | + keepdir /etc/Thruk/panorama/ |
| 72 | + fowners apache:apache /etc/Thruk/panorama/ |
| 73 | + keepdir /var/lib/Thruk/ |
| 74 | + fowners apache:apache /var/lib/Thruk/ |
| 75 | + keepdir /var/lib/Thruk/sessions/ |
| 76 | + fowners apache:apache /var/lib/Thruk/sessions/ |
| 77 | + keepdir /var/lib/Thruk/users/ |
| 78 | + fowners apache:apache /var/lib/Thruk/users/ |
| 79 | +} |
| 80 | + |
| 81 | +pkg_preinst(){ |
| 82 | + if [ "$(grep -L '^APACHE2_OPTS=.*-DFCGID' "${EROOT}/etc/conf.d/apache2"|wc -l)" -gt 0 ]; then |
| 83 | + # Probably the first time we are installed |
| 84 | + # set some more sane default settings in /etc/conf.d/apache2 |
| 85 | + |
| 86 | + mkdir -p "${D}/etc/conf.d/" |
| 87 | + sed -E ' |
| 88 | + s#^(APACHE2_OPTS\s*=\s*")([^"]+)(")#\1\2 -D FCGID\3# |
| 89 | + ' < "${EROOT}/etc/conf.d/apache2" > "${D}/etc/conf.d/apache2" |
| 90 | + fi |
| 91 | + |
| 92 | + if [ ! -r "${EROOT}/etc/Thruk/thruk_local.conf" ]; then |
| 93 | + # Probably the first time we are installed |
| 94 | + cp "${D}/etc/Thruk/thruk_local.conf.example" "${D}/etc/Thruk/thruk_local.conf" |
| 95 | + fi |
| 96 | +} |
0 commit comments