zabbix-vl.spec 7.3 KB

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