132 lines
2.6 KiB
Bash
132 lines
2.6 KiB
Bash
# Copyright 1999-2020 Gentoo Authors
|
|
# Distributed under the terms of the GNU General Public License v2
|
|
|
|
EAPI=7
|
|
|
|
# needed to make webapp-config dep optional
|
|
WEBAPP_OPTIONAL="yes"
|
|
inherit flag-o-matic user toolchain-funcs
|
|
|
|
DESCRIPTION="ZABBIX is software for monitoring of your applications, network and servers"
|
|
HOMEPAGE="https://www.zabbix.com/"
|
|
MY_P=${P/_/}
|
|
MY_PV=${PV/_/}
|
|
SRC_URI="http://mirror.imax.name/src/zabbix/${PV}/${P}.tar.gz"
|
|
LICENSE="GPL-2"
|
|
SLOT="0"
|
|
WEBAPP_MANUAL_SLOT="yes"
|
|
KEYWORDS="amd64 x86"
|
|
IUSE="+agent java curl ipv6 libxml2 ssh ssl snmp static"
|
|
REQUIRED_USE="|| ( agent )
|
|
static? ( !snmp )"
|
|
|
|
COMMON_DEPEND="
|
|
curl? ( net-misc/curl )
|
|
libxml2? ( dev-libs/libxml2 )
|
|
snmp? ( net-analyzer/net-snmp )
|
|
ssh? ( net-libs/libssh2 )
|
|
ssl? ( dev-libs/openssl:=[-bindist] )
|
|
"
|
|
|
|
DEPEND="${COMMON_DEPEND}
|
|
static? (
|
|
curl? ( net-misc/curl[static-libs] )
|
|
libxml2? ( dev-libs/libxml2[static-libs] )
|
|
ssh? ( net-libs/libssh2 )
|
|
)
|
|
"
|
|
BDEPEND="
|
|
virtual/pkgconfig
|
|
"
|
|
|
|
PATCHES=(
|
|
"${FILESDIR}/${PN}-4.0.18-modulepathfix.patch"
|
|
"${FILESDIR}/${PN}-3.0.30-security-disable-PidFile.patch"
|
|
)
|
|
|
|
S=${WORKDIR}/${MY_P}
|
|
|
|
|
|
pkg_setup() {
|
|
|
|
enewgroup zabbix
|
|
enewuser zabbix -1 -1 /var/lib/zabbix/home zabbix
|
|
|
|
}
|
|
|
|
src_prepare() {
|
|
default
|
|
}
|
|
|
|
src_configure() {
|
|
econf \
|
|
$(use_enable agent) \
|
|
$(use_enable ipv6) \
|
|
$(use_enable static) \
|
|
$(use_with curl libcurl) \
|
|
$(use_with libxml2) \
|
|
$(use_with snmp net-snmp) \
|
|
$(use_with ssh ssh2) \
|
|
$(use_with ssl openssl)
|
|
}
|
|
|
|
src_compile() {
|
|
if [ -f Makefile ] || [ -f GNUmakefile ] || [ -f makefile ]; then
|
|
emake AR="$(tc-getAR)" RANLIB="$(tc-getRANLIB)"
|
|
fi
|
|
}
|
|
|
|
src_install() {
|
|
local dirs=(
|
|
/etc/zabbix
|
|
/var/log/zabbix
|
|
)
|
|
|
|
for dir in "${dirs[@]}"; do
|
|
dodir "${dir}"
|
|
keepdir "${dir}"
|
|
done
|
|
|
|
if use agent; then
|
|
insinto /etc/zabbix
|
|
doins "${S}"/conf/zabbix_agentd.conf
|
|
fperms 0640 /etc/zabbix/zabbix_agentd.conf
|
|
fowners root:zabbix /etc/zabbix/zabbix_agentd.conf
|
|
|
|
newinitd "${FILESDIR}"/zabbix-agentd.init zabbix-agentd
|
|
|
|
dosbin src/zabbix_agent/zabbix_agentd
|
|
dobin \
|
|
src/zabbix_sender/zabbix_sender \
|
|
src/zabbix_get/zabbix_get
|
|
|
|
fi
|
|
|
|
fowners root:zabbix /etc/zabbix
|
|
fowners zabbix:zabbix \
|
|
/var/log/zabbix
|
|
fperms 0750 \
|
|
/etc/zabbix \
|
|
/var/log/zabbix
|
|
|
|
dodoc README INSTALL NEWS ChangeLog \
|
|
conf/zabbix_agentd.conf \
|
|
conf/zabbix_agentd/userparameter_examples.conf \
|
|
conf/zabbix_agentd/userparameter_mysql.conf \
|
|
|
|
}
|
|
|
|
pkg_postinst() {
|
|
|
|
elog "--"
|
|
elog
|
|
elog "You may need to add these lines to /etc/services:"
|
|
elog
|
|
elog "zabbix-agent 10050/tcp Zabbix Agent"
|
|
elog "zabbix-agent 10050/udp Zabbix Agent"
|
|
elog "zabbix-trapper 10051/tcp Zabbix Trapper"
|
|
elog "zabbix-trapper 10051/udp Zabbix Trapper"
|
|
elog
|
|
|
|
}
|