archrelease: copy trunk to extra-x86_64
[arch-packages.git] / zabbix / trunk / PKGBUILD
blob10fd9758a5ab5974186b12801723a2c9199d7d04
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=6.2.6
7 pkgrel=1
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=('03f2396fea0794f0a66a00880e7a46d0295a562fab2cfdd0890b2f9369bb1bfe6ee19398ab062bcdcdd9ef1415a6fa599a1f5e8135fb54ef6855e9f435619097'
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   # Make copies since `make clean` removes the files and they cannot be rebuilt easily
68   for db in postgresql mysql sqlite3; do
69           mkdir -p ../copies/database/$db
70           cp database/$db/*.sql ../copies/database/$db/
71   done
73   for db in postgresql mysql; do
74     ./configure ${_configure_flags[@]} --enable-server --with-$db
75     make clean
76     make
77     mv src/zabbix_server/zabbix_server{,_$db}
78   done
80   for db in postgresql mysql sqlite3; do
81     ./configure ${_configure_flags[@]} --enable-proxy --with-$db
82     make clean
83     make
84     mv src/zabbix_proxy/zabbix_proxy{,_$db}
85   done
88 package_zabbix-server() {
89   pkgdesc='Monitoring software for networks and applications'
90   depends=(net-snmp curl libxml2 unixodbc libldap libevent pcre)
91   optdepends=('postgresql-libs: for PostgreSQL support'
92               'mariadb-libs: for MariaDB support')
93   backup=(etc/zabbix/zabbix_server.conf)
94   install=zabbix-server.install
96   cd $pkgbase-$pkgver
98   for db in postgresql mysql; do
99     install -Dm755 src/zabbix_server/zabbix_server_$db \
100       "$pkgdir/usr/bin/zabbix_server_$db"
102     install -d "$pkgdir/usr/share/$pkgname/$db"
103     install -m644 ../copies/database/$db/*.sql -t "$pkgdir/usr/share/$pkgname/$db"
104   done
105   install -Dm755 src/zabbix_get/zabbix_get "$pkgdir/usr/bin/zabbix_get"
107   install -Dm644 man/zabbix_server.man "$pkgdir/usr/share/man/man8/zabbix_server.8"
108   install -Dm644 man/zabbix_get.man "$pkgdir/usr/share/man/man1/zabbix_get.1"
110   install -Dm644 conf/zabbix_server.conf "$pkgdir/etc/zabbix/zabbix_server.conf"
111   chown 170:170 "$pkgdir/etc/zabbix/zabbix_server.conf"
113   install -Dm644 "$srcdir/zabbix-server-pgsql.service" \
114     "$pkgdir/usr/lib/systemd/system/zabbix-server-pgsql.service"
115   install -Dm644 "$srcdir/zabbix-server-mysql.service" \
116     "$pkgdir/usr/lib/systemd/system/zabbix-server-mysql.service"
118   install -Dm644 "$srcdir/zabbix-server.sysusers" \
119         "$pkgdir/usr/lib/sysusers.d/zabbix-server.conf"
120   install -Dm644 "$srcdir/zabbix-server.tmpfiles" \
121         "$pkgdir/usr/lib/tmpfiles.d/zabbix-server.conf"
123   # Fix socket paths to avoid 10 day cleanup in /tmp
124   echo "d /run/$pkgname 750 $pkgname $pkgname" >> "$pkgdir/usr/lib/tmpfiles.d/$pkgname.conf"
125   sed -i \
126     -e "s/# SocketDir=\/tmp/SocketDir=\/run\/$pkgname/" \
127     "$pkgdir/etc/zabbix/"*.conf
130 package_zabbix-agent() {
131   pkgdesc='Monitoring agent for Zabbix'
132   depends=(curl pcre)
133   backup=(etc/zabbix/zabbix_agentd.conf)
135   cd $pkgbase-$pkgver
136   install -Dm755 src/zabbix_agent/zabbix_agentd "$pkgdir/usr/bin/zabbix_agentd"
137   install -Dm755 src/zabbix_sender/zabbix_sender "$pkgdir/usr/bin/zabbix_sender"
139   install -Dm644 conf/zabbix_agentd.conf "$pkgdir/etc/zabbix/zabbix_agentd.conf"
140   chown 172:172 "$pkgdir/etc/zabbix/zabbix_agentd.conf"
142   install -Dm644 conf/zabbix_agentd/userparameter_examples.conf \
143         "$pkgdir/usr/share/zabbix-agent/userparameter_examples.conf"
144   install -Dm644 conf/zabbix_agentd/userparameter_mysql.conf \
145         "$pkgdir/usr/share/zabbix-agent/userparameter_mysql.conf"
147   install -Dm644 man/zabbix_agentd.man \
148         "$pkgdir/usr/share/man/man8/zabbix_agentd.8"
149   install -Dm644 man/zabbix_sender.man \
150         "$pkgdir/usr/share/man/man1/zabbix_sender.1"
152   install -Dm644 "$srcdir/zabbix-agent.service" \
153         "$pkgdir/usr/lib/systemd/system/zabbix-agent.service"
154   install -Dm644 "$srcdir/zabbix-agent.sysusers" \
155         "$pkgdir/usr/lib/sysusers.d/zabbix-agent.conf"
156   install -Dm644 "$srcdir/zabbix-agent.tmpfiles" \
157         "$pkgdir/usr/lib/tmpfiles.d/zabbix-agent.conf"
160 package_zabbix-agent2() {
161   pkgdesc='Experimental monitoring agent for Zabbix (Agent 2)'
162   depends=(zabbix-agent)
163   backup=(etc/zabbix/zabbix_agent2.conf)
165   cd $pkgbase-$pkgver
166   install -Dm755 src/go/bin/zabbix_agent2 "$pkgdir/usr/bin/zabbix_agent2"
167   install -Dm644 src/go/conf/zabbix_agent2.conf "$pkgdir/etc/zabbix/zabbix_agent2.conf"
168   chown 172:172 "$pkgdir/etc/zabbix/zabbix_agent2.conf"
169   mkdir -p "$pkgdir/etc/zabbix/zabbix_agent2.d/plugins.d/"
170   chown 172:172 "$pkgdir/etc/zabbix/zabbix_agent2.d/plugins.d/"
172   install -Dm644 man/zabbix_agent2.man \
173         "$pkgdir/usr/share/man/man8/zabbix_agent2.8"
175   install -Dm644 "$srcdir/zabbix-agent2.service" \
176         "$pkgdir/usr/lib/systemd/system/zabbix-agent2.service"
179 package_zabbix-proxy() {
180   pkgdesc='Data collecting proxy for Zabbix'
181   depends=(net-snmp curl libxml2 sqlite unixodbc libldap pcre libevent)
182   optdepends=('mariadb-libs: for MariaDB support'
183               'postgresql-libs: for PostgreSQL support')
184   backup=(etc/zabbix/zabbix_proxy.conf)
186   cd $pkgbase-$pkgver
187   for db in postgresql mysql sqlite3; do
188     install -Dm755 src/zabbix_proxy/zabbix_proxy_$db \
189       "$pkgdir/usr/bin/zabbix_proxy_$db"
191     install -d "$pkgdir/usr/share/$pkgname/$db"
192     install -m644 ../copies/database/$db/schema.sql -t "$pkgdir/usr/share/$pkgname/$db"
193   done
194   install -Dm644 conf/zabbix_proxy.conf "$pkgdir/etc/zabbix/zabbix_proxy.conf"
195   chown 171:171 "$pkgdir/etc/zabbix/zabbix_proxy.conf"
197   install -Dm644 "$srcdir/zabbix-proxy-sqlite.service" \
198     "$pkgdir/usr/lib/systemd/system/zabbix-proxy-sqlite.service"
199   install -Dm644 "$srcdir/zabbix-proxy-pgsql.service" \
200     "$pkgdir/usr/lib/systemd/system/zabbix-proxy-pgsql.service"
201   install -Dm644 "$srcdir/zabbix-proxy-mysql.service" \
202     "$pkgdir/usr/lib/systemd/system/zabbix-proxy-mysql.service"
204   install -Dm644 "$srcdir/zabbix-proxy.sysusers" \
205         "$pkgdir/usr/lib/sysusers.d/zabbix-proxy.conf"
206   install -Dm644 "$srcdir/zabbix-proxy.tmpfiles" \
207         "$pkgdir/usr/lib/tmpfiles.d/zabbix-proxy.conf"
209   # Fix socket paths to avoid 10 day cleanup in /tmp
210   echo "d /run/$pkgname 750 $pkgname $pkgname" >> "$pkgdir/usr/lib/tmpfiles.d/$pkgname.conf"
211   sed -i \
212     -e "s/# SocketDir=\/tmp/SocketDir=\/run\/$pkgname/" \
213     "$pkgdir/etc/zabbix/"*.conf
216 package_zabbix-frontend-php() {
217   pkgdesc='PHP frontend for Zabbix'
218   depends=(zabbix-server php php-gd)
220   cd $pkgbase-$pkgver
221   install -d "$pkgdir/usr/share/webapps/zabbix"
222   cp -a ui/* "$pkgdir/usr/share/webapps/zabbix"
223   chown 33:33 ${pkgdir}/usr/share/webapps/zabbix/conf/ # write access for http user