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

  ViewVC Help
Powered by ViewVC 1.1.30