zabbix-vl.spec 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543
  1. %define ver 4.0.15
  2. %define rel 1
  3. %define only_agent 0
  4. %if %{only_agent}
  5. %bcond_with server
  6. %bcond_with proxy
  7. %bcond_with frontend
  8. %else
  9. %bcond_without server
  10. %bcond_without proxy
  11. %bcond_without frontend
  12. %endif
  13. %bcond_without agent
  14. Summary: The Enterprise-class Monitoring Solution for Everyone
  15. Name: zabbix
  16. Version: %{ver}
  17. Release: %{rel}%{?_dist_release}
  18. License: GPLv2
  19. Group: Applications/Services
  20. URL: https://www.zabbix.com/
  21. Source0: https://downloads.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/%{version}/%{name}-%{version}.tar.gz
  22. Source1: zabbix_server.init
  23. Source2: zabbix_proxy.init
  24. Source3: zabbix_agentd.init
  25. Source4: zabbix_server.logrotate
  26. Source5: zabbix_proxy.logrotate
  27. Source6: zabbix_agentd.logrotate
  28. Patch1: 0001-change-the-font-for-Vine-Linux.patch
  29. Patch2: 0002-modified-config-files-for-Vine-Linux.patch
  30. Patch3: zabbix-4.0.15-php74.patch
  31. BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
  32. %if %{with server}%{with proxy}
  33. BuildRequires: libpq-devel
  34. BuildRequires: libmariadb-devel
  35. %endif
  36. BuildRequires: libevent-devel
  37. BuildRequires: pcre-devel
  38. BuildRequires: curl-devel
  39. BuildRequires: net-snmp-devel
  40. BuildRequires: OpenIPMI-devel
  41. BuildRequires: unixODBC-devel
  42. BuildRequires: libssh2-devel
  43. Requires(pre): glibc-common
  44. Requires(pre): shadow-utils
  45. Vendor: Project Vine
  46. Distribution: Vine Linux
  47. Packager: iwaim
  48. %description
  49. The Enterprise-class Monitoring Solution for Everyone.
  50. %if %{with server}
  51. %package server-common
  52. Summary: common files for Zabbix Server
  53. Requires: %{name} == %{version}-%{release}
  54. Requires(post,preun): chkconfig
  55. Requires(preun,postun): initscripts
  56. %description server-common
  57. This package include common files for Zabbix Server.
  58. %package server-mysql
  59. Summary: Zabbix Server for MySQL/MariaDB
  60. Provides: %{name}-server
  61. Requires: %{name}-server-common == %{version}-%{release}
  62. %description server-mysql
  63. Zabbix Server for MySQL/MariaDB
  64. %package server-postgresql
  65. Summary: Zabbix Server for PostgreSQL
  66. Provides: %{name}-server
  67. Requires: %{name}-server-common == %{version}-%{release}
  68. %description server-postgresql
  69. Zabbix Server for PostgreSQL
  70. %endif
  71. %if %{with agent}
  72. %package agent
  73. Summary: Zabbix Agent
  74. Requires: %{name} == %{version}-%{release}
  75. Requires(post,preun): chkconfig
  76. Requires(preun,postun): initscripts
  77. %description agent
  78. Zabbix Agent
  79. %endif
  80. %if %{with proxy}
  81. %package proxy-common
  82. Summary: common files for Zabbix Proxy
  83. Requires: %{name} == %{version}-%{release}
  84. Requires(post,preun): chkconfig
  85. Requires(preun,postun): initscripts
  86. %description proxy-common
  87. This package include common files for Zabbix Proxy
  88. %package proxy-mysql
  89. Summary: Zabbix Proxy for MySQL/MariaDB
  90. Provides: %{name}-proxy
  91. Requires: %{name}-proxy-common == %{version}-%{release}
  92. %description proxy-mysql
  93. Zabbix Proxy for MySQL/MariaDB
  94. %package proxy-postgresql
  95. Summary: Zabbix Proxy for PostgreSQL
  96. Provides: %{name}-proxy
  97. Requires: %{name}-proxy-common == %{version}-%{release}
  98. %description proxy-postgresql
  99. Zabbix Proxy for PostgreSQL
  100. %endif
  101. %if %{with frontend}
  102. %package frontend-php
  103. Summary: Zabbix web frontend with PHP
  104. Group: Applications/Internet
  105. Requires: php5
  106. Requires: TrueType-vlgothic
  107. %description frontend-php
  108. Zabbix web frontend with PHP.
  109. %package frontend-php-mysql
  110. Summary: Zabbix web frontend with PHP and MySQL/MariaDB
  111. Group: Applications/Internet
  112. Provides: %{name}-frontend-php == %{version}-%{release}
  113. Requires: php5-mysql
  114. %description frontend-php-mysql
  115. Zabbix web frontend with PHP and MySQL/MariaDB.
  116. %package frontend-php-postgresql
  117. Summary: Zabbix web frontend with PHP and PostgreSQL
  118. Group: Applications/Internet
  119. Provides: %{name}-frontend-php == %{version}-%{release}
  120. Requires: php5-pgsql
  121. %description frontend-php-postgresql
  122. Zabbix web frontend with PHP and PostgreSQL.
  123. %endif
  124. %prep
  125. %setup -q -T -a 0 -c -n zabbix-%{version}
  126. mv zabbix-%{version} zabbix_mysql
  127. pushd zabbix_mysql
  128. %patch1 -p 1
  129. %patch2 -p 1
  130. %patch3 -p 1
  131. popd
  132. %if %{with server}%{with proxy}
  133. %setup -q -D -T -a 0 -n zabbix-%{version}
  134. mv zabbix-%{version} zabbix_pgsql
  135. pushd zabbix_pgsql
  136. %patch1 -p 1
  137. %patch2 -p 1
  138. %patch3 -p 1
  139. popd
  140. %endif
  141. %build
  142. Build()
  143. {
  144. perl -pi -e 's|/usr/bin/traceroute|/bin/traceroute|' \
  145. ./database/{ibm_db2,mysql,oracle,postgresql,sqlite3}/data.sql
  146. %configure \
  147. %{?with_server:--enable-server} \
  148. %{?with_proxy:--enable-proxy} \
  149. %{?with_agent:--enable-agent} \
  150. --enable-ipv6 \
  151. --sysconfdir=%{_sysconfdir}/zabbix \
  152. --with-libcurl \
  153. --with-openipmi \
  154. --with-net-snmp \
  155. --with-unixodbc \
  156. --with-ssh2 \
  157. $@
  158. %__make
  159. }
  160. %if %{with server}%{with proxy}
  161. pushd zabbix_mysql
  162. Build --with-mysql
  163. popd
  164. pushd zabbix_pgsql
  165. Build --with-postgresql
  166. popd
  167. %else
  168. pushd zabbix_mysql
  169. Build
  170. popd
  171. %endif
  172. %install
  173. %__rm -rf $RPM_BUILD_ROOT
  174. pushd zabbix_mysql
  175. make DESTDIR=$RPM_BUILD_ROOT install
  176. %if %{with server}
  177. mv -f %{buildroot}%{_sbindir}/zabbix_server %{buildroot}%{_sbindir}/zabbix_server.mysql
  178. %endif
  179. %if %{with proxy}
  180. mv -f %{buildroot}%{_sbindir}/zabbix_proxy %{buildroot}%{_sbindir}/zabbix_proxy.mysql
  181. %endif
  182. # make directories
  183. %__mkdir_p $RPM_BUILD_ROOT%{_localstatedir}/{log,run}/%{name}
  184. # DB
  185. %__mkdir_p $RPM_BUILD_ROOT%{_datadir}/zabbix
  186. %if %{with server}%{with proxy}
  187. %__cp -a database/postgresql $RPM_BUILD_ROOT%{_datadir}/zabbix/
  188. %__cp -a database/mysql $RPM_BUILD_ROOT%{_datadir}/zabbix/
  189. %endif
  190. # init.d
  191. %__mkdir_p $RPM_BUILD_ROOT%{_initddir}
  192. %if %{with server}
  193. %__cp %{SOURCE1} $RPM_BUILD_ROOT%{_initddir}/zabbix_server
  194. %endif
  195. %if %{with proxy}
  196. %__cp %{SOURCE2} $RPM_BUILD_ROOT%{_initddir}/zabbix_proxy
  197. %endif
  198. %if %{with agent}
  199. %__cp %{SOURCE3} $RPM_BUILD_ROOT%{_initddir}/zabbix_agentd
  200. %endif
  201. # logrotate
  202. %__mkdir_p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d
  203. %if %{with server}
  204. %__cp %{SOURCE4} $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/zabbix_server
  205. %endif
  206. %if %{with proxy}
  207. %__cp %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/zabbix_proxy
  208. %endif
  209. %if %{with agent}
  210. %__cp %{SOURCE6} $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/zabbix_agentd
  211. %endif
  212. %if %{with frontend}
  213. # frontend-php
  214. %__mkdir_p $RPM_BUILD_ROOT%{_datadir}/zabbix-frontend
  215. %__cp -a frontends/php $RPM_BUILD_ROOT%{_datadir}/zabbix-frontend/
  216. %__rm -f $RPM_BUILD_ROOT%{_datadir}/zabbix-frontend/php/assets/fonts/DejaVuSans.ttf
  217. ln -s /usr/share/fonts/TrueType-vlgothic/VL-Gothic-Regular.ttf \
  218. $RPM_BUILD_ROOT%{_datadir}/zabbix-frontend/php/assets/fonts/
  219. %endif
  220. %if %{with proxy}
  221. # proxy
  222. mkdir -p %{buildroot}%{_datadir}/zabbix-proxy
  223. ln -sf ../zabbix/mysql %{buildroot}%{_datadir}/zabbix-proxy/
  224. ln -sf ../zabbix/postgresql %{buildroot}%{_datadir}/zabbix-proxy/
  225. %endif
  226. popd
  227. %if %{with server}%{with proxy}
  228. pushd zabbix_pgsql
  229. install -m755 src/zabbix_server/zabbix_server %{buildroot}%{_sbindir}/zabbix_server.pgsql
  230. install -m755 src/zabbix_proxy/zabbix_proxy %{buildroot}%{_sbindir}/zabbix_proxy.pgsql
  231. popd
  232. %endif
  233. %clean
  234. %__rm -rf $RPM_BUILD_ROOT
  235. %pre
  236. getent group zabbix >/dev/null || groupadd -r zabbix
  237. getent passwd zabbix >/dev/null || \
  238. useradd -r -g zabbix -d %{_sysconfdir}/zabbix -s /sbin/nologin \
  239. -c "Zabbix Monitoring Solution" zabbix
  240. exit 0
  241. %if %{with server}
  242. %post server-mysql
  243. /sbin/update-alternatives --install /usr/sbin/zabbix_server \
  244. zabbix_server /usr/sbin/zabbix_server.mysql 10
  245. /sbin/chkconfig --add zabbix_server
  246. %post server-postgresql
  247. /sbin/update-alternatives --install /usr/sbin/zabbix_server \
  248. zabbix_server /usr/sbin/zabbix_server.pgsql 10
  249. /sbin/chkconfig --add zabbix_server
  250. %endif
  251. %if %{with proxy}
  252. %post proxy-mysql
  253. /sbin/update-alternatives --install /usr/sbin/zabbix_proxy \
  254. zabbix_proxy /usr/sbin/zabbix_proxy.mysql 10
  255. /sbin/chkconfig --add zabbix_proxy
  256. %post proxy-postgresql
  257. /sbin/update-alternatives --install /usr/sbin/zabbix_proxy \
  258. zabbix_proxy /usr/sbin/zabbix_proxy.pgsql 10
  259. /sbin/chkconfig --add zabbix_proxy
  260. %endif
  261. %if %{with agent}
  262. %post agent
  263. /sbin/chkconfig --add zabbix_agentd
  264. %endif
  265. %if %{with server}
  266. %preun server-mysql
  267. if [ "$1" -eq 0 ]; then
  268. /sbin/service zabbix_server stop >/dev/null 2>&1
  269. /sbin/chkconfig --del zabbix_server
  270. /sbin/update-alternatives --remove zabbix_server \
  271. /usr/sbin/zabbix_server.mysql
  272. fi
  273. %preun server-postgresql
  274. if [ "$1" -eq 0 ]; then
  275. /sbin/service zabbix_server stop >/dev/null 2>&1
  276. /sbin/chkconfig --del zabbix_server
  277. /sbin/update-alternatives --remove zabbix_server \
  278. /usr/sbin/zabbix_server.pgsql
  279. fi
  280. %endif
  281. %if %{with proxy}
  282. %preun proxy-mysql
  283. if [ "$1" -eq 0 ]; then
  284. /sbin/service zabbix_proxy stop >/dev/null 2>&1
  285. /sbin/chkconfig --del zabbix_proxy
  286. /sbin/update-alternatives --remove zabbix_proxy \
  287. /usr/sbin/zabbix_proxy.mysql
  288. fi
  289. %preun proxy-postgresql
  290. if [ "$1" -eq 0 ]; then
  291. /sbin/service zabbix_proxy stop >/dev/null 2>&1
  292. /sbin/chkconfig --del zabbix_proxy
  293. /sbin/update-alternatives --remove zabbix_proxy \
  294. /usr/sbin/zabbix_proxy.pgsql
  295. fi
  296. %endif
  297. %if %{with agent}
  298. %preun agent
  299. if [ "$1" -eq 0 ]; then
  300. /sbin/service zabbix_agentd stop >/dev/null 2>&1
  301. /sbin/chkconfig --del zabbix_agentd
  302. fi
  303. %endif
  304. %if %{with server}
  305. %postun server-mysql
  306. if [ "$1" -ge "1" ]; then
  307. /sbin/service zabbix_server condrestart >/dev/null 2>&1 || :
  308. fi
  309. %postun server-postgresql
  310. if [ "$1" -ge "1" ]; then
  311. /sbin/service zabbix_server condrestart >/dev/null 2>&1 || :
  312. fi
  313. %endif
  314. %if %{with proxy}
  315. %postun proxy-mysql
  316. if [ "$1" -ge "1" ]; then
  317. /sbin/service zabbix_proxy condrestart >/dev/null 2>&1 || :
  318. fi
  319. %postun proxy-postgresql
  320. if [ "$1" -ge "1" ]; then
  321. /sbin/service zabbix_proxy condrestart >/dev/null 2>&1 || :
  322. fi
  323. %postun agent
  324. if [ "$1" -ge "1" ]; then
  325. /sbin/service zabbix_agentd condrestart >/dev/null 2>&1 || :
  326. fi
  327. %endif
  328. %files
  329. %defattr(-,root,root,-)
  330. %license zabbix_mysql/COPYING
  331. %doc zabbix_mysql/AUTHORS zabbix_mysql/ChangeLog zabbix_mysql/NEWS zabbix_mysql/README
  332. %attr(0755,zabbix,zabbix) %dir %{_localstatedir}/log/%{name}
  333. %attr(0755,zabbix,zabbix) %dir %{_localstatedir}/run/%{name}
  334. %dir %{_datadir}/zabbix
  335. %if %{with server}%{with proxy}
  336. %{_datadir}/zabbix/mysql
  337. %{_datadir}/zabbix/postgresql
  338. %endif
  339. %if %{with server}
  340. %files server-common
  341. %defattr(-,root,root,-)
  342. %dir %{_sysconfdir}/zabbix
  343. %config(noreplace) %{_sysconfdir}/zabbix/zabbix_server.conf
  344. %config(noreplace) %{_sysconfdir}/logrotate.d/zabbix_server
  345. %{_initddir}/zabbix_server*
  346. %{_mandir}/man8/zabbix_server.8*
  347. %files server-mysql
  348. %defattr(-,root,root,-)
  349. %{_sbindir}/zabbix_server.mysql
  350. %files server-postgresql
  351. %defattr(-,root,root,-)
  352. %{_sbindir}/zabbix_server.pgsql
  353. %endif
  354. %if %{with agent}
  355. %files agent
  356. %defattr(-,root,root,-)
  357. %dir %{_sysconfdir}/zabbix
  358. %config(noreplace) %{_sysconfdir}/zabbix/zabbix_agentd.conf
  359. %config(noreplace) %{_sysconfdir}/logrotate.d/zabbix_agentd
  360. %{_bindir}/zabbix_get
  361. %{_bindir}/zabbix_sender
  362. %{_sbindir}/zabbix_agentd
  363. %{_initddir}/zabbix_agentd
  364. %{_mandir}/man1/zabbix_get.1*
  365. %{_mandir}/man1/zabbix_sender.1*
  366. %{_mandir}/man8/zabbix_agentd.8*
  367. %endif
  368. %if %{with proxy}
  369. %files proxy-common
  370. %defattr(-,root,root,-)
  371. %dir %{_sysconfdir}/zabbix
  372. %config(noreplace) %{_sysconfdir}/zabbix/zabbix_proxy.conf
  373. %config(noreplace) %{_sysconfdir}/logrotate.d/zabbix_proxy
  374. %{_initddir}/zabbix_proxy
  375. %{_mandir}/man8/zabbix_proxy.8*
  376. %{_datadir}/zabbix-proxy
  377. %files proxy-mysql
  378. %defattr(-,root,root,-)
  379. %{_sbindir}/zabbix_proxy.mysql
  380. %files proxy-postgresql
  381. %defattr(-,root,root,-)
  382. %{_sbindir}/zabbix_proxy.pgsql
  383. %endif
  384. %if %{with frontend}
  385. %files frontend-php
  386. %defattr(-,root,root,-)
  387. %license zabbix_mysql/COPYING
  388. %doc zabbix_mysql/AUTHORS zabbix_mysql/ChangeLog zabbix_mysql/NEWS zabbix_mysql/README
  389. %dir %{_datadir}/zabbix-frontend
  390. %{_datadir}/zabbix-frontend/php
  391. %files frontend-php-mysql
  392. %files frontend-php-postgresql
  393. %endif
  394. %changelog
  395. * Thu Dec 19 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 4.0.15-1
  396. - new upstream release.
  397. - imported Patch13 from upstream to support php74.
  398. * Thu Oct 17 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 4.0.13-1
  399. - new upstream release.
  400. - updated patches.
  401. * Wed May 08 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 4.0.7-1
  402. - new upstream release.
  403. - switched to 4.0 LTS.
  404. - dropped Patch0: made to get same effect by another method.
  405. - updated Patch1 and 2.
  406. * Wed Nov 07 2018 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.0.23-1
  407. - new upstream release.
  408. * Tue Jun 12 2018 IWAI, Masaharu <iwaim.sub@gmail.com> 3.0.13-2
  409. - accept building only agent
  410. * Thu Dec 21 2017 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.0.13-1
  411. - new upstream release.
  412. * Fri Apr 21 2017 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.0.8-1
  413. - new upstream release.
  414. * Fri Mar 18 2016 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.0.1-1
  415. - new upstream release.
  416. - disabled jabber support.
  417. * Wed Sep 9 2015 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.4.6-1
  418. - new upstream release.
  419. * Sat Apr 11 2015 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.2.9-1
  420. - new upstream release.
  421. * Sun Jul 6 2014 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.2.4-1
  422. - new upstream release.
  423. - built with both of mysql and postgresql.
  424. * Mon Oct 07 2013 Daisuke SUZUKI <daisuke@linux.or.jp> 2.0.8-1
  425. - update to 2.0.8
  426. * Wed Feb 20 2013 Daisuke SUZUKI <daisuke@linux.or.jp> 2.0.5-2
  427. - use %%bcond_with mysql to build with mysql
  428. * Tue Feb 19 2013 IWAI, Masaharu <iwai@alib.jp> 2.0.5-1
  429. - update to 2.0.5
  430. - add using MySQL client library switch: default no
  431. - define use_postfix and use_mysql
  432. - add BuildRequires: MySQL-devel
  433. - add configure option: --with-mysql
  434. * Thu Feb 7 2013 IWAI, Masaharu <iwai@alib.jp> 2.0.4-1
  435. - initial build for Vine Linux