/[gentoo-x86]/net-analyzer/zabbix/zabbix-1.8.10-r2.ebuild
Gentoo

Contents of /net-analyzer/zabbix/zabbix-1.8.10-r2.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (show annotations) (download)
Wed Jun 20 20:22:22 2012 UTC (11 months ago) by mattm
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +1 -1 lines
FILE REMOVED
Remove obsolete ebuilds - 1.8.11r2 is current stable, 1.8.13-r1 is future stable, 1.8.14 will enter testing when released, and latest 2.0.1 will be the first 2.0.x ebuild to be unmasked for testing on ~amd and ~x86 in the next week.

(Portage version: 2.1.10.65/cvs/Linux x86_64)

1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/net-analyzer/zabbix/zabbix-1.8.10-r2.ebuild,v 1.3 2012/06/12 03:55:18 zmedico Exp $
4
5 EAPI="2"
6
7 # needed to make webapp-config dep optional
8 WEBAPP_OPTIONAL="yes"
9 inherit eutils flag-o-matic webapp depend.php autotools user
10
11 DESCRIPTION="ZABBIX is software for monitoring of your applications, network and servers."
12 HOMEPAGE="http://www.zabbix.com/"
13 MY_P=${P/_/}
14 SRC_URI="http://prdownloads.sourceforge.net/zabbix/${MY_P}.tar.gz"
15 LICENSE="GPL-2"
16 SLOT="0"
17 WEBAPP_MANUAL_SLOT="yes"
18 KEYWORDS="~amd64 ~x86"
19 IUSE="agent curl frontend ipv6 jabber ldap mysql openipmi oracle postgres proxy server -ssh snmp +sqlite"
20
21 COMMON_DEPEND="snmp? ( net-analyzer/net-snmp )
22 ldap? (
23 net-nds/openldap
24 =dev-libs/cyrus-sasl-2*
25 net-libs/gnutls
26 )
27 mysql? ( virtual/mysql )
28 sqlite? ( =dev-db/sqlite-3* )
29 postgres? ( dev-db/postgresql-base )
30 oracle? ( dev-db/oracle-instantclient-basic )
31 jabber? ( dev-libs/iksemel )
32 curl? ( net-misc/curl )
33 openipmi? ( sys-libs/openipmi )
34 ssh? ( net-libs/libssh2 )"
35
36 RDEPEND="${COMMON_DEPEND}
37 proxy? ( net-analyzer/fping )
38 server? ( net-analyzer/fping
39 app-admin/webapp-config )
40 frontend? ( dev-lang/php[bcmath,ctype,sockets,gd,truetype,xml,session]
41 media-libs/gd[png]
42 app-admin/webapp-config )"
43 DEPEND="${COMMON_DEPEND}
44 virtual/pkgconfig"
45
46 use frontend && need_php_httpd
47
48 src_prepare() {
49 epatch "${FILESDIR}/${PN}-1.8.9-as-needed.patch"
50 eautoreconf
51 }
52
53 pkg_setup() {
54 if use server || use proxy ; then
55 local dbnum dbtypes="mysql oracle postgres sqlite" dbtype
56 declare -i dbnum=0
57 for dbtype in ${dbtypes}; do
58 use ${dbtype} && let dbnum++
59 done
60 if [ ${dbnum} -gt 1 ]; then
61 eerror
62 eerror "You can't use more than one database type in Zabbix."
63 eerror "Select exactly one database type out of these: ${dbtypes}"
64 eerror
65 die "Multiple database types selected."
66 elif [ ${dbnum} -lt 1 ]; then
67 eerror
68 eerror "Select exactly one database type out of these: ${dbtypes}"
69 eerror
70 die "No database type selected."
71 fi
72 if use oracle; then
73 if [ -z "${ORACLE_HOME}" ]; then
74 eerror
75 eerror "The environment variable ORACLE_HOME must be set"
76 eerror "and point to the correct location."
77 eerror "It looks like you don't have Oracle installed."
78 eerror
79 die "Environment variable ORACLE_HOME is not set"
80 fi
81 if has_version 'dev-db/oracle-instantclient-basic'; then
82 ewarn
83 ewarn "Please ensure you have a full install of the Oracle client."
84 ewarn "dev-db/oracle-instantclient* is NOT sufficient."
85 ewarn
86 fi
87 fi
88 fi
89
90 if use frontend; then
91 webapp_pkg_setup
92 fi
93
94 enewgroup zabbix
95 enewuser zabbix -1 -1 /var/lib/zabbix/home zabbix
96 }
97
98 pkg_postinst() {
99 if use server || use proxy ; then
100 elog
101 elog "You need to configure your database for Zabbix."
102 elog
103 elog "Have a look at /usr/share/zabbix/database for"
104 elog "database creation and upgrades."
105 elog
106 elog "For more info read the Zabbix manual at"
107 elog "http://www.zabbix.com/documentation.php"
108 elog
109
110 zabbix_homedir=$(egethome zabbix)
111 if [ -n "${zabbix_homedir}" ] && \
112 [ "${zabbix_homedir}" != "/var/lib/zabbix/home" ]; then
113 ewarn
114 ewarn "The user 'zabbix' should have his homedir changed"
115 ewarn "to /var/lib/zabbix/home if you want to use"
116 ewarn "custom alert scripts."
117 ewarn
118 ewarn "A real homedir might be needed for configfiles"
119 ewarn "for custom alert scripts (e.g. ~/.sendxmpprc when"
120 ewarn "using sendxmpp for Jabber alerts)."
121 ewarn
122 ewarn "To change the homedir use:"
123 ewarn " usermod -d /var/lib/zabbix/home zabbix"
124 ewarn
125 fi
126 fi
127
128 if use server; then
129 elog
130 elog "For distributed monitoring you have to run:"
131 elog
132 elog "zabbix_server -n <nodeid>"
133 elog
134 elog "This will convert database data for use with Node ID"
135 elog "and also adds a local node."
136 elog
137 fi
138
139 elog "--"
140 elog
141 elog "Add these lines in the /etc/services :"
142 elog
143 elog "zabbix-agent 10050/tcp Zabbix Agent"
144 elog "zabbix-agent 10050/udp Zabbix Agent"
145 elog "zabbix-trapper 10051/tcp Zabbix Trapper"
146 elog "zabbix-trapper 10051/udp Zabbix Trapper"
147 elog
148
149 # repeat fowners/fperms functionality from src_install()
150 # here to catch wrong permissions on existing files in
151 # the live filesystem (yeah, that sucks).
152 chown -R zabbix:zabbix \
153 "${ROOT}"/etc/zabbix \
154 "${ROOT}"/var/lib/zabbix \
155 "${ROOT}"/var/lib/zabbix/home \
156 "${ROOT}"/var/lib/zabbix/scripts \
157 "${ROOT}"/var/log/zabbix \
158 "${ROOT}"/var/run/zabbix
159 chmod 0750 \
160 "${ROOT}"/etc/zabbix \
161 "${ROOT}"/var/lib/zabbix \
162 "${ROOT}"/var/lib/zabbix/home \
163 "${ROOT}"/var/lib/zabbix/scripts \
164 "${ROOT}"/var/log/zabbix \
165 "${ROOT}"/var/run/zabbix
166
167 chmod 0640 \
168 "${ROOT}"/etc/zabbix/zabbix_*
169
170 if use server || use proxy ; then
171 # check for fping
172 fping_perms=$(stat -c %a /usr/sbin/fping 2>/dev/null)
173 case "${fping_perms}" in
174 4[157][157][157])
175 ;;
176 *)
177 ewarn
178 ewarn "If you want to use the checks 'icmpping' and 'icmppingsec',"
179 ewarn "you have to make /usr/sbin/fping setuid root and executable"
180 ewarn "by everyone. Run the following command to fix it:"
181 ewarn
182 ewarn " chmod u=rwsx,g=rx,o=rx /usr/sbin/fping"
183 ewarn
184 ewarn "Please be aware that this might impose a security risk,"
185 ewarn "depending on the code quality of fping."
186 ewarn
187 ebeep 3
188 epause 5
189 ;;
190 esac
191 fi
192 }
193
194 src_configure() {
195 econf \
196 $(use_enable server) \
197 $(use_enable proxy) \
198 $(use_enable agent) \
199 $(use_enable ipv6) \
200 $(use_with ldap) \
201 $(use_with snmp net-snmp) \
202 $(use_with mysql) \
203 $(use_with postgres pgsql) \
204 $(use_with oracle) \
205 $(use_with sqlite sqlite3) \
206 $(use_with jabber) \
207 $(use_with curl libcurl) \
208 $(use_with openipmi openipmi) \
209 $(use_with ssh ssh2) \
210 || die "econf failed"
211 }
212
213 src_install() {
214 dodir \
215 /etc/zabbix \
216 /var/lib/zabbix \
217 /var/lib/zabbix/home \
218 /var/lib/zabbix/scripts \
219 /var/log/zabbix \
220 /var/run/zabbix
221
222 keepdir \
223 /etc/zabbix \
224 /var/lib/zabbix \
225 /var/lib/zabbix/home \
226 /var/lib/zabbix/scripts \
227 /var/log/zabbix \
228 /var/run/zabbix
229
230 if use server; then
231 insinto /etc/zabbix
232 doins \
233 "${FILESDIR}/1.6.6"/zabbix_server.conf \
234 "${FILESDIR}/1.6.6"/zabbix_trapper.conf
235 doinitd \
236 "${FILESDIR}/1.6.6"/init.d/zabbix-server
237 dosbin \
238 src/zabbix_server/zabbix_server
239 dodir \
240 /usr/share/zabbix/database
241 insinto /usr/share/zabbix/database
242 doins -r \
243 upgrades \
244 create
245 fowners zabbix:zabbix \
246 /etc/zabbix/zabbix_server.conf \
247 /etc/zabbix/zabbix_trapper.conf
248 fperms 0640 \
249 /etc/zabbix/zabbix_server.conf \
250 /etc/zabbix/zabbix_trapper.conf
251 fi
252
253 if use proxy; then
254 doinitd \
255 "${FILESDIR}/1.6.6"/init.d/zabbix-proxy
256 dosbin \
257 src/zabbix_proxy/zabbix_proxy
258 insinto /etc/zabbix
259 doins \
260 "${FILESDIR}/1.6.6"/zabbix_proxy.conf
261 dodir \
262 /usr/share/zabbix/database
263 insinto /usr/share/zabbix/database
264 doins -r \
265 upgrades \
266 create
267 fi
268
269 if use agent; then
270 insinto /etc/zabbix
271 doins \
272 "${FILESDIR}/1.6.6"/zabbix_agent.conf \
273 "${FILESDIR}/1.6.6"/zabbix_agentd.conf
274 doinitd \
275 "${FILESDIR}/1.6.6"/init.d/zabbix-agentd
276 dosbin \
277 src/zabbix_agent/zabbix_agent \
278 src/zabbix_agent/zabbix_agentd
279 dobin \
280 src/zabbix_sender/zabbix_sender \
281 src/zabbix_get/zabbix_get
282 fowners zabbix:zabbix \
283 /etc/zabbix/zabbix_agent.conf \
284 /etc/zabbix/zabbix_agentd.conf
285 fperms 0640 \
286 /etc/zabbix/zabbix_agent.conf \
287 /etc/zabbix/zabbix_agentd.conf
288 fi
289
290 fowners zabbix:zabbix \
291 /etc/zabbix \
292 /var/lib/zabbix \
293 /var/lib/zabbix/home \
294 /var/lib/zabbix/scripts \
295 /var/log/zabbix \
296 /var/run/zabbix
297 fperms 0750 \
298 /etc/zabbix \
299 /var/lib/zabbix \
300 /var/lib/zabbix/home \
301 /var/lib/zabbix/scripts \
302 /var/log/zabbix \
303 /var/run/zabbix
304
305 dodoc README INSTALL NEWS ChangeLog
306
307 if use frontend; then
308 webapp_src_preinst
309 cp -R frontends/php/* "${D}/${MY_HTDOCSDIR}"
310 webapp_postinst_txt en "${FILESDIR}/"1.6.6/postinstall-en.txt
311 webapp_configfile \
312 "${MY_HTDOCSDIR}"/include/db.inc.php \
313 "${MY_HTDOCSDIR}"/include/config.inc.php
314 webapp_src_install
315 fi
316 }

  ViewVC Help
Powered by ViewVC 1.1.17