zabbix-vl.spec 12 KB

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