aboutsummaryrefslogtreecommitdiffstats
path: root/main/zabbix/APKBUILD
blob: e4229719bd491b7097320f8381ee6b5233485b42 (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
# Contributor: Jeff Bilyk <jbilyk at gmail>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=zabbix
pkgver=2.0.5
pkgrel=0
pkgdesc="Enterprise-class open source distributed monitoring"
url="http://www.zabbix.com"
arch="all"
license="GPL"
depends="fping"
makedepends="postgresql-dev curl-dev libiconv-dev net-snmp-dev
	sqlite-dev mysql-dev curl-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
	res_send.patch
	automake.patch
	zabbix-server.initd
	zabbix-agentd.initd
	zabbix-proxy.initd
	"

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

prepare() {
	cd "$_builddir"
	for i in $source; do
		case $i in
		*.patch)
			msg "Applying $i"
			patch -p1 -i "$srcdir"/$i || return 1
			;;
		esac
	done
	aclocal -I m4 && autoconf && autoheader \
		&& automake --add-missing || return 1
}

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
			"
        # 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 --with-$db \
			$_configure
		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
}

setup() {
	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
	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
	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; }
mysql()		{ _do_db mysql; }
sqlite()	{ _do_db sqlite3; }

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() {
	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="0c0721c31889b63bce9aa556bcb927e8  zabbix-2.0.5.tar.gz
26b0401a83bdb1dce29338e5b2786620  zabbix_server.conf
9832a81e134c8e2c11e2a06b7adbf88f  zabbix_trapper.conf
0310b92afb3f35c1075fff53db737212  zabbix_proxy.conf
721c18077fa739f956340afca9f067f4  zabbix_agentd.conf
8d1d2e53479173aac0df0c38a4d6afda  zabbix-getloadavg.patch
b80eca2e260cc9e563f4b7a1b30bb158  res_send.patch
5f7b1815a309d8dade4a1d15d5048742  automake.patch
d823c2ab6c2bbdd0ebd3511fac4a83b4  zabbix-server.initd
1a5c718bcf815fcf659e14fb0b576a1a  zabbix-agentd.initd
a99978139481e69434f78fc3e8c53441  zabbix-proxy.initd"