aboutsummaryrefslogtreecommitdiffstats
path: root/main/zabbix/APKBUILD
blob: a67ee22d8fe84b8e8498edbff8be992a8762e0f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
# Contributor: Łukasz Jendrysik <scadu@yandex.com>
# Contributor: Jeff Bilyk <jbilyk at gmail>
# Contributor: Leonardo Arena <rnalrd@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=zabbix
pkgver=2.4.5
pkgrel=1
pkgdesc="Enterprise-class open source distributed monitoring"
url="http://www.zabbix.com"
arch="all"
license="GPL"
depends="fping"
makedepends="postgresql-dev curl-dev net-snmp-dev
	sqlite-dev mariadb-dev curl-dev openipmi-dev unixodbc-dev
	autoconf automake"
install="$pkgname.pre-install"
pkgusers="zabbix"
pkggroups="zabbix"
subpackages="$pkgname-doc $pkgname-agent $pkgname-pgsql $pkgname-mysql
	$pkgname-webif $pkgname-sqlite $pkgname-utils $pkgname-setup"
source="http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz
	zabbix_server.conf
	zabbix_trapper.conf
	zabbix_proxy.conf
	zabbix_agentd.conf
	zabbix-getloadavg.patch
	automake.patch
	musl-fix-includes.patch
	zabbix-server.initd
	zabbix-server.confd
	zabbix-agentd.initd
	zabbix-proxy.initd
	002-fix-res_send-on-uclibc.patch
	"

_builddir="$srcdir"/$pkgname-$pkgver

prepare() {
	cd "$_builddir"
	# update_config_sub || return 1
	for i in $source; do
		case $i in
		*uclibc*.patch)
			if [ "$CLIBC" == "uclibc" ]; then
				msg "Applying $i"
				patch -p1 -i "$srcdir"/$i || return 1
			fi
			;;
		*eglibc*.patch)
			if [ "$CLIBC" == "eglibc" ]; then
				msg "Applying $i"
				patch -p1 -i "$srcdir"/$i || return 1
			fi
			;;
		*.patch)
			msg "Applying $i"
			patch -p1 -i "$srcdir"/$i || return 1
			;;
		esac
	done
	aclocal -I m4 && autoconf && autoheader \
		&& automake --add-missing || return 1
	# update_config_sub
}

build() {
	# set default configure flags
	_configure="--prefix=/usr \
			--sysconfdir=/etc/zabbix \
			--mandir=/usr/share/man \
			--infodir=/usr/share/info \
			--enable-server \
			--enable-agent \
			--enable-proxy \
			--enable-ipv6 \
			--with-net-snmp \
			--with-libcurl \
			--with-openipmi \
			--with-unixodbc \
			"
        # we run build for each db type
        # make sure prepare is same for each db
	for db in postgresql mysql sqlite3; do
		cd "$srcdir"
		msg "Building for $db"
		cp -r "$pkgname-$pkgver" "$pkgname-$pkgver-$db"
		cd "$_builddir-$db"
		./configure \
			--build=$CBUILD \
			--host=$CHOST \
			--with-$db \
			$_configure \
			|| return 1
		make || return 1
	done
}


package() {
        # doing manual install
	for i in agentd proxy server; do
		install -D -m755 "$_builddir"/man/zabbix_$i.man \
			"$pkgdir"/usr/share/man/man8/zabbix_$i.8
	done
	for i in get sender; do
		install -D -m755 "$_builddir"/man/zabbix_$i.man \
			"$pkgdir"/usr/share/man/man1/zabbix_$i.1
	done
	install -d -m0750 -o zabbix -g zabbix \
                "$pkgdir"/var/run/zabbix "$pkgdir"/var/log/zabbix
        install -D -m0644 "$srcdir"/zabbix_server.conf \
		"$pkgdir"/etc/zabbix/zabbix_server.conf
	install -D -m0644 "$srcdir"/zabbix_trapper.conf \
		"$pkgdir"/etc/zabbix/zabbix_trapper.conf
        for i in server proxy; do
                install -D -m0755 "$srcdir"/zabbix-$i.initd \
                        "$pkgdir"/etc/init.d/zabbix-$i || return 1
        done
	install -D -m0644 "$srcdir"/zabbix-server.confd \
		"$pkgdir"/etc/conf.d/zabbix-server || return 1
}

setup() {
	arch="noarch"
	pkgdesc="Zabbix images and sql files"
	depends=
	mkdir -p "$subpkgdir"/usr/share/zabbix/ || return 1
	mv "$_builddir"/database "$subpkgdir"/usr/share/zabbix/
}

