From f8e249ff227af3c2e631ae212b37fca71253fa0a Mon Sep 17 00:00:00 2001 From: Daniel Steiner Date: Sat, 10 Dec 2022 00:32:48 +0100 Subject: [PATCH] Fixes for Zabbix build --- fedora/SPECS/zabbix-spec.patch | 121 ++++++++++++++++++++++++++++++++- fedora/SPECS/zabbix.spec | 43 ++---------- 2 files changed, 122 insertions(+), 42 deletions(-) diff --git a/fedora/SPECS/zabbix-spec.patch b/fedora/SPECS/zabbix-spec.patch index 1cad99f..51690c3 100644 --- a/fedora/SPECS/zabbix-spec.patch +++ b/fedora/SPECS/zabbix-spec.patch @@ -1,6 +1,6 @@ --- zabbix.spec.orig 2022-12-09 19:48:39.002443430 +0100 -+++ zabbix.spec 2022-12-09 19:48:48.360384315 +0100 -@@ -77,6 +77,21 @@ ++++ zabbix.spec 2022-12-10 00:24:50.399717359 +0100 +@@ -77,6 +77,22 @@ %{!?build_selinux_policy: %global build_selinux_policy 1} %endif @@ -15,10 +15,125 @@ +%global build_with_sqlite 1 +%global build_server 1 +%global build_proxy 1 ++%global build_selinux_policy 1 +BuildRequires: mysql-connector-odbc postgresql-odbc unixODBC unixODBC-devel -+BuildRequires: libssh2-devel net-snmp-devel postgresql-server-devel ++BuildRequires: libssh2-devel net-snmp-devel postgresql-server-devel gnutls-devel +# end owerwrite + # FIXME: Building debuginfo is broken on RHEL 5 & 8. Disabled for now. %if 0%{?rhel} <= 5 || 0%{?rhel} >= 8 %define debug_package %{nil} +@@ -90,7 +106,7 @@ + BuildRequires: make + %if 0%{?rhel} >= 8 + BuildRequires: mariadb-connector-c-devel +-BuildRequires: postgresql-devel >= 12.0 ++BuildRequires: postgresql-server-devel >= 13.0 + BuildRequires: sqlite-devel + BuildRequires: net-snmp-devel + BuildRequires: openldap-devel +@@ -499,21 +515,11 @@ + --with-libcurl + --with-openipmi + --with-unixodbc +-%if 0%{?rhel} >= 8 ++ --with-openssl + --with-ssh +-%else +- --with-ssh2 +-%endif + --with-libxml2 + --with-libevent +-%if 0%{?rhel} >= 7 + --with-libpcre2 +-%else +- --with-libpcre +-%endif +-%if 0%{?rhel} >= 6 +- --with-openssl +-%endif + " + + # setup pass 3 +@@ -661,14 +667,9 @@ + cat %{SOURCE3} | sed \ + -e 's|COMPONENT|agentd|g' \ + > $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/zabbix-agent +-%if 0%{?rhel} >= 7 + install -Dm 0644 -p %{SOURCE10} $RPM_BUILD_ROOT%{_unitdir}/zabbix-agent.service + install -Dm 0644 -p %{SOURCE15} $RPM_BUILD_ROOT%{_tmpfilesdir}/zabbix-agent.conf + %else +-install -Dm 0755 -p %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/init.d/zabbix-agent +-install -Dm 0644 -p %{SOURCE20} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/zabbix-agent +-%endif +-%else + %if 0%{?build_agent2} + rm $RPM_BUILD_ROOT%{_sbindir}/zabbix_agentd + rm $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/zabbix_agentd.conf +@@ -681,13 +682,8 @@ + -e 's|COMPONENT|agent2|g' \ + > $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/zabbix-agent2 + cp man/zabbix_agent2.man $RPM_BUILD_ROOT%{_mandir}/man8/zabbix_agent2.8 +-%if 0%{?rhel} >= 7 + install -Dm 0644 -p %{SOURCE19} $RPM_BUILD_ROOT%{_unitdir}/zabbix-agent2.service + install -Dm 0644 -p %{SOURCE15} $RPM_BUILD_ROOT%{_tmpfilesdir}/zabbix_agent2.conf +-%else +-install -Dm 0755 -p %{SOURCE21} $RPM_BUILD_ROOT%{_sysconfdir}/init.d/zabbix-agent2 +-install -Dm 0644 -p %{SOURCE22} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/zabbix-agent2 +-%endif + %endif + + +@@ -819,13 +815,8 @@ + %attr(0755,zabbix,zabbix) %dir %{_localstatedir}/run/zabbix + %{_sbindir}/zabbix_agentd + %{_mandir}/man8/zabbix_agentd.8* +-%if 0%{?rhel} >= 7 + %{_unitdir}/zabbix-agent.service + %{_tmpfilesdir}/zabbix-agent.conf +-%else +-%{_sysconfdir}/init.d/zabbix-agent +-%config(noreplace) %{_sysconfdir}/sysconfig/zabbix-agent +-%endif + + %files get + %defattr(-,root,root,-) +@@ -903,13 +894,8 @@ + %attr(0755,zabbix,zabbix) %dir %{_localstatedir}/run/zabbix + %{_sbindir}/zabbix_agent2 + %{_mandir}/man8/zabbix_agent2.8* +-%if 0%{?rhel} >= 7 + %{_unitdir}/zabbix-agent2.service + %{_tmpfilesdir}/zabbix_agent2.conf +-%else +-%{_sysconfdir}/init.d/zabbix-agent2 +-%config(noreplace) %{_sysconfdir}/sysconfig/zabbix-agent2 +-%endif + + %pre agent2 + getent group zabbix > /dev/null || groupadd -r zabbix +@@ -919,9 +905,7 @@ + : + + %post agent2 +-%if 0%{?rhel} >= 7 + %systemd_post zabbix-agent2.service +-%endif + # make sure that agent2 log file is create with proper attributes (ZBX-18243) + if [ $1 == 1 ] && [ ! -f %{_localstatedir}/log/zabbix/zabbix_agent2.log ]; then + touch %{_localstatedir}/log/zabbix/zabbix_agent2.log +@@ -929,14 +913,10 @@ + fi + : + +-%if 0%{?rhel} >= 7 + %preun agent2 + %systemd_preun zabbix-agent2.service + : + +-%postun agent2 +-%systemd_postun_with_restart zabbix-agent2.service +-%endif + %endif + + diff --git a/fedora/SPECS/zabbix.spec b/fedora/SPECS/zabbix.spec index cbc988b..f1cdebb 100644 --- a/fedora/SPECS/zabbix.spec +++ b/fedora/SPECS/zabbix.spec @@ -88,8 +88,9 @@ Buildroot: %{_tmppath}/zabbix-%{version}-%{release}-root-%(%{__id_u} -n) %global build_with_sqlite 1 %global build_server 1 %global build_proxy 1 +%global build_selinux_policy 1 BuildRequires: mysql-connector-odbc postgresql-odbc unixODBC unixODBC-devel -BuildRequires: libssh2-devel net-snmp-devel postgresql-server-devel +BuildRequires: libssh2-devel net-snmp-devel postgresql-server-devel gnutls-devel # end owerwrite # FIXME: Building debuginfo is broken on RHEL 5 & 8. Disabled for now. @@ -105,7 +106,7 @@ BuildRequires: libssh2-devel net-snmp-devel postgresql-server-devel BuildRequires: make %if 0%{?rhel} >= 8 BuildRequires: mariadb-connector-c-devel -BuildRequires: postgresql-devel >= 12.0 +BuildRequires: postgresql-server-devel >= 13.0 BuildRequires: sqlite-devel BuildRequires: net-snmp-devel BuildRequires: openldap-devel @@ -514,21 +515,11 @@ build_conf_common=" --with-libcurl --with-openipmi --with-unixodbc -%if 0%{?rhel} >= 8 + --with-openssl --with-ssh -%else - --with-ssh2 -%endif --with-libxml2 --with-libevent -%if 0%{?rhel} >= 7 --with-libpcre2 -%else - --with-libpcre -%endif -%if 0%{?rhel} >= 6 - --with-openssl -%endif " # setup pass 3 @@ -676,14 +667,9 @@ install -dm 755 $RPM_BUILD_ROOT%{_docdir}/zabbix-agent-%{version} cat %{SOURCE3} | sed \ -e 's|COMPONENT|agentd|g' \ > $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/zabbix-agent -%if 0%{?rhel} >= 7 install -Dm 0644 -p %{SOURCE10} $RPM_BUILD_ROOT%{_unitdir}/zabbix-agent.service install -Dm 0644 -p %{SOURCE15} $RPM_BUILD_ROOT%{_tmpfilesdir}/zabbix-agent.conf %else -install -Dm 0755 -p %{SOURCE5} $RPM_BUILD_ROOT%{_sysconfdir}/init.d/zabbix-agent -install -Dm 0644 -p %{SOURCE20} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/zabbix-agent -%endif -%else %if 0%{?build_agent2} rm $RPM_BUILD_ROOT%{_sbindir}/zabbix_agentd rm $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/zabbix_agentd.conf @@ -696,13 +682,8 @@ cat %{SOURCE3} | sed \ -e 's|COMPONENT|agent2|g' \ > $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/zabbix-agent2 cp man/zabbix_agent2.man $RPM_BUILD_ROOT%{_mandir}/man8/zabbix_agent2.8 -%if 0%{?rhel} >= 7 install -Dm 0644 -p %{SOURCE19} $RPM_BUILD_ROOT%{_unitdir}/zabbix-agent2.service install -Dm 0644 -p %{SOURCE15} $RPM_BUILD_ROOT%{_tmpfilesdir}/zabbix_agent2.conf -%else -install -Dm 0755 -p %{SOURCE21} $RPM_BUILD_ROOT%{_sysconfdir}/init.d/zabbix-agent2 -install -Dm 0644 -p %{SOURCE22} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/zabbix-agent2 -%endif %endif @@ -834,13 +815,8 @@ rm -rf $RPM_BUILD_ROOT %attr(0755,zabbix,zabbix) %dir %{_localstatedir}/run/zabbix %{_sbindir}/zabbix_agentd %{_mandir}/man8/zabbix_agentd.8* -%if 0%{?rhel} >= 7 %{_unitdir}/zabbix-agent.service %{_tmpfilesdir}/zabbix-agent.conf -%else -%{_sysconfdir}/init.d/zabbix-agent -%config(noreplace) %{_sysconfdir}/sysconfig/zabbix-agent -%endif %files get %defattr(-,root,root,-) @@ -918,13 +894,8 @@ fi %attr(0755,zabbix,zabbix) %dir %{_localstatedir}/run/zabbix %{_sbindir}/zabbix_agent2 %{_mandir}/man8/zabbix_agent2.8* -%if 0%{?rhel} >= 7 %{_unitdir}/zabbix-agent2.service %{_tmpfilesdir}/zabbix_agent2.conf -%else -%{_sysconfdir}/init.d/zabbix-agent2 -%config(noreplace) %{_sysconfdir}/sysconfig/zabbix-agent2 -%endif %pre agent2 getent group zabbix > /dev/null || groupadd -r zabbix @@ -934,9 +905,7 @@ getent passwd zabbix > /dev/null || \ : %post agent2 -%if 0%{?rhel} >= 7 %systemd_post zabbix-agent2.service -%endif # make sure that agent2 log file is create with proper attributes (ZBX-18243) if [ $1 == 1 ] && [ ! -f %{_localstatedir}/log/zabbix/zabbix_agent2.log ]; then touch %{_localstatedir}/log/zabbix/zabbix_agent2.log @@ -944,14 +913,10 @@ if [ $1 == 1 ] && [ ! -f %{_localstatedir}/log/zabbix/zabbix_agent2.log ]; then fi : -%if 0%{?rhel} >= 7 %preun agent2 %systemd_preun zabbix-agent2.service : -%postun agent2 -%systemd_postun_with_restart zabbix-agent2.service -%endif %endif