# Copyright 2012 Kevin Decherf # Distributed under the terms of the GNU General Public License v2 require systemd-service SUMMARY="Enterprise-class Monitoring Tool" HOMEPAGE="http://www.zabbix.com" DOWNLOADS="mirror://sourceforge/${PN}/${PNV}.tar.gz" LICENCES="GPL-2" SLOT="0" PLATFORMS="~amd64" MYOPTIONS=" ipv6 java [[ description = [ Install the Java Gateway for JMX monitoring ] ]] snmp ( providers: libressl openssl ) [[ number-selected = exactly-one ]] " DEPENDENCIES=" build+run: dev-db/postgresql-client dev-libs/libevent:= net-misc/curl providers:libressl? ( dev-libs/libressl:= ) providers:openssl? ( dev-libs/openssl:= ) group/zabbix user/zabbix java? ( virtual/jre ) snmp? ( net/net-snmp ) run: net-misc/fping dev-lang/php:*[<8][php_extensions:pgsql] [[ description = [ PHP Frontend ] ]] suggestion: net-analyzer/zabbix-agent net-analyzer/zabbix-frontend dev-db/postgresql " DEFAULT_SRC_CONFIGURE_OPTION_ENABLES=( 'ipv6' 'java' ) DEFAULT_SRC_CONFIGURE_OPTION_WITHS=( 'snmp net-snmp' ) DEFAULT_SRC_CONFIGURE_PARAMS=( '--disable-agent' '--enable-server' "--sysconfdir=/etc/${PN}" '--without-gnutls' '--without-mbedtls' '--with-openssl' '--with-postgresql' '--with-libcurl' ) DEFAULT_SRC_COMPILE_PARAMS=( AR=${AR} RANLIB=${RANLIB} ) DEFAULT_SRC_INSTALL_PARAMS=( AR=${AR} RANLIB=${RANLIB} ) src_install() { default local db_target=/usr/share/${PN}/database install_systemd_files insinto /usr/$(exhost --target)/lib/tmpfiles.d doins "${FILES}"/tmpfiles.d/zabbix.conf if optionq java; then newins "${FILES}"/tmpfiles.d/opt_java_zabbix-java-gateway.conf zabbix-java-gateway.conf fi KEEPDIRS=( /etc/${PN}/zabbix_server.conf.d /usr/share/${PN}/externalscripts /usr/share/${PN}/alertscripts /usr/share/${PN}/zabbix_java ) keepdir ${KEEPDIRS[@]} # This line is mandatory for systemd and can be useful for other init systems sed -i -e 's@^\(# PidFile.*\)@\1\nPidFile=/run/zabbix/zabbix-server.pid@' "${IMAGE}"/etc/${PN}/zabbix_server.conf elog "The database is not configured, schemes are available in /usr/share/${PN}/database" dodir "${db_target}" insinto "${db_target}" doins -r "${WORK}"/database/postgresql if optionq java; then insinto "/usr/share/${PN}/zabbix_java" doins -r "${IMAGE}"/usr/$(exhost --target)/bin/zabbix_java/{bin,lib} exeinto "/usr/share/${PN}/zabbix_java/" for exe in startup.sh shutdown.sh settings.sh; do doexe "${IMAGE}/usr/$(exhost --target)/bin/zabbix_java/${exe}" done edo mv "${IMAGE}/usr/share/${PN}/zabbix_java/bin/zabbix-java-gateway-${PV}.jar" "${IMAGE}/usr/share/${PN}/zabbix_java/bin/zabbix-java-gateway.jar" edo sed 's/PID_FILE/#PID_FILE/' -i "${IMAGE}/usr/share/${PN}/zabbix_java/settings.sh" fi # Makefile clean after copy edo find "${IMAGE}"/usr/share/${PN} -type f -name "Makefile*" -delete # Remove empty dirs edo find "${IMAGE}" -type d -empty -delete }