|
| 1 | +# Copyright 1999-2024 Gentoo Authors |
| 2 | +# Distributed under the terms of the GNU General Public License v2 |
| 3 | + |
| 4 | +EAPI=8 |
| 5 | + |
| 6 | +inherit depend.apache |
| 7 | + |
| 8 | +DESCRIPTION="Icinga Web 2 - Frontend for icinga2" |
| 9 | +HOMEPAGE="http://www.icinga.org/" |
| 10 | + |
| 11 | +if [[ ${PV} == *9999 ]];then |
| 12 | + inherit git-r3 |
| 13 | + EGIT_REPO_URI="https://github.com/Icinga/icingaweb2.git" |
| 14 | + EGIT_BRANCH="master" |
| 15 | +else |
| 16 | + SRC_URI="https://codeload.github.com/Icinga/${PN}/tar.gz/v${PV} -> ${P}.tar.gz" |
| 17 | + KEYWORDS="~amd64 ~x86" |
| 18 | +fi |
| 19 | + |
| 20 | +LICENSE="GPL-2" |
| 21 | +SLOT="0" |
| 22 | +IUSE="apache2 apache2-server fpm ldap mysql nginx pdf postgres" |
| 23 | +REQUIRED_USE="( ?? ( apache2-server nginx ) ) apache2? ( apache2-server )" |
| 24 | + |
| 25 | +IUSE="${IUSE} php_targets_php8-2 php_targets_php8-3" |
| 26 | +PHP_DEPEND=" |
| 27 | + php_targets_php8-2? ( |
| 28 | + dev-lang/php:8.2[apache2?,cli,curl,fileinfo,fpm?,gd,intl,ldap?,mysql?,nls,pdo,postgres?,sockets,ssl,xslt,xml] |
| 29 | + ) |
| 30 | + php_targets_php8-3? ( |
| 31 | + dev-lang/php:8.3[apache2?,cli,curl,fileinfo,fpm?,gd,intl,ldap?,mysql?,nls,pdo,postgres?,sockets,ssl,xslt,xml] |
| 32 | + ) |
| 33 | +" |
| 34 | +DEPEND=">=net-analyzer/icinga2-2.1.1 |
| 35 | + dev-php/pecl-imagick |
| 36 | + pdf? ( media-gfx/imagemagick[png] ) |
| 37 | + apache2-server? ( >=www-servers/apache-2.4.0 ) |
| 38 | + nginx? ( >=www-servers/nginx-1.7.0:* ) |
| 39 | + ${PHP_DEPEND} |
| 40 | + >=dev-libs/icinga-php-library-0.13.0 |
| 41 | + >=dev-libs/icinga-php-thirdparty-0.12.0 |
| 42 | + acct-group/icingacmd |
| 43 | + acct-group/icingaweb2" |
| 44 | +RDEPEND="${DEPEND} |
| 45 | + apache2? ( acct-user/apache[icingaweb2] ) |
| 46 | + nginx? ( acct-user/nginx[icingaweb2] ) |
| 47 | +" |
| 48 | + |
| 49 | +pkg_config() { |
| 50 | + if [[ -d /etc/icingaweb2 ]] ; then |
| 51 | + einfo "Updating existing installation ..." |
| 52 | + else |
| 53 | + einfo "Running first time setup ..." |
| 54 | + einfo "Creating configuration directory ..." |
| 55 | + /usr/share/"${PN}"/bin/icingacli setup config directory |
| 56 | + einfo "Creating authentication token for web setup ..." |
| 57 | + /usr/share/"${PN}"/bin/icingacli setup token create |
| 58 | + if use apache2 ; then |
| 59 | + einfo "The following might be useful for your Apache2 configuration:" |
| 60 | + /usr/share/"${PN}"/bin/icingacli setup config webserver apache --document-root /usr/share/"${PN}"/public |
| 61 | + fi |
| 62 | + if use nginx ; then |
| 63 | + einfo "The following might be useful for your NGinx configuration:" |
| 64 | + /usr/share/"${PN}"/bin/icingacli setup config webserver nginx --document-root /usr/share/"${PN}"/public |
| 65 | + fi |
| 66 | + fi |
| 67 | + einfo "All done." |
| 68 | +} |
| 69 | + |
| 70 | +src_install() { |
| 71 | + insinto /etc/logrotate.d/ |
| 72 | + newins "${FILESDIR}"/logrotate "${PN}" |
| 73 | + insinto "/usr/share/${PN}" |
| 74 | + doins -r "${S}"/* |
| 75 | + fperms -R a+rX "/usr/share/${PN}/public/" |
| 76 | + fperms u+x,g+x "/usr/share/${PN}/bin/icingacli" |
| 77 | + fowners root:icingaweb2 "/usr/share/${PN}/bin/icingacli" |
| 78 | + dosym "../share/${PN}/bin/icingacli" /usr/bin/icingacli |
| 79 | + dosym "../share/${PN}/bin/icingacli" /usr/sbin/icingacli |
| 80 | + dosym "../../usr/share/${PN}/etc/bash_completion.d/icingacli" /etc/bash_completion.d/icingacli |
| 81 | + keepdir /var/lib/"${PN}" |
| 82 | + keepdir /var/log/"${PN}" |
| 83 | + fowners nobody:icingaweb2 /var/{lib,log}/"${PN}" |
| 84 | + fperms g+w /var/{lib,log}/"${PN}" |
| 85 | +} |
| 86 | + |
| 87 | +pkg_postinst() { |
| 88 | + einfo "Run 'emerge --config =${CATEGORY}/${PF}' to finish setup." |
| 89 | +} |
0 commit comments