Fixes for Zabbix build

This commit is contained in:
2022-12-10 00:32:48 +01:00
parent 2e9034a167
commit f8e249ff22
2 changed files with 122 additions and 42 deletions

View File

@@ -1,6 +1,6 @@
--- zabbix.spec.orig 2022-12-09 19:48:39.002443430 +0100 --- zabbix.spec.orig 2022-12-09 19:48:39.002443430 +0100
+++ zabbix.spec 2022-12-09 19:48:48.360384315 +0100 +++ zabbix.spec 2022-12-10 00:24:50.399717359 +0100
@@ -77,6 +77,21 @@ @@ -77,6 +77,22 @@
%{!?build_selinux_policy: %global build_selinux_policy 1} %{!?build_selinux_policy: %global build_selinux_policy 1}
%endif %endif
@@ -15,10 +15,125 @@
+%global build_with_sqlite 1 +%global build_with_sqlite 1
+%global build_server 1 +%global build_server 1
+%global build_proxy 1 +%global build_proxy 1
+%global build_selinux_policy 1
+BuildRequires: mysql-connector-odbc postgresql-odbc unixODBC unixODBC-devel +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 +# end owerwrite
+ +
# FIXME: Building debuginfo is broken on RHEL 5 & 8. Disabled for now. # FIXME: Building debuginfo is broken on RHEL 5 & 8. Disabled for now.
%if 0%{?rhel} <= 5 || 0%{?rhel} >= 8 %if 0%{?rhel} <= 5 || 0%{?rhel} >= 8
%define debug_package %{nil} %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

View File

