archrelease: copy trunk to extra-x86_64
[arch-packages.git] / zabbix / trunk / PKGBUILD
blobf3713ae18c284640e999bee2a934c46c3bce46c8
1 # Maintainer: BartÅ‚omiej Piotrowski <bpiotrowski@archlinux.org>
2 # Maintainer: Florian Pritz <bluewind@xinu.at>
4 pkgbase=zabbix
5 pkgname=(zabbix-server zabbix-agent{,2} zabbix-proxy zabbix-frontend-php)
6 pkgver=5.4.7
7 pkgrel=2
8 arch=(x86_64)
9 url='https://www.zabbix.com/'
10 license=(GPL)
11 makedepends=(postgresql-libs libxml2 unixodbc net-snmp mariadb-libs libldap libevent go pkgconfig)
12 source=("https://cdn.zabbix.com/zabbix/sources/stable/${pkgver%.*}/zabbix-${pkgver}.tar.gz"
13         zabbix-agent.{service,sysusers,tmpfiles}
14         zabbix-agent2.service
15         zabbix-server{-mysql,-pgsql}.service zabbix-server.{sysusers,tmpfiles}
16         zabbix-proxy{-sqlite,-mysql,-pgsql}.service zabbix-proxy.{sysusers,tmpfiles})
18 sha512sums=('f87fd158d74c289765ddc3394bfa1c009d72d2756596c2060d567b5e44123594f00307f4df28a67b38c0e59a9d26f7d064afe73e7a3a0bd4e9bc02529334b1d1'
19             '8c1fa2676bc0ef91bc39ec5f97b4d3ba5c365d063420455a3785121a54e120bc5afeacde42a48f4509c115f940dcc3b6c2f43044a7fbfb421182fc93b22a2444'
20             '3ab3ac1acc7e35c8896157aef601ebc30815237ac5252cbd0c1ecb26eeaf9eccf5c49938ae8c85bb79a6f95f607f082f6b80ed660829599ec03aa626cca6d3dc'
21             'ca6b4779de23829dfdd80ee21e924fbe4e2754f4e693bed4b1a2aa846cd87d150e399b1169d7fe58d30c50ed837c1b8254e580de420267d0a1834d6dc409c43d'
22             'c57dfcc13b290f4120d1185339bd2d6b1ea7a2ca0c98dca8632d4fd8fe462a42cb35e8a88895eb8ee390c55cf0ffb90b544f23fefbf059b49c06e5373d0b8af2'
23             'b35155a5d151eb7258bca62d53e7099a05605e58adac9d1510e12c2219abc22f931e92ea5d36bf86900e30982e893e429235d983a7823610d76c15082c373d1f'
24             'ac968d9954e5d9523eb7a9b8dcbcef40d4b47c1db3b2ff86d5fbc3f1871fcd03aff14f5b0cfeeeb494fdeb2d95e2e32b8622297c714a90d22c68ab3b3b914475'
25             '4254d3b13ff0d19a8e207f709c10ea59dbb6d4f333d862b1611a0fa4ced199e9a32313e88d8abadc129c1e4001b182c0545bcc84117d218116a8c524de88850e'
26             'b6d548a26f845ef1a39724e3273aa521715272e20a0038144f86d377a26dfec6e3e129404cfda77632cad2f5cd6bab4a33f70a26c8c67b0d0b2abb3678ad2d83'
27             '7b5829caa77c6b5da8c2195ab840f0020f722a94f01a437324afdbe2a4372a594dcca6d63d2fdda5cfad81353ab4e4e0b2c6b67436203266dd44740a5e03b58e'
28             '94701f34fe5df4859c6a4d0459c16062374e8f89f4f51c414e71c9c2db14f61e087721e68dddb3e8d88bf1c097477c1a21e27ba4705fd07d88c60adb41acc1be'
29             'ce026b748df9b7597452a69c6cb04244a95bf99b00ea795d96d7d4ca5a68190af1b2dbf141dfd8e63bb4405131de81d8aa8a831ddde2595f1b859026b9fb0faa'
30             '7c1072a8cd5837095f857b50124cb45d1bdbddbce108f6f067a35c3c9ebb1ad0502ef617dfa10f9c843631220177a6286a97b1c2a46539200be72fa83cb23b99'
31             '64042ddf511b56b2a5a311e34643f4e049c09d909ea65b7343a8a9637f33dc59f2b1342201290ca0774cbcbf616096b3696982047fb622b7d51afb5eceb298dd')
33 prepare() {
34   cd $pkgbase-$pkgver
35   sed -i \
36     -e '/^LogFile=.*/d' \
37     -e 's/# LogType=file/LogType=system/' \
38     conf/zabbix_{agentd,proxy,server}.conf
40   autoreconf -fi
43 build() {
44   export GOPATH="$srcdir"/go
45   export AGENT_LDFLAGS="${LDFLAGS}"
47   _configure_flags=(
48     --disable-static
49     --prefix=/usr
50     --infodir=/usr/share/info
51     --mandir=/usr/share/man
52     --sysconfdir=/etc/zabbix
53     --enable-agent
54     --enable-agent2
55     --enable-ipv6
56     --with-ldap
57     --with-libcurl
58     --with-libxml2
59     --with-net-snmp
60     --with-openssl
61     --with-ssh2
62     --with-unixodbc
63   )
65   cd $pkgbase-$pkgver
67   for db in postgresql mysql; do
68     ./configure ${_configure_flags[@]} --enable-server --with-$db
69     make clean
70     make
71     mv src/zabbix_server/zabbix_server{,_$db}
72   done
74   for db in postgresql mysql sqlite3; do
75     ./configure ${_configure_flags[@]} --enable-proxy --with-$db
76     make clean
77     make
78     mv src/zabbix_proxy/zabbix_proxy{,_$db}
79   done
82 package_zabbix-server() {
83   pkgdesc='Monitoring software for networks and applications'
84   depends=(net-snmp curl libxml2 unixodbc libldap libevent pcre)
85   optdepends=('postgresql-libs: for PostgreSQL support'
86               'mariadb-libs: for MariaDB support')
87   backup=(etc/zabbix/zabbix_server.conf)
88   install=zabbix-server.install
90   cd $pkgbase-$pkgver
92   for db in postgresql mysql; do
93     install -Dm755 src/zabbix_server/zabbix_server_$db \
94       "$pkgdir/usr/bin/zabbix_server_$db"
96     install -d "$pkgdir/usr/share/$pkgname/$db"
97     install -m644 database/$db/*.sql -t "$pkgdir/usr/share/$pkgname/$db"
98   done
99   install -Dm755 src/zabbix_get/zabbix_get "$pkgdir/usr/bin/zabbix_get"
101   install -Dm644 man/zabbix_server.man "$pkgdir/usr/share/man/man8/zabbix_server.8"
102   install -Dm644 man/zabbix_get.man "$pkgdir/usr/share/man/man1/zabbix_get.1"
104   install -Dm644 conf/zabbix_server.conf "$pkgdir/etc/zabbix/zabbix_server.conf"
105   chown 170:170 "$pkgdir/etc/zabbix/zabbix_server.conf"
107   install -Dm644 "$srcdir/zabbix-server-pgsql.service" \
108     "$pkgdir/usr/lib/systemd/system/zabbix-server-pgsql.service"
109   install -Dm644 "$srcdir/zabbix-server-mysql.service" \
110     "$pkgdir/usr/lib/systemd/system/zabbix-server-mysql.service"
112   install -Dm644 "$srcdir/zabbix-server.sysusers" \
113         "$pkgdir/usr/lib/sysusers.d/zabbix-server.conf"
114   install -Dm644 "$srcdir/zabbix-server.tmpfiles" \
115         "$pkgdir/usr/lib/tmpfiles.d/zabbix-server.conf"
118 package_zabbix-agent() {
119   pkgdesc='Monitoring agent for Zabbix'
120   depends=(curl pcre)
121   backup=(etc/zabbix/zabbix_agentd.conf)
123   cd $pkgbase-$pkgver
124   install -Dm755 src/zabbix_agent/zabbix_agentd "$pkgdir/usr/bin/zabbix_agentd"
125   install -Dm755 src/zabbix_sender/zabbix_sender "$pkgdir/usr/bin/zabbix_sender"
127   install -Dm644 conf/zabbix_agentd.conf "$pkgdir/etc/zabbix/zabbix_agentd.conf"
128   chown 172:172 "$pkgdir/etc/zabbix/zabbix_agentd.conf"
130   install -Dm644 conf/zabbix_agentd/userparameter_examples.conf \
131         "$pkgdir/usr/share/zabbix-agent/userparameter_examples.conf"
132   install -Dm644 conf/zabbix_agentd/userparameter_mysql.conf \
133         "$pkgdir/usr/share/zabbix-agent/userparameter_mysql.conf"
135   install -Dm644 man/zabbix_agentd.man \
136         "$pkgdir/usr/share/man/man8/zabbix_agentd.8"
137   install -Dm644 man/zabbix_sender.man \
138         "$pkgdir/usr/share/man/man1/zabbix_sender.1"
140   install -Dm644 "$srcdir/zabbix-agent.service" \
141         "$pkgdir/usr/lib/systemd/system/zabbix-agent.service"
142   install -Dm644 "$srcdir/zabbix-agent.sysusers" \
143         "$pkgdir/usr/lib/sysusers.d/zabbix-agent.conf"
144   install -Dm644 "$srcdir/zabbix-agent.tmpfiles" \
145         "$pkgdir/usr/lib/tmpfiles.d/zabbix-agent.conf"
148 package_zabbix-agent2() {
149   pkgdesc='Experimental monitoring agent for Zabbix (Agent 2)'
150   depends=(zabbix-agent)
151   backup=(etc/zabbix/zabbix_agent2.conf)
153   cd $pkgbase-$pkgver
154   install -Dm755 src/go/bin/zabbix_agent2 "$pkgdir/usr/bin/zabbix_agent2"
155   install -Dm644 src/go/conf/zabbix_agent2.conf "$pkgdir/etc/zabbix/zabbix_agent2.conf"
156   chown 172:172 "$pkgdir/etc/zabbix/zabbix_agent2.conf"
158   install -Dm644 man/zabbix_agent2.man \
159         "$pkgdir/usr/share/man/man8/zabbix_agent2.8"
161   install -Dm644 "$srcdir/zabbix-agent2.service" \
162         "$pkgdir/usr/lib/systemd/system/zabbix-agent2.service"
165 package_zabbix-proxy() {
166   pkgdesc='Data collecting proxy for Zabbix'
167   depends=(net-snmp curl libxml2 sqlite unixodbc libldap pcre libevent)
168   optdepends=('mariadb-libs: for MariaDB support'
169               'postgresql-libs: for PostgreSQL support')
170   backup=(etc/zabbix/zabbix_proxy.conf)
172   cd $pkgbase-$pkgver
173   for db in postgresql mysql sqlite3; do
174     install -Dm755 src/zabbix_proxy/zabbix_proxy_$db \
175       "$pkgdir/usr/bin/zabbix_proxy_$db"
177     install -d "$pkgdir/usr/share/$pkgname/$db"
178     install -m644 database/$db/schema.sql -t "$pkgdir/usr/share/$pkgname/$db"
179   done
180   install -Dm644 conf/zabbix_proxy.conf "$pkgdir/etc/zabbix/zabbix_proxy.conf"
181   chown 171:171 "$pkgdir/etc/zabbix/zabbix_proxy.conf"
183   install -Dm644 "$srcdir/zabbix-proxy-sqlite.service" \
184     "$pkgdir/usr/lib/systemd/system/zabbix-proxy-sqlite.service"
185   install -Dm644 "$srcdir/zabbix-proxy-pgsql.service" \
186     "$pkgdir/usr/lib/systemd/system/zabbix-proxy-pgsql.service"
187   install -Dm644 "$srcdir/zabbix-proxy-mysql.service" \
188     "$pkgdir/usr/lib/systemd/system/zabbix-proxy-mysql.service"
190   install -Dm644 "$srcdir/zabbix-proxy.sysusers" \
191         "$pkgdir/usr/lib/sysusers.d/zabbix-proxy.conf"
192   install -Dm644 "$srcdir/zabbix-proxy.tmpfiles" \
193         "$pkgdir/usr/lib/tmpfiles.d/zabbix-proxy.conf"
196 package_zabbix-frontend-php() {
197   pkgdesc='PHP frontend for Zabbix'
198   depends=(zabbix-server php7 php7-gd)
200   cd $pkgbase-$pkgver
201   install -d "$pkgdir/usr/share/webapps/zabbix"
202   cp -a ui/* "$pkgdir/usr/share/webapps/zabbix"
203   chown 33:33 ${pkgdir}/usr/share/webapps/zabbix/conf/ # write access for http user