_do_db() {
        pkgdesc="Zabbix server with $1 database support"
        depends="$pkgname $2"
	local i=
	mkdir -p "$subpkgdir"/usr/sbin
	mv "$_builddir-$1"/src/zabbix_server/zabbix_server \
		"$subpkgdir"/usr/sbin/ || return 1
	mv "$_builddir-$1"/src/zabbix_proxy/zabbix_proxy \
		"$subpkgdir"/usr/sbin/ || return 1
        install -D -m0644 "$srcdir"/zabbix_proxy.conf \
		"$pkgdir"/etc/zabbix/zabbix_proxy.conf || return 1
	cd "$_builddir"
	for i in upgrades/dbpatches/*/$1; do
		[ -e $i ] || continue
		mkdir -p "$subpkgdir"/usr/share/zabbix/${i%/*}
		mv "$i" "$subpkgdir"/usr/share/zabbix/$i
	done
        return 0
}

pgsql()	{ _do_db postgresql "!$pkgname-mysql !$pkgname-sqlite";}
mysql()	{ _do_db mysql "!$pkgname-pgsql !$pkgname-sqlite";}
sqlite(){ _do_db sqlite3 "!$pkgname-pgsql !$pkgname-mysql";}

utils() {
	pkgdesc="Zabbix client utilities"
	depends=
	mkdir -p "$subpkgdir"/usr/bin
	mv "$_builddir-postgresql"/src/zabbix_get/zabbix_get \
		"$subpkgdir"/usr/bin
        mv "$_builddir-postgresql"/src/zabbix_sender/zabbix_sender \
	                "$subpkgdir"/usr/bin
}

webif() {
	arch="noarch"
	pkgdesc="Zabbix web-interface"
	depends="php php-pgsql php-gd php-curl php-bcmath php-sockets php-iconv
		php-xmlreader php-ctype php-gettext"
	_wwwdir="$subpkgdir"/usr/share/webapps/zabbix
	mkdir -p $_wwwdir
	mv "$_builddir"/frontends/php/* "$_wwwdir"
}

agent() {
	pkgdesc="Zabbix Network Monitoring Agent"
	depends=
	install="$subpkgname.pre-install"
        install -d -m0750 -o zabbix -g zabbix \
                "$subpkgdir"/var/run/zabbix "$subpkgdir"/var/log/zabbix
	install -D -m0644 "$srcdir"/zabbix_agentd.conf \
		"$subpkgdir"/etc/zabbix/zabbix_agentd.conf
	install -D -m0755 "$srcdir"/zabbix-agentd.initd \
		"$subpkgdir"/etc/init.d/zabbix-agentd
	mkdir -p "$subpkgdir"/usr/sbin
	mv "$_builddir-postgresql"/src/zabbix_agent/zabbix_agent \
		"$subpkgdir"/usr/sbin/
        mv "$_builddir-postgresql"/src/zabbix_agent/zabbix_agentd \
	                "$subpkgdir"/usr/sbin/

}

md5sums="a82eb0d55d3ca947e10a4a55238f4388  zabbix-2.4.5.tar.gz
26b0401a83bdb1dce29338e5b2786620  zabbix_server.conf
9832a81e134c8e2c11e2a06b7adbf88f  zabbix_trapper.conf
0310b92afb3f35c1075fff53db737212  zabbix_proxy.conf
721c18077fa739f956340afca9f067f4  zabbix_agentd.conf
3a71e310bd2b38498a7c6830169f7480  zabbix-getloadavg.patch
bf62c539870874e11de39c60cb974786  automake.patch
40c81bdec85815f4ba637eb6528cc5e8  musl-fix-includes.patch
f44105322022734dc42032db0396fe9e  zabbix-server.initd
bd91d0243cf8f72b86b9bf0b91963663  zabbix-server.confd
d9711779f969958c8aa348991170578b  zabbix-agentd.initd
0ce2ab963a0bc5a0a6e17a708b7c7064  zabbix-proxy.initd
c3b399a406f7dd1df0de7b3fae3ed081  002-fix-res_send-on-uclibc.patch"
sha256sums="4e2cf1e4893a45d83379a05e2debabddf16beab324c93e84adc0bb57716fb957  zabbix-2.4.5.tar.gz
3b09a8fdc38216d859022c5966c36f0bcb6984974208cf4c69c17129649efdf5  zabbix_server.conf
3ae307895c9a7189e29c4ebf7479ce08d4c3bbe1a7f0a3554828170dac417bab  zabbix_trapper.conf
0cd9cab17d1a2f791262b683aeedc5115722478a4847cb438aadb51198f67287  zabbix_proxy.conf
98343193215c9e1bc79ff332688c684f7023da38583bba800acc404b12c6cc51  zabbix_agentd.conf
d2c0651c5fa67a1857707552e79ecece7ca95c149042460c40456634bf7611dc  zabbix-getloadavg.patch
b347ca77660e69bea353c50e2fce0c7c4cc837f782c9f84f74ba92c1a62b4c1b  automake.patch
38b4e1a5d5c16c7d9b31347acf710d84b693f6e1df365d1072548e897e034884  musl-fix-includes.patch
d4c6dcf9b78f78a2ef2b4a4f2763fb90f81d0298bc90bd164db8604f161182ec  zabbix-server.initd
ddf75041fb0afc5b211dd79a934341cc9db4325447ad33a42cbf09bdfb5cad42  zabbix-server.confd
62223dce45fb915cc66eb24c839cf63e81c80159da9360e7669e7384082e3a08  zabbix-agentd.initd
ec3a8c564be20221ea7560fbec345191cd251d58bd15e9c41abec40c2cf5b4f2  zabbix-proxy.initd
c796e9aa371f50155b396da53504375f35f77bd3941440525dcaf92da33dac99  002-fix-res_send-on-uclibc.patch"
sha512sums="bdcba684b3d1cdb9eb5e1f9b370ef450201de8dbd9fe1619ef2b2437de6c34762dc041fa873976c4af0a2af229eec450aa58b1663feb75b6345d303484d35ead  zabbix-2.4.5.tar.gz
3170d56a61871e6efadf705c19f864fdecf9420c4263f2a1129245b3b55bd730d1ba5a6a26ea866fc7842c86f7745e51ea28878bb9e9267ed9176499cb75e8bb  zabbix_server.conf
cd08d907838de646f65316950e8c71deae25be1701e0cc22e5fd2f636c21ef2365a537d247277bafb694cae8c5dbd22eb725c1647797ad3e4ac4b3df2084ef07  zabbix_trapper.conf
a3703641125dda8c13d658ad4e1cf2cde94af01ed953480a37006e354ff58ade4a99b3575e3f095d8639ac9c481be52e25120353d9a4cd2104a68aff4a5596e5  zabbix_proxy.conf
8a3298cb98787f89b4cc0faa6168a1ab59860c60bec159ecd341db25c0903e89061b40d2b37df9e2df99e08b71b57089bcb25f352e7edf09fbc1b0bd3f1034f6  zabbix_agentd.conf
b65c6ba7701d98ae7f6fe2124c1d2b8b8fea3c3cc7ee080bf99f5afff0aaa6a025c2a1f5136b4700b53d1b7609e6185642650d7edd013c554b2af37fddae771c  zabbix-getloadavg.patch
9bff8966cb8b3f1767bfb1b3f3529bca5c9957f2c8179a40ded3b4e43615ba9fb408aef43092fd119b7df80b042555d05c9780fac3760176b95524aa48252fee  automake.patch
9b87ec1ea4a9cbb501c16012d498cdae82a696f4cd495e1e8cb201d9e31c6e135da5bb264c6273f2de87297bd3e4bd16f66703610686f5d610e3316ee24aac91  musl-fix-includes.patch
3a25bf9f428f55545dd735aea2855e0e4927e006ca01a2f918ec161ffe9b2ec66e46598bf34208e24535e1d04e33087f42eb8226b17eb4118abd6507bbb10ff5  zabbix-server.initd
a91821c6086a1fc0197750cc68073419defcb7d775b11b14a993409a8f61c7a1a0a0af95de27eed9f3b8357f8362640cb1b26b91b56f4f1d714ca6f222d02b80  zabbix-server.confd
7cc2672b717f1b47b12342fe225e9dc3838c61a0bf81d359d0a71efb0adc9b354fb8bc8b5bb64c9defa5700bcaf651b35778194a50b6b03b0a723dce76460092  zabbix-agentd.initd
e19490e724c6e4ecdadf7ee3898567b82f18ea2a894ef709bfc181c3076d50435b45429207dd4d537aacbec0242d83393240e48b434d9681ebb0d67a45643ed1  zabbix-proxy.initd
cc00603b26a4bd49fba5d8b5e2aaaa7c947c888f4970a4a582a201012aee956f926251eb85236014660fe0b3fa1a22a7ac27b4331e00af64d2a658e972d2d7df  002-fix-res_send-on-uclibc.patch"