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

@@ -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