/[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 389408 - (show annotations) (download)
Fri Jan 18 13:33:54 2013 UTC (11 years, 3 months ago) by colin
File size: 7642 byte(s)
Use standard macros for pre/post user and service management
1 %define _disable_ld_as_needed 1
2 %define _requires_exceptions pear
3
4 Name: zabbix
5 Version: 2.0.4
6 Release: %mkrel 2
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
17 %define database %{nil}
18 %define zdb %{nil}
19 %define with_postgresql %{?_with_postgresql: 1} %{?!_with_postgresql: 0}
20 #define with_mysql %{?_with_mysql: 1} %{?!_with_mysql: 0}
21 %define with_mysql %{?_without_mysql: 0} %{?!_without_mysql: 1}
22
23 # Zabbix can only be built with mysql -or- postgresql
24 # support. We build with mysql by default, but you can
25 # pass --with postgresql to build with postgresql instead.
26 %if %{with_postgresql}
27 %define database postgresql
28 %define zdb pgsql
29 %endif
30 %if %{with_mysql}
31 %define database mysql
32 %define zdb mysql
33 %endif
34
35 #if %{?database:1}%{!?database:0}
36 %if %{with_mysql} || %{with_postgresql}
37 BuildRequires: %{database}-devel
38 %endif
39 BuildRequires: net-snmp-devel
40 BuildRequires: openldap-devel, gnutls-devel
41 BuildRequires: libiksemel-devel
42 BuildRequires: libtasn1-devel
43 BuildRequires: curl-devel
44 BuildRequires: libssh2-devel
45 BuildRequires: openipmi-devel
46 Requires: logrotate, fping
47 Requires(pre): rpm-helper
48 Requires(post): rpm-helper
49 Requires(preun): rpm-helper
50
51 %description
52 Zabbix is the ultimate open source availability and performance monitoring
53 solution. Zabbix offers advanced monitoring, alerting, and visualization features
54 today which are missing in other monitoring systems, even some of the best
55 commercial ones.
56
57 %package agent
58 Summary: Zabbix Agent
59 Group: Networking/Other
60 Requires: logrotate
61 Requires(pre): rpm-helper
62 Requires(post): rpm-helper
63 Requires(preun): rpm-helper
64
65 %description agent
66 The zabbix client agent, to be installed on monitored systems.
67
68 %package web
69 Summary: Zabbix Web Frontend
70 Group: Networking/Other
71 Requires: apache-mod_php
72 Requires: php-bcmath
73 Requires: php-mbstring
74 Requires: php-gd
75 Requires: php-sockets
76 Requires: php-xml, php-xmlreader, php-xmlwriter
77 Requires: php-ctype
78 Requires: php-session
79 Requires: php-gettext
80 Requires: php-%{zdb}
81
82 %description web
83 The php frontend to display the zabbix web interface.
84
85 %prep
86 %setup -q
87 perl -pi -e 's/ -static//g' configure
88
89 # fix up some lib64 issues
90 %{__perl} -pi.orig -e 's|_LIBDIR=/usr/lib|_LIBDIR=%{_libdir}|g' \
91 configure
92
93 # fix up pt_br
94 %{__chmod} a-x frontends/php/include/locales/pt_br.inc.php ||:
95 %{__sed} -i 's/\r//' frontends/php/include/locales/pt_br.inc.php ||:
96
97 %build
98 %configure \
99 --enable-server \
100 --enable-agent \
101 --with-net-snmp \
102 --with-openipmi \
103 --with-ldap \
104 --with-libcurl \
105 --with-ssh2 \
106 --with-jabber \
107 --enable-ipv6 \
108 --enable-static=no \
109 %if %{with_mysql}
110 --with-mysql
111 %endif
112 %if %{with_postgresql}
113 --with-%{zdb}
114 %endif
115 %if !%{with_mysql} && !%{with_postgresql}
116 --with-sqlite3
117 %endif
118 #--disable-static
119 #--with-mysql \
120 #--with-mysql=%{_libdir}/mysql/mysql_config \
121 #--with-mysql=%{_bindir}/mysql_config
122
123 # --disable-static is partially broken atm,
124 # -static still gets into CFLAGS, so fix up in make
125 # (and even then, .a files still show their face...)
126 #find . -name Makefile -exec perl -pi -e 's/ -static//g' {} \;
127 %make
128 #make %{?_smp_mflags} CFLAGS="$RPM_OPT_FLAGS"
129
130 %install
131
132 # set up some required directories
133 mkdir -p %{buildroot}%{_sysconfdir}/%{name}
134 mkdir -p %{buildroot}%{_sysconfdir}/init.d
135 mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d
136 mkdir -p %{buildroot}%{_sysconfdir}/httpd/conf.d
137 mkdir -p %{buildroot}%{_datadir}/%{name}/schema
138 mkdir -p %{buildroot}%{_datadir}/%{name}/web
139 mkdir -p %{buildroot}%{_localstatedir}/log/%{name}
140 mkdir -p %{buildroot}%{_localstatedir}/run/%{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=%{_localstatedir}/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=%{_localstatedir}/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 # database schemata
180 cp -a database %{buildroot}/%{_datadir}/%{name}/schema
181 cp -a upgrades %{buildroot}/%{_datadir}/%{name}/schema
182 rm -f %{buildroot}/%{_datadir}/%{name}/schema/*/Makefile*
183
184 %makeinstall_std
185 rm -f %{buildroot}%{_sysconfdir}/%{name}*.conf
186 rm -rf %{buildroot}%{_libdir}/libzbx*.a
187
188 %pre
189 %_pre_useradd %{name} %{_localstatedir}/lib/%{name} /sbin/nologin
190
191 %pre agent
192 %_pre_useradd %{name} %{_localstatedir}/lib/%{name} /sbin/nologin
193
194 %post
195 %_post_service %{name}
196
197 %post agent
198 %_post_service %{name}-agent
199
200 %preun
201 %_preun_service %{name}
202
203 %preun agent
204 %_preun_service %{name}-agent
205
206 %clean
207
208 %files
209 %doc AUTHORS ChangeLog COPYING INSTALL NEWS README
210 %{_datadir}/%{name}/schema
211 %dir %{_sysconfdir}/%{name}
212 %{_sbindir}/%{name}_server
213 %{_sysconfdir}/init.d/%{name}
214 %{_mandir}/man8/%{name}_server.8*
215 %config(noreplace) %{_sysconfdir}/logrotate.d/zabbix
216 %config(noreplace) %{_sysconfdir}/%{name}/%{name}_server.conf
217 %attr(0755,%{name},%{name}) %dir %{_localstatedir}/log/%{name}
218 %attr(0755,%{name},%{name}) %dir %{_localstatedir}/run/%{name}
219
220 %files agent
221 %doc AUTHORS ChangeLog COPYING INSTALL NEWS README
222 %dir %{_sysconfdir}/%{name}
223 %{_bindir}/%{name}_sender
224 %{_bindir}/%{name}_get
225 %{_sbindir}/%{name}_agent
226 %{_sbindir}/%{name}_agentd
227 %{_mandir}/man1/%{name}_sender.1*
228 %{_mandir}/man1/%{name}_get.1*
229 %{_mandir}/man8/%{name}_agentd.8*
230 %{_sysconfdir}/init.d/%{name}-agent
231 %config(noreplace) %{_sysconfdir}/logrotate.d/%{name}-agent
232 %config(noreplace) %{_sysconfdir}/%{name}/%{name}_agent.conf
233 %config(noreplace) %{_sysconfdir}/%{name}/%{name}_agentd.conf
234 %attr(0755,%{name},%{name}) %dir %{_localstatedir}/log/%{name}
235 %attr(0755,%{name},%{name}) %dir %{_localstatedir}/run/%{name}
236
237 %files web
238 %doc README
239 %dir %{_sysconfdir}/%{name}
240 %config(noreplace) %{_sysconfdir}/%{name}/db.inc.php
241 %config(noreplace) %{_sysconfdir}/httpd/conf.d/%{name}.conf
242 %{_datadir}/%{name}/web

  ViewVC Help
Powered by ViewVC 1.1.30