zabbix-vl.spec 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. %define ver 2.0.5
  2. %define rel 1
  3. # zabbix accept the only one database.
  4. %define use_postgresql 1
  5. %define use_mysql 0
  6. Summary: The Enterprise-class Monitoring Solution for Everyone
  7. Name: zabbix
  8. Version: %{ver}
  9. Release: %{rel}%{?_dist_release}
  10. License: GPLv2
  11. Group: Applications/Services
  12. URL: https://www.zabbix.com/
  13. Source0: %{name}-%{version}.tar.gz
  14. Source1: zabbix_server.init
  15. Source2: zabbix_proxy.init
  16. Source3: zabbix_agentd.init
  17. Source4: zabbix_server.logrotate
  18. Source5: zabbix_proxy.logrotate
  19. Source6: zabbix_agentd.logrotate
  20. Patch0: zabbix-2.0.4-vine_path.patch
  21. Patch1: zabbix-2.0.4-font.patch
  22. Patch2: zabbix-2.0.4-config.patch
  23. BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
  24. %if %{use_postgresql}
  25. BuildRequires: postgresql-devel
  26. %else
  27. %if %{use_mysql}
  28. BuildRequires: MySQL-devel
  29. %endif
  30. %endif
  31. BuildRequires: curl-devel
  32. BuildRequires: net-snmp-devel
  33. BuildRequires: OpenIPMI-devel
  34. BuildRequires: iksemel-devel
  35. BuildRequires: unixODBC-devel
  36. BuildRequires: libssh2-devel
  37. Requires(pre): glibc-common
  38. Requires(pre): shadow-utils
  39. Vendor: Project Vine
  40. Distribution: Vine Linux
  41. Packager: iwaim
  42. %description
  43. The Enterprise-class Monitoring Solution for Everyone.
  44. %package server
  45. Summary: Zabbix Server
  46. Requires: %{name} == %{version}-%{release}
  47. Requires(post,preun): chkconfig
  48. Requires(preun,postun): initscripts
  49. %description server
  50. Zabbix Server
  51. %package agent
  52. Summary: Zabbix Agent
  53. Requires: %{name} == %{version}-%{release}
  54. Requires(post,preun): chkconfig
  55. Requires(preun,postun): initscripts
  56. %description agent
  57. Zabbix Agent
  58. %package proxy
  59. Summary: Zabbix Proxy
  60. Requires: %{name} == %{version}-%{release}
  61. Requires(post,preun): chkconfig
  62. Requires(preun,postun): initscripts
  63. %description proxy
  64. Zabbix Proxy
  65. %package frontend-php
  66. Summary: Zabbix web frontend with PHP
  67. Group: Applications/Internet
  68. Requires: php5
  69. %if %{use_postgresql}
  70. Requires: php5-pgsql
  71. %else
  72. %if %{use_mysql}
  73. Requires: php5-mysql
  74. %endif
  75. %endif
  76. Requires: TrueType-vlgothic
  77. %description frontend-php
  78. Zabbix web frontend with PHP.
  79. %prep
  80. %setup -q
  81. %patch0 -p 1
  82. %patch1 -p 1
  83. %patch2 -p 1
  84. %build
  85. %configure --enable-server --enable-proxy --enable-agent --enable-ipv6 \
  86. --sysconfdir=%{_sysconfdir}/zabbix \
  87. %if %{use_postgresql}
  88. --with-postgresql \
  89. %else
  90. %if %{use_mysql}
  91. --with-mysql \
  92. %endif
  93. %endif
  94. --with-libcurl \
  95. --with-openipmi \
  96. --with-net-snmp \
  97. --with-jabber \
  98. --with-unixodbc \
  99. --with-ssh2
  100. %__make
  101. %install
  102. %__rm -rf $RPM_BUILD_ROOT
  103. make DESTDIR=$RPM_BUILD_ROOT install
  104. # make directories
  105. %__mkdir_p $RPM_BUILD_ROOT%{_localstatedir}/{log,run}/%{name}
  106. # DB
  107. %__mkdir_p $RPM_BUILD_ROOT%{_datadir}/zabbix
  108. %if %{use_postgresql}
  109. %__cp -a database/postgresql $RPM_BUILD_ROOT%{_datadir}/zabbix/
  110. %else
  111. %if %{use_mysql}
  112. %__cp -a database/mysql $RPM_BUILD_ROOT%{_datadir}/zabbix/
  113. %endif
  114. %endif
  115. # init.d
  116. %__mkdir_p $RPM_BUILD_ROOT%{_initddir}
  117. %__cp %{SOURCE1} $RPM_BUILD_ROOT%{_initddir}/zabbix_server
  118. %__cp %{SOURCE2} $RPM_BUILD_ROOT%{_initddir}/zabbix_proxy
  119. %__cp %{SOURCE3} $RPM_BUILD_ROOT%{_initddir}/zabbix_agentd
  120. # logrotate
  121. %__mkdir_p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d
  122. %__cp %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/zabbix_server
  123. %__cp %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/zabbix_proxy
  124. %__cp %{SOURCE6} $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/zabbix_agentd
  125. ## sub package
  126. # proxy
  127. %__mkdir_p $RPM_BUILD_ROOT%{_datadir}/zabbix-proxy
  128. %if %{use_postgresql}
  129. ln -s %{_datadir}/zabbix/postgresql $RPM_BUILD_ROOT%{_datadir}/zabbix-proxy/
  130. %else
  131. %if %{use_mysql}
  132. ln -s %{_datadir}/zabbix/mysql $RPM_BUILD_ROOT%{_datadir}/zabbix-proxy/
  133. %endif
  134. %endif
  135. # frontend-php
  136. %__mkdir_p $RPM_BUILD_ROOT%{_datadir}/zabbix-frontend
  137. %__cp -a frontends/php $RPM_BUILD_ROOT%{_datadir}/zabbix-frontend/
  138. %__rm -f $RPM_BUILD_ROOT%{_datadir}/zabbix-frontend/php/fonts/DejaVuSans.ttf
  139. ln -s /usr/share/fonts/TrueType-vlgothic/VL-Gothic-Regular.ttf \
  140. $RPM_BUILD_ROOT%{_datadir}/zabbix-frontend/php/fonts/
  141. %clean
  142. %__rm -rf $RPM_BUILD_ROOT
  143. %pre
  144. getent group zabbix >/dev/null || groupadd -r zabbix
  145. getent passwd zabbix >/dev/null || \
  146. useradd -r -g zabbix -d %{_sysconfdir}/zabbix -s /sbin/nologin \
  147. -c "Zabbix Monitoring Solution" zabbix
  148. exit 0
  149. %post server
  150. /sbin/chkconfig --add zabbix_server
  151. %post proxy
  152. /sbin/chkconfig --add zabbix_proxy
  153. %post agent
  154. /sbin/chkconfig --add zabbix_agentd
  155. %preun server
  156. if [ "$1" -eq 0 ]; then
  157. /sbin/service zabbix_server stop >/dev/null 2>&1
  158. /sbin/chkconfig --del zabbix_server
  159. fi
  160. %preun proxy
  161. if [ "$1" -eq 0 ]; then
  162. /sbin/service zabbix_proxy stop >/dev/null 2>&1
  163. /sbin/chkconfig --del zabbix_proxy
  164. fi
  165. %preun agent
  166. if [ "$1" -eq 0 ]; then
  167. /sbin/service zabbix_agentd stop >/dev/null 2>&1
  168. /sbin/chkconfig --del zabbix_agentd
  169. fi
  170. %postun server
  171. if [ "$1" -ge "1" ]; then
  172. /sbin/service zabbix_server condrestart >/dev/null 2>&1 || :
  173. fi
  174. %postun proxy
  175. if [ "$1" -ge "1" ]; then
  176. /sbin/service zabbix_proxy condrestart >/dev/null 2>&1 || :
  177. fi
  178. %postun agent
  179. if [ "$1" -ge "1" ]; then
  180. /sbin/service zabbix_agentd condrestart >/dev/null 2>&1 || :
  181. fi
  182. %files
  183. %defattr(-,root,root,-)
  184. %doc AUTHORS COPYING ChangeLog NEWS README
  185. %attr(0755,zabbix,zabbix) %dir %{_localstatedir}/log/%{name}
  186. %attr(0755,zabbix,zabbix) %dir %{_localstatedir}/run/%{name}
  187. %dir %{_datadir}/zabbix
  188. %if %{use_postgresql}
  189. %{_datadir}/zabbix/postgresql
  190. %else
  191. %if %{use_mysql}
  192. %{_datadir}/zabbix/mysql
  193. %endif
  194. %endif
  195. %files server
  196. %defattr(-,root,root,-)
  197. %dir %{_sysconfdir}/zabbix
  198. %config(noreplace) %{_sysconfdir}/zabbix/zabbix_server.conf
  199. %config(noreplace) %{_sysconfdir}/logrotate.d/zabbix_server
  200. %{_sbindir}/zabbix_server
  201. %{_initddir}/zabbix_server*
  202. %{_mandir}/man8/zabbix_server.8*
  203. %files agent
  204. %defattr(-,root,root,-)
  205. %dir %{_sysconfdir}/zabbix
  206. %config(noreplace) %{_sysconfdir}/zabbix/zabbix_agent.conf
  207. %config(noreplace) %{_sysconfdir}/zabbix/zabbix_agentd.conf
  208. %config(noreplace) %{_sysconfdir}/logrotate.d/zabbix_agentd
  209. %{_bindir}/zabbix_get
  210. %{_bindir}/zabbix_sender
  211. %{_sbindir}/zabbix_agent
  212. %{_sbindir}/zabbix_agentd
  213. %{_initddir}/zabbix_agentd
  214. %{_mandir}/man1/zabbix_get.1*
  215. %{_mandir}/man1/zabbix_sender.1*
  216. %{_mandir}/man8/zabbix_agentd.8*
  217. %files proxy
  218. %defattr(-,root,root,-)
  219. %dir %{_sysconfdir}/zabbix
  220. %config(noreplace) %{_sysconfdir}/zabbix/zabbix_proxy.conf
  221. %config(noreplace) %{_sysconfdir}/logrotate.d/zabbix_proxy
  222. %{_sbindir}/zabbix_proxy
  223. %{_initddir}/zabbix_proxy
  224. %{_mandir}/man8/zabbix_proxy.8*
  225. %dir %{_datadir}/zabbix-proxy
  226. %if %{use_postgresql}
  227. %{_datadir}/zabbix-proxy/postgresql
  228. %else
  229. %if %{use_mysql}
  230. %{_datadir}/zabbix-proxy/mysql
  231. %endif
  232. %endif
  233. %files frontend-php
  234. %defattr(-,root,root,-)
  235. %doc AUTHORS COPYING ChangeLog NEWS README
  236. %dir %{_datadir}/zabbix-frontend
  237. %{_datadir}/zabbix-frontend/php
  238. %changelog
  239. * Tue Feb 19 2013 IWAI, Masaharu <iwai@alib.jp> 2.0.5-1
  240. - update to 2.0.5
  241. - add using MySQL client library switch: default no
  242. - define use_postfix and use_mysql
  243. - add BuildRequires: MySQL-devel
  244. - add configure option: --with-mysql
  245. * Thu Feb 7 2013 IWAI, Masaharu <iwai@alib.jp> 2.0.4-1
  246. - initial build for Vine Linux