]> TLD Linux GIT Repositories - packages/zabbix.git/blobdiff - zabbix.spec
- (un)register server and proxy services on (un)install
[packages/zabbix.git] / zabbix.spec
index d4ea014c1572a3791fb57d8c9c903ee0f9dcd3d6..e6a47653b7c6efd76636f967d630d0646116f25e 100644 (file)
@@ -15,13 +15,15 @@ Summary:    Zabbix - network monitoring software
 Summary(pl.UTF-8):     Zabbix - oprogramowanie do monitorowania sieci
 Name:          zabbix
 Version:       5.0.7
-Release:       0.1
+Release:       0.3
 License:       GPL v2+
 Group:         Networking/Utilities
 Source0:       https://cdn.zabbix.com/zabbix/sources/stable/5.0/%{name}-%{version}.tar.gz
 # Source0-md5: e0798bb1b53ab7b451556dc34c3b1827
 Source1:       %{name}-apache.conf
 Source2:       %{name}_agentd.init
+Source3:       %{name}_server.init
+Source4:       %{name}_proxy.init
 Patch0:                tld.patch
 Patch1:                sqlite3_dbname.patch
 Patch2:                always_compile_ipc.patch
@@ -46,9 +48,14 @@ BuildRequires:       rpmbuild(macros) >= 1.671
 %{?with_sqlite3:BuildRequires: sqlite3-devel}
 BuildRequires: unixODBC-devel
 BuildRequires: zlib-devel
-Requires:      %{name}-agentd = %{version}-%{release}
-Requires:      %{name}-web = %{version}-%{release}
-Requires:      %{name}-server = %{version}-%{release}
+Requires(postun):      /usr/sbin/groupdel
+Requires(postun):      /usr/sbin/userdel
+Requires(pre): /bin/id
+Requires(pre): /usr/bin/getgid
+Requires(pre): /usr/sbin/groupadd
+Requires(pre): /usr/sbin/useradd
+Provides:      group(zabbix)
+Provides:      user(zabbix)
 BuildRoot:     %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %define                _sysconfdir     /etc/%{name}
@@ -76,32 +83,13 @@ dla praktycznie wszelkich zdarzeń. Monitorowane parametry są
 przechowywane w bazie danych. W oparciu o przechowywane dane Zabbix
 oferuje świetne raportowanie i funkcje wizualizacji. Wspiera zarówno
 odpytywanie jak i pułapkowanie. Dostęp do wszystkich raportów i
-statystyk Zabbiksa jest możliwy poprzez interfejs oparty o WWW.
-
-%package common
-Summary:       Common files for Zabbix monitoring software
-Summary(pl.UTF-8):     Wspólne pliki dla oprogramowania monitorującego Zabbix
-Group:         Networking/Utilities
-Requires(postun):      /usr/sbin/groupdel
-Requires(postun):      /usr/sbin/userdel
-Requires(pre): /bin/id
-Requires(pre): /usr/bin/getgid
-Requires(pre): /usr/sbin/groupadd
-Requires(pre): /usr/sbin/useradd
-Provides:      group(zabbix)
-Provides:      user(zabbix)
-
-%description common
-Common files for Zabbix monitoring software.
-
-%description common -l pl.UTF-8
-Wspólne pliki dla oprogramowania monitorującego Zabbix.
+statystyk Zabbixa jest możliwy poprzez interfejs oparty o WWW.
 
 %package agentd
 Summary:       Zabbix Agent
-Summary(pl.UTF-8):     Agenta Zabbiksa
+Summary(pl.UTF-8):     Agenta Zabbixa
 Group:         Networking/Utilities
-Requires:      %{name}-common = %{version}-%{release}
+Requires:      %{name} = %{version}-%{release}
 Obsoletes:     zabbix-agent-inetd
 Obsoletes:     zabbix-agent-standalone
 Requires(post,preun):  /sbin/chkconfig
@@ -115,7 +103,7 @@ Agent zbiera dane z lokalnej maszyny dla serwera Zabbix.
 
 %package web
 Summary:       Web frontend for Zabbix
-Summary(pl.UTF-8):     Interfejs Web dla Zabbiksa
+Summary(pl.UTF-8):     Interfejs Web dla Zabbixa
 Group:         Applications/WWW
 Requires:      php(bcmath)
 Requires:      php(core) >= %{php_min_version}
@@ -145,13 +133,13 @@ BuildArch:        noarch
 This package provides web based (PHP) frontend for Zabbix.
 
 %description web -l pl.UTF-8
-Ten pakiet dostarcza napisany w PHP frontend dla Zabbiksa.
+Ten pakiet dostarcza napisany w PHP frontend dla Zabbixa.
 
 %package proxy
 Summary:       Zabbix proxy
-Summary(pl.UTF-8):     Proxy do Zabbiksa
+Summary(pl.UTF-8):     Proxy do Zabbixa
 Group:         Networking/Utilities
-Requires:      %{name}-common = %{version}-%{release}
+Requires:      %{name} = %{version}-%{release}
 Requires:      zabbix-proxy(db) = %{version}-%{release}
 
 %description proxy
@@ -162,7 +150,7 @@ Ten pakiet zawiera proxy Zabbix.
 
 %package proxy-mysql
 Summary:       MySQL support for Zabbix proxy
-Summary(pl.UTF-8):     Obsługa MySQL dla proxy do Zabbiksa
+Summary(pl.UTF-8):     Obsługa MySQL dla proxy do Zabbixa
 Group:         Networking/Utilities
 Provides:      %{name}-proxy(db) = %{version}-%{release}
 Obsoletes:     zabbix-proxy-postgresql
@@ -176,7 +164,7 @@ Ten pakiet zawiera proxy Zabbix z obsługą MySQL.
 
 %package proxy-postgresql
 Summary:       PostgreSQL support for Zabbix proxy
-Summary(pl.UTF-8):     Obsługa PostgreSQL dla proxy do Zabbiksa
+Summary(pl.UTF-8):     Obsługa PostgreSQL dla proxy do Zabbixa
 Group:         Networking/Utilities
 Provides:      %{name}-proxy(db) = %{version}-%{release}
 Obsoletes:     zabbix-proxy-mysql
@@ -190,7 +178,7 @@ Ten pakiet zawiera proxy Zabbix z obsługą PostgreSQL.
 
 %package proxy-sqlite3
 Summary:       SQLite 3 support for Zabbix proxy
-Summary(pl.UTF-8):     Obsługa SQLite 3 dla proxy do Zabbiksa
+Summary(pl.UTF-8):     Obsługa SQLite 3 dla proxy do Zabbixa
 Group:         Networking/Utilities
 Provides:      %{name}-proxy(db) = %{version}-%{release}
 Obsoletes:     zabbix-proxy-mysql
@@ -204,9 +192,9 @@ Ten pakiet zawiera proxy Zabbix z obsługą SQLite 3.
 
 %package server
 Summary:       Zabbix server
-Summary(pl.UTF-8):     Serwer Zabbiksa
+Summary(pl.UTF-8):     Serwer Zabbixa
 Group:         Networking/Utilities
-Requires:      %{name}-common = %{version}-%{release}
+Requires:      %{name} = %{version}-%{release}
 Requires:      %{name}-server(db) = %{version}-%{release}
 Obsoletes:     zabbix-suckerd
 Obsoletes:     zabbix-trapper-inetd
@@ -216,11 +204,11 @@ Obsoletes:        zabbix-trapper-standalone
 This package provides the Zabbix server.
 
 %description server -l pl.UTF-8
-Ten pakiet zawiera serwer Zabbiksa.
+Ten pakiet zawiera serwer Zabbixa.
 
 %package server-mysql
 Summary:       MySQL support for Zabbix server
-Summary(pl.UTF-8):     Obsługa MySQL sla serwera Zabbiksa
+Summary(pl.UTF-8):     Obsługa MySQL sla serwera Zabbixa
 Group:         Networking/Utilities
 Provides:      %{name}-server(db) = %{version}-%{release}
 Obsoletes:     zabbix-server-postgresql
@@ -231,11 +219,11 @@ This package provides the Zabbix server binary for use with MySQL
 database.
 
 %description server-mysql -l pl.UTF-8
-Ten pakiet zawiera serwer Zabbiksa z obsługą bazy danych MySQL.
+Ten pakiet zawiera serwer Zabbixa z obsługą bazy danych MySQL.
 
 %package server-postgresql
 Summary:       PostgreSQL support for Zabbix server
-Summary(pl.UTF-8):     Obsługa PostgreSQL sla serwera Zabbiksa
+Summary(pl.UTF-8):     Obsługa PostgreSQL sla serwera Zabbixa
 Group:         Networking/Utilities
 Provides:      %{name}-server(db) = %{version}-%{release}
 Obsoletes:     zabbix-server-mysql
@@ -246,12 +234,12 @@ This package provides the Zabbix server binary for use with PostgreSQL
 database.
 
 %description server-postgresql -l pl.UTF-8
-Ten pakiet zawiera serwer Zabbiksa z obsługą bazy danych PostgreSQL.
+Ten pakiet zawiera serwer Zabbixa z obsługą bazy danych PostgreSQL.
 
 %package java
 Summary:       Zabbix Java Gateway
 Group:         Networking/Utilities
-Requires:      %{name}-common = %{version}-%{release}
+Requires:      %{name} = %{version}-%{release}
 
 %description java
 This package provides the Zabbix Java Gateway.
@@ -346,6 +334,8 @@ cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/apache.conf
 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_webapps}/%{_webapp}/httpd.conf
 
 install        %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/zabbix_agentd
+install        %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/zabbix_server
+install        %{SOURCE4} $RPM_BUILD_ROOT/etc/rc.d/init.d/zabbix_proxy
 
 mv $RPM_BUILD_ROOT%{_appdir}/ui/conf $RPM_BUILD_ROOT%{_sysconfdir}/web
 ln -s %{_sysconfdir}/web $RPM_BUILD_ROOT%{_appdir}/ui/conf
@@ -381,12 +371,12 @@ rm -rf $RPM_BUILD_ROOT
 %triggerun web -- apache < 2.2.0, apache-base
 %webapp_unregister httpd %{_webapp}
 
-%pre common
+%pre
 %groupadd -g 111 zabbix
 %useradd -d / -u 111 -g zabbix -c "Zabbix User" -s /bin/false zabbix
 %addusertogroup -q zabbix proc
 
-%postun common
+%postun
 if [ "$1" = "0" ]; then
        %userremove zabbix
        %groupremove zabbix
@@ -398,6 +388,7 @@ if [ "$1" = 1 ]; then
        You should create database for Zabbix.
 
        Running these should be fine in most cases:
+
        mysqladmin create zabbix
        zcat %{_docdir}/%{name}-server-mysql-%{version}/schema.sql.gz | mysql zabbix
        zcat %{_docdir}/%{name}-server-mysql-%{version}/images.sql.gz | mysql zabbix
@@ -413,16 +404,24 @@ if [ "$1" = 1 ]; then
 
        Running these should be fine in most cases:
 
-       createuser zabbix
-       createdb -O zabbix zabbix
-       zcat %{_docdir}/%{name}-server-postgresql-%{version}/schema.sql.gz | psql -u zabbix zabbix
-       zcat %{_docdir}/%{name}-server-postgresql-%{version}/images.sql.gz | psql -u zabbix zabbix
-       zcat %{_docdir}/%{name}-server-postgresql-%{version}/data.sql.gz | psql -u zabbix zabbix
+       createuser -U postgres zabbix
+       createdb -U postgres -O zabbix zabbix
+       zcat %{_docdir}/%{name}-server-postgresql-%{version}/schema.sql.gz | psql -U zabbix zabbix
+       zcat %{_docdir}/%{name}-server-postgresql-%{version}/images.sql.gz | psql -U zabbix zabbix
+       zcat %{_docdir}/%{name}-server-postgresql-%{version}/data.sql.gz | psql -U zabbix zabbix
 EOF
 fi
 ln -sf %{_sbindir}/zabbix_server-postgresql %{_sbindir}/zabbix_server || :
 
+%post server
+/sbin/chkconfig --add zabbix_server
+%service zabbix_server restart
+
 %postun server
+if [ "$1" = "0" ]; then
+       %service -q zabbix_server stop
+       /sbin/chkconfig --del zabbix_server
+fi
 if [ "$1" = "0" ]; then
        if [ -L %{_sbindir}/zabbix_server ] ; then
                rm -f %{_sbindir}/zabbix_server || :
@@ -448,11 +447,22 @@ ln -sf %{_sbindir}/zabbix_proxy-postgresql %{_sbindir}/zabbix_proxy || :
 %post proxy-sqlite3
 ln -sf %{_sbindir}/zabbix_proxy-sqlite3 %{_sbindir}/zabbix_proxy || :
 
-%files
-%defattr(644,root,root,755)
-%doc AUTHORS ChangeLog README
+%post proxy
+/sbin/chkconfig --add zabbix_server
+%service zabbix_server restart
+
+%postun proxy
+if [ "$1" = "0" ]; then
+       %service -q zabbix_proxy stop
+       /sbin/chkconfig --del zabbix_proxy
+fi
+if [ "$1" = "0" ]; then
+       if [ -L %{_sbindir}/zabbix_proxy ] ; then
+               rm -f %{_sbindir}/zabbix_proxy || :
+       fi
+fi
 
-%files common
+%files
 %defattr(644,root,root,755)
 %doc AUTHORS ChangeLog README
 %attr(755,root,root) %{_bindir}/zabbix_get
@@ -491,6 +501,7 @@ ln -sf %{_sbindir}/zabbix_proxy-sqlite3 %{_sbindir}/zabbix_proxy || :
 %defattr(644,root,root,755)
 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_proxy.conf
 %dir %attr(751,root,zabbix) %{_sysconfdir}/zabbix_proxy.conf.d
+%attr(754,root,root) /etc/rc.d/init.d/zabbix_proxy
 %ghost %attr(755,root,root) %{_sbindir}/zabbix_proxy
 %{_mandir}/man8/zabbix_proxy*
 %endif
@@ -519,6 +530,7 @@ ln -sf %{_sbindir}/zabbix_proxy-sqlite3 %{_sbindir}/zabbix_proxy || :
 %defattr(644,root,root,755)
 %attr(640,root,zabbix) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zabbix_server.conf
 %dir %attr(751,root,zabbix) %{_sysconfdir}/zabbix_server.conf.d
+%attr(754,root,root) /etc/rc.d/init.d/zabbix_server
 %ghost %attr(755,root,root) %{_sbindir}/zabbix_server
 %{_mandir}/man8/zabbix_server*
 %endif