@@ -88,8 +88,9 @@ Buildroot: %{_tmppath}/zabbix-%{version}-%{release}-root-%(%{__id_u} -n)
%global build_with_sqlite 1 %global build_with_sqlite 1
%global build_server 1 %global build_server 1
%global build_proxy 1 %global build_proxy 1
%global build_selinux_policy 1
BuildRequires: mysql-connector-odbc postgresql-odbc unixODBC unixODBC-devel 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 # end owerwrite
# FIXME: Building debuginfo is broken on RHEL 5 & 8. Disabled for now. # 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 BuildRequires: make
%if 0%{?rhel} >= 8 %if 0%{?rhel} >= 8
BuildRequires: mariadb-connector-c-devel BuildRequires: mariadb-connector-c-devel
BuildRequires: postgresql-devel >= 12.0 BuildRequires: postgresql-server-devel >= 13.0
BuildRequires: sqlite-devel BuildRequires: sqlite-devel
BuildRequires: net-snmp-devel BuildRequires: net-snmp-devel
BuildRequires: openldap-devel BuildRequires: openldap-devel
@@ -514,21 +515,11 @@ build_conf_common="
--with-libcurl --with-libcurl
--with-openipmi --with-openipmi
--with-unixodbc --with-unixodbc
%if 0%{?rhel} >= 8 --with-openssl
--with-ssh --with-ssh
%else
--with-ssh2
%endif
--with-libxml2 --with-libxml2
--with-libevent --with-libevent
%if 0%{?rhel} >= 7
--with-libpcre2 --with-libpcre2
%else
--with-libpcre
%endif
%if 0%{?rhel} >= 6
--with-openssl
%endif
" "
# setup pass 3 # setup pass 3
@@ -676,14 +667,9 @@ install -dm 755 $RPM_BUILD_ROOT%{_docdir}/zabbix-agent-%{version}
cat %{SOURCE3} | sed \ cat %{SOURCE3} | sed \
-e 's|COMPONENT|agentd|g' \ -e 's|COMPONENT|agentd|g' \
> $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/zabbix-agent > $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 %{SOURCE10} $RPM_BUILD_ROOT%{_unitdir}/zabbix-agent.service
install -Dm 0644 -p %{SOURCE15} $RPM_BUILD_ROOT%{_tmpfilesdir}/zabbix-agent.conf install -Dm 0644 -p %{SOURCE15} $RPM_BUILD_ROOT%{_tmpfilesdir}/zabbix-agent.conf
%else %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} %if 0%{?build_agent2}
rm $RPM_BUILD_ROOT%{_sbindir}/zabbix_agentd rm $RPM_BUILD_ROOT%{_sbindir}/zabbix_agentd
rm $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/zabbix_agentd.conf rm $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/zabbix_agentd.conf
@@ -696,13 +682,8 @@ cat %{SOURCE3} | sed \
-e 's|COMPONENT|agent2|g' \ -e 's|COMPONENT|agent2|g' \
> $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/zabbix-agent2 > $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/zabbix-agent2
cp man/zabbix_agent2.man $RPM_BUILD_ROOT%{_mandir}/man8/zabbix_agent2.8 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 %{SOURCE19} $RPM_BUILD_ROOT%{_unitdir}/zabbix-agent2.service
install -Dm 0644 -p %{SOURCE15} $RPM_BUILD_ROOT%{_tmpfilesdir}/zabbix_agent2.conf 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 %endif
@@ -834,13 +815,8 @@ rm -rf $RPM_BUILD_ROOT
%attr(0755,zabbix,zabbix) %dir %{_localstatedir}/run/zabbix %attr(0755,zabbix,zabbix) %dir %{_localstatedir}/run/zabbix
%{_sbindir}/zabbix_agentd %{_sbindir}/zabbix_agentd
%{_mandir}/man8/zabbix_agentd.8* %{_mandir}/man8/zabbix_agentd.8*
%if 0%{?rhel} >= 7
%{_unitdir}/zabbix-agent.service %{_unitdir}/zabbix-agent.service
%{_tmpfilesdir}/zabbix-agent.conf %{_tmpfilesdir}/zabbix-agent.conf
%else
%{_sysconfdir}/init.d/zabbix-agent
%config(noreplace) %{_sysconfdir}/sysconfig/zabbix-agent
%endif
%files get %files get
%defattr(-,root,root,-) %defattr(-,root,root,-)
@@ -918,13 +894,8 @@ fi
%attr(0755,zabbix,zabbix) %dir %{_localstatedir}/run/zabbix %attr(0755,zabbix,zabbix) %dir %{_localstatedir}/run/zabbix
%{_sbindir}/zabbix_agent2 %{_sbindir}/zabbix_agent2
%{_mandir}/man8/zabbix_agent2.8* %{_mandir}/man8/zabbix_agent2.8*
%if 0%{?rhel} >= 7
%{_unitdir}/zabbix-agent2.service %{_unitdir}/zabbix-agent2.service
%{_tmpfilesdir}/zabbix_agent2.conf %{_tmpfilesdir}/zabbix_agent2.conf
%else
%{_sysconfdir}/init.d/zabbix-agent2
%config(noreplace) %{_sysconfdir}/sysconfig/zabbix-agent2
%endif
%pre agent2 %pre agent2
getent group zabbix > /dev/null || groupadd -r zabbix getent group zabbix > /dev/null || groupadd -r zabbix
@@ -934,9 +905,7 @@ getent passwd zabbix > /dev/null || \
: :
%post agent2 %post agent2
%if 0%{?rhel} >= 7
%systemd_post zabbix-agent2.service %systemd_post zabbix-agent2.service
%endif
# make sure that agent2 log file is create with proper attributes (ZBX-18243) # make sure that agent2 log file is create with proper attributes (ZBX-18243)
if [ $1 == 1 ] && [ ! -f %{_localstatedir}/log/zabbix/zabbix_agent2.log ]; then if [ $1 == 1 ] && [ ! -f %{_localstatedir}/log/zabbix/zabbix_agent2.log ]; then
touch %{_localstatedir}/log/zabbix/zabbix_agent2.log touch %{_localstatedir}/log/zabbix/zabbix_agent2.log
@@ -944,14 +913,10 @@ if [ $1 == 1 ] && [ ! -f %{_localstatedir}/log/zabbix/zabbix_agent2.log ]; then
fi fi
: :
%if 0%{?rhel} >= 7
%preun agent2 %preun agent2
%systemd_preun zabbix-agent2.service %systemd_preun zabbix-agent2.service
: :
%postun agent2
%systemd_postun_with_restart zabbix-agent2.service
%endif
%endif %endif