1 |
1 |
# Copyright 1999-2023 Gentoo Authors
|
2 |
2 |
# Distributed under the terms of the GNU General Public License v2
|
3 |
3 |
|
|
4 |
# To create the go modules tarball:
|
|
5 |
# cd src/go
|
|
6 |
# GOMODCACHE="${PWD}"/go-mod go mod download -modcacherw
|
|
7 |
# tar -acf zabbix-${PV}-go-deps.tar.xz go-mod
|
|
8 |
|
4 |
9 |
EAPI=8
|
5 |
10 |
|
|
11 |
GO_OPTIONAL="yes"
|
6 |
12 |
# needed to make webapp-config dep optional
|
7 |
13 |
WEBAPP_OPTIONAL="yes"
|
8 |
|
inherit webapp java-pkg-opt-2 systemd toolchain-funcs tmpfiles user-info
|
|
14 |
inherit webapp java-pkg-opt-2 systemd tmpfiles toolchain-funcs go-module user-info
|
9 |
15 |
|
10 |
16 |
DESCRIPTION="ZABBIX is software for monitoring of your applications, network and servers"
|
11 |
17 |
HOMEPAGE="https://www.zabbix.com/"
|
12 |
18 |
MY_P=${P/_/}
|
13 |
19 |
MY_PV=${PV/_/}
|
14 |
|
SRC_URI="https://cdn.zabbix.com/${PN}/sources/stable/$(ver_cut 1-2)/${P}.tar.gz"
|
|
20 |
SRC_URI="https://cdn.zabbix.com/${PN}/sources/stable/$(ver_cut 1-2)/${P}.tar.gz
|
|
21 |
agent2? ( https://dev.gentoo.org/~fordfrog/distfiles/${P}-go-deps.tar.xz )
|
|
22 |
"
|
|
23 |
|
15 |
24 |
LICENSE="GPL-2"
|
16 |
25 |
SLOT="0/$(ver_cut 1-2)"
|
17 |
26 |
WEBAPP_MANUAL_SLOT="yes"
|
18 |
|
KEYWORDS="~amd64 ~x86"
|
19 |
|
IUSE="+agent curl frontend gnutls ipv6 java ldap libxml2 mbedtls mysql odbc openipmi +openssl oracle +postgres proxy selinux server snmp sqlite ssh static xmpp"
|
20 |
|
REQUIRED_USE="|| ( agent frontend proxy server )
|
21 |
|
?? ( gnutls mbedtls openssl )
|
|
27 |
KEYWORDS="amd64 x86"
|
|
28 |
IUSE="+agent +agent2 curl frontend gnutls ipv6 java ldap libxml2 mysql odbc openipmi +openssl oracle +postgres proxy selinux server snmp sqlite ssh static"
|
|
29 |
REQUIRED_USE="|| ( agent agent2 frontend proxy server )
|
|
30 |
?? ( gnutls openssl )
|
|
31 |
agent2? ( !gnutls )
|
22 |
32 |
proxy? ( ^^ ( mysql oracle postgres sqlite ) )
|
23 |
33 |
server? ( ^^ ( mysql oracle postgres ) !sqlite )
|
24 |
34 |
static? ( !oracle !snmp )"
|
... | ... | |
33 |
43 |
net-nds/openldap:=
|
34 |
44 |
)
|
35 |
45 |
libxml2? ( dev-libs/libxml2 )
|
36 |
|
mbedtls? ( net-libs/mbedtls:0= )
|
37 |
46 |
mysql? ( dev-db/mysql-connector-c:= )
|
38 |
47 |
odbc? ( dev-db/unixODBC )
|
39 |
48 |
openipmi? ( sys-libs/openipmi )
|
... | ... | |
51 |
60 |
snmp? ( net-analyzer/net-snmp:= )
|
52 |
61 |
sqlite? ( dev-db/sqlite )
|
53 |
62 |
ssh? ( net-libs/libssh2 )
|
54 |
|
xmpp? ( dev-libs/iksemel )
|
55 |
63 |
"
|
56 |
64 |
|
57 |
65 |
RDEPEND="${COMMON_DEPEND}
|
... | ... | |
99 |
107 |
"
|
100 |
108 |
BDEPEND="
|
101 |
109 |
virtual/pkgconfig
|
|
110 |
agent2? (
|
|
111 |
>=dev-lang/go-1.12
|
|
112 |
app-arch/unzip
|
|
113 |
)
|
102 |
114 |
"
|
103 |
115 |
|
|
116 |
# upstream tests fail for agent2
|
|
117 |
RESTRICT="test"
|
|
118 |
|
104 |
119 |
PATCHES=(
|
105 |
120 |
"${FILESDIR}/${PN}-4.0.18-modulepathfix.patch"
|
106 |
121 |
"${FILESDIR}/${PN}-3.0.30-security-disable-PidFile.patch"
|
|
122 |
"${FILESDIR}/${PN}-5.0.22-system.sw.packages.patch"
|
107 |
123 |
)
|
108 |
124 |
|
109 |
125 |
S=${WORKDIR}/${MY_P}
|
... | ... | |
136 |
152 |
src_configure() {
|
137 |
153 |
econf \
|
138 |
154 |
$(use_enable agent) \
|
|
155 |
$(use_enable agent2) \
|
139 |
156 |
$(use_enable ipv6) \
|
140 |
157 |
$(use_enable java) \
|
141 |
158 |
$(use_enable proxy) \
|
... | ... | |
145 |
162 |
$(use_with gnutls) \
|
146 |
163 |
$(use_with ldap) \
|
147 |
164 |
$(use_with libxml2) \
|
148 |
|
$(use_with mbedtls) \
|
149 |
165 |
$(use_with mysql) \
|
150 |
166 |
$(use_with odbc unixodbc) \
|
151 |
167 |
$(use_with openipmi openipmi) \
|
... | ... | |
154 |
170 |
$(use_with postgres postgresql) \
|
155 |
171 |
$(use_with snmp net-snmp) \
|
156 |
172 |
$(use_with sqlite sqlite3) \
|
157 |
|
$(use_with ssh ssh2) \
|
158 |
|
$(use_with xmpp jabber)
|
|
173 |
$(use_with ssh ssh2)
|
159 |
174 |
}
|
160 |
175 |
|
161 |
176 |
src_compile() {
|
... | ... | |
231 |
246 |
newtmpfiles "${FILESDIR}"/zabbix-agentd.tmpfiles zabbix-agentd.conf
|
232 |
247 |
fi
|
233 |
248 |
|
|
249 |
if use agent2; then
|
|
250 |
insinto /etc/zabbix
|
|
251 |
doins "${S}"/src/go/conf/zabbix_agent2.conf
|
|
252 |
fperms 0640 /etc/zabbix/zabbix_agent2.conf
|
|
253 |
fowners root:zabbix /etc/zabbix/zabbix_agent2.conf
|
|
254 |
|
|
255 |
newinitd "${FILESDIR}"/zabbix-agent2.init zabbix-agent2
|
|
256 |
|
|
257 |
dosbin src/go/bin/zabbix_agent2
|
|
258 |
|
|
259 |
systemd_dounit "${FILESDIR}"/zabbix-agent2.service
|
|
260 |
newtmpfiles "${FILESDIR}"/zabbix-agent2.tmpfiles zabbix-agent2.conf
|
|
261 |
fi
|
|
262 |
|
234 |
263 |
fowners root:zabbix /etc/zabbix
|
235 |
264 |
fowners zabbix:zabbix \
|
236 |
265 |
/var/lib/zabbix \
|
... | ... | |
257 |
286 |
|
258 |
287 |
if use frontend; then
|
259 |
288 |
webapp_src_preinst
|
260 |
|
cp -R frontends/php/* "${D}/${MY_HTDOCSDIR}"
|
|
289 |
cp -R ui/* "${D}/${MY_HTDOCSDIR}"
|
261 |
290 |
webapp_configfile \
|
262 |
291 |
"${MY_HTDOCSDIR}"/include/db.inc.php \
|
263 |
292 |
"${MY_HTDOCSDIR}"/include/config.inc.php
|
... | ... | |
301 |
330 |
ewarn "custom alert scripts."
|
302 |
331 |
ewarn
|
303 |
332 |
ewarn "A real homedir might be needed for configfiles"
|
304 |
|
ewarn "for custom alert scripts (e.g. ~/.sendxmpprc when"
|
305 |
|
ewarn "using sendxmpp for Jabber alerts)."
|
|
333 |
ewarn "for custom alert scripts."
|
306 |
334 |
ewarn
|
307 |
335 |
ewarn "To change the homedir use:"
|
308 |
336 |
ewarn " usermod -d /var/lib/zabbix/home zabbix"
|
... | ... | |
331 |
359 |
tmpfiles_process zabbix-agentd.conf
|
332 |
360 |
fi
|
333 |
361 |
|
|
362 |
if use agent2; then
|
|
363 |
tmpfiles_process zabbix-agent2.conf
|
|
364 |
fi
|
|
365 |
|
334 |
366 |
elog "--"
|
335 |
367 |
elog
|
336 |
368 |
elog "You may need to add these lines to /etc/services:"
|