/[packages]/cauldron/zabbix/current/SPECS/zabbix.spec
ViewVC logotype

Contents of /cauldron/zabbix/current/SPECS/zabbix.spec

Parent Directory Parent Directory | Revision Log Revision Log


Revision 389409 - (show annotations) (download)
Fri Jan 18 13:37:38 2013 UTC (11 years, 3 months ago) by colin
File size: 7748 byte(s)
Use tmpfiles.d for runtime dir creation.
1 %define _disable_ld_as_needed 1
2 %define _requires_exceptions pear
3
4 Name: zabbix
5 Version: 2.0.4
6 Release: %mkrel 3
7 Summary: Open-source monitoring solution for your IT infrastructure
8 Group: Networking/Other
9 License: GPLv2+
10 URL: http://www.zabbix.com
11 Source0: http://freefr.dl.sourceforge.net/project/%{name}/ZABBIX%20Latest%20Stable/%{version}/%{name}-%{version}.tar.gz
12 Source1: zabbix-web.conf
13 Source2: zabbix-server.init
14 Source3: zabbix-agent.init
15 Source4: zabbix-logrotate.in
16 Source5: %{name}-tmpfiles.conf
17
18 %define database %{nil}
19 %define zdb %{nil}
20 %define with_postgresql %{?_with_postgresql: 1} %{?!_with_postgresql: 0}
21 #define with_mysql %{?_with_mysql: 1} %{?!_with_mysql: 0}
22 %define with_mysql %{?_without_mysql: 0} %{?!_without_mysql: 1}
23
24 # Zabbix can only be built with mysql -or- postgresql
25 # support. We build with mysql by default, but you can
26 # pass --with postgresql to build with postgresql instead.
27 %if %{with_postgresql}
28 %define database postgresql
29 %define zdb pgsql
30 %endif
31 %if %{with_mysql}
32 %define database mysql
33 %define zdb mysql
34 %endif
35
36 #if %{?database:1}%{!?database:0}
37 %if %{with_mysql} || %{with_postgresql}
38 BuildRequires: %{database}-devel
39 %endif
40 BuildRequires: net-snmp-devel
41 BuildRequires: openldap-devel, gnutls-devel
42 BuildRequires: libiksemel-devel
43 BuildRequires: libtasn1-devel
44 BuildRequires: curl-devel
45 BuildRequires: libssh2-devel
46 BuildRequires: openipmi-devel
47 Requires: logrotate, fping
48 Requires(pre): rpm-helper
49 Requires(post): rpm-helper
50 Requires(preun): rpm-helper
51
52 %description
53 Zabbix is the ultimate open source availability and performance monitoring
54 solution. Zabbix offers advanced monitoring, alerting, and visualization features
55 today which are missing in other monitoring systems, even some of the best
56 commercial ones.
57
58 %package agent
59 Summary: Zabbix Agent
60 Group: Networking/Other
61 Requires: logrotate
62 Requires(pre): rpm-helper
63 Requires(post): rpm-helper
64 Requires(preun): rpm-helper
65
66 %description agent
67 The zabbix client agent, to be installed on monitored systems.
68
69 %package web
70 Summary: Zabbix Web Frontend
71 Group: Networking/Other
72 Requires: apache-mod_php
73 Requires: php-bcmath
74 Requires: php-mbstring
75 Requires: php-gd
76 Requires: php-sockets
77 Requires: php-xml, php-xmlreader, php-xmlwriter
78 Requires: php-ctype
79 Requires: php-session
80 Requires: php-gettext
81 Requires: php-%{zdb}
82
83 %description web
84 The php frontend to display the zabbix web interface.
85
86 %prep
87 %setup -q
88 perl -pi -e 's/ -static//g' configure
89
90 # fix up some lib64 issues
91 %{__perl} -pi.orig -e 's|_LIBDIR=/usr/lib|_LIBDIR=%{_libdir}|g' \
92 configure
93
94 # fix up pt_br
95 %{__chmod} a-x frontends/php/include/locales/pt_br.inc.php ||:
96 %{__sed} -i 's/\r//' frontends/php/include/locales/pt_br.inc.php ||:
97
98 %build
99 %configure \
100 --enable-server \
101 --enable-agent \
102 --with-net-snmp \
103 --with-openipmi \
104 --with-ldap \
105 --with-libcurl \
106 --with-ssh2 \
107 --with-jabber \
108 --enable-ipv6 \
109 --enable-static=no \
110 %if %{with_mysql}
111 --with-mysql
112 %endif
113 %if %{with_postgresql}
114 --with-%{zdb}
115 %endif
116 %if !%{with_mysql} && !%{with_postgresql}
117 --with-sqlite3
118 %endif
119 #--disable-static
120 #--with-mysql \
121 #--with-mysql=%{_libdir}/mysql/mysql_config \
122 #--with-mysql=%{_bindir}/mysql_config
123
124 # --disable-static is partially broken atm,
125 # -static still gets into CFLAGS, so fix up in make
126 # (and even then, .a files still show their face...)
127 #find . -name Makefile -exec perl -pi -e 's/ -static//g' {} \;
128 %make
129 #make %{?_smp_mflags} CFLAGS="$RPM_OPT_FLAGS"
130
131 %install
132
133 # set up some required directories
134 mkdir -p %{buildroot}%{_sysconfdir}/%{name}
135 mkdir -p %{buildroot}%{_sysconfdir}/init.d
136 mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d
137 mkdir -p %{buildroot}%{_sysconfdir}/httpd/conf.d
138 mkdir -p %{buildroot}%{_datadir}/%{name}/schema
139 mkdir -p %{buildroot}%{_datadir}/%{name}/web
140 mkdir -p %{buildroot}%{_localstatedir}/log/%{name}
141
142 # php frontend
143 cp -a frontends/php/* %{buildroot}%{_datadir}/%{name}/web
144 mv %{buildroot}%{_datadir}/%{name}/web/include/db.inc.php \
145 %{buildroot}%{_sysconfdir}/%{name}/
146 ln -s ../../../..%{_sysconfdir}/%{name}/db.inc.php \
147 %{buildroot}%{_datadir}/%{name}/web/include/db.inc.php
148
149 # kill off .htaccess files, options set in SOURCE1
150 rm -f %{buildroot}%{_datadir}/%{name}/web/include/.htaccess
151 rm -f %{buildroot}%{_datadir}/%{name}/web/include/classes/.htaccess
152
153 # drop config files in place
154 install -m 0644 conf/%{name}_agent.conf %{buildroot}%{_sysconfdir}/%{name}
155 cat conf/%{name}_agentd.conf | sed \
156 -e 's|PidFile=.*|PidFile=/run/%{name}/%{name}_agentd.pid|g' \
157 -e 's|LogFile=.*|LogFile=%{_localstatedir}/log/%{name}/%{name}_agentd.log|g' \
158 > %{buildroot}%{_sysconfdir}/%{name}/%{name}_agentd.conf
159 cat conf/zabbix_server.conf | sed \
160 -e 's|PidFile=.*|PidFile=/run/%{name}/%{name}.pid|g' \
161 -e 's|LogFile=.*|LogFile=%{_localstatedir}/log/%{name}/%{name}_server.log|g' \
162 -e 's|AlertScriptsPath=/home/%{name}/bin/|AlertScriptsPath=%{_localstatedir}/lib/%{name}/|g' \
163 -e 's|DBUser=root|DBUser=%{name}|g' \
164 -e 's|DBSocket=/tmp/mysql.sock|DBSocket=%{_localstatedir}/lib/%{zdb}/%{zdb}.sock|g' \
165 -e 's|FpingLocation=/usr/sbin/fping|FpingLocation=/bin/fping|g' \
166 > %{buildroot}%{_sysconfdir}/%{name}/%{name}_server.conf
167 install -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/httpd/conf.d/%{name}.conf
168
169 # log rotation
170 cat %{SOURCE4} | sed -e 's|COMPONENT|server|g' > \
171 %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
172 cat %{SOURCE4} | sed -e 's|COMPONENT|agentd|g' > \
173 %{buildroot}%{_sysconfdir}/logrotate.d/%{name}-agent
174
175 # init scripts
176 install -m 0755 %{SOURCE2} %{buildroot}%{_sysconfdir}/init.d/%{name}
177 install -m 0755 %{SOURCE3} %{buildroot}%{_sysconfdir}/init.d/%{name}-agent
178
179 # tmpfiles
180 install -D -p -m 0644 %{SOURCE5} %{buildroot}%{_tmpfilesdir}/%{name}.conf
181 install -D -p -m 0644 %{SOURCE5} %{buildroot}%{_tmpfilesdir}/%{name}-agent.conf
182
183 # database schemata
184 cp -a database %{buildroot}/%{_datadir}/%{name}/schema
185 cp -a upgrades %{buildroot}/%{_datadir}/%{name}/schema
186 rm -f %{buildroot}/%{_datadir}/%{name}/schema/*/Makefile*
187
188 %makeinstall_std
189 rm -f %{buildroot}%{_sysconfdir}/%{name}*.conf
190 rm -rf %{buildroot}%{_libdir}/libzbx*.a
191
192 %pre
193 %_pre_useradd %{name} %{_localstatedir}/lib/%{name} /sbin/nologin
194
195 %pre agent
196 %_pre_useradd %{name} %{_localstatedir}/lib/%{name} /sbin/nologin
197
198 %post
199 %_tmpfilescreate %{name}
200 %_post_service %{name}
201
202 %post agent
203 %_tmpfilescreate %{name}-agent
204 %_post_service %{name}-agent
205
206 %preun
207 %_preun_service %{name}
208
209 %preun agent
210 %_preun_service %{name}-agent
211
212 %clean
213
214 %files
215 %doc AUTHORS ChangeLog COPYING INSTALL NEWS README
216 %{_datadir}/%{name}/schema
217 %dir %{_sysconfdir}/%{name}
218 %{_sbindir}/%{name}_server
219 %{_sysconfdir}/init.d/%{name}
220 %{_mandir}/man8/%{name}_server.8*
221 %{_tmpfilesdir}/%{name}.conf
222 %config(noreplace) %{_sysconfdir}/logrotate.d/zabbix
223 %config(noreplace) %{_sysconfdir}/%{name}/%{name}_server.conf
224 %attr(0755,%{name},%{name}) %dir %{_localstatedir}/log/%{name}
225
226 %files agent
227 %doc AUTHORS ChangeLog COPYING INSTALL NEWS README
228 %dir %{_sysconfdir}/%{name}
229 %{_bindir}/%{name}_sender
230 %{_bindir}/%{name}_get
231 %{_sbindir}/%{name}_agent
232 %{_sbindir}/%{name}_agentd
233 %{_mandir}/man1/%{name}_sender.1*
234 %{_mandir}/man1/%{name}_get.1*
235 %{_mandir}/man8/%{name}_agentd.8*
236 %{_sysconfdir}/init.d/%{name}-agent
237 %{_tmpfilesdir}/%{name}-agent.conf
238 %config(noreplace) %{_sysconfdir}/logrotate.d/%{name}-agent
239 %config(noreplace) %{_sysconfdir}/%{name}/%{name}_agent.conf
240 %config(noreplace) %{_sysconfdir}/%{name}/%{name}_agentd.conf
241 %attr(0755,%{name},%{name}) %dir %{_localstatedir}/log/%{name}
242
243 %files web
244 %doc README
245 %dir %{_sysconfdir}/%{name}
246 %config(noreplace) %{_sysconfdir}/%{name}/db.inc.php
247 %config(noreplace) %{_sysconfdir}/httpd/conf.d/%{name}.conf
248 %{_datadir}/%{name}/web

  ViewVC Help
Powered by ViewVC 1.1.30