Support building sqlite and mysql proxy on el6

tags/zabbix-5.0.3-1
Daniel Berteaud 4 years ago
parent 98de2f16c6
commit 1e698f3b0d
  1. 72
      zabbix.spec

@ -33,7 +33,7 @@ Patch1: fping3-sourceip-option.patch
Buildroot: %{_tmppath}/zabbix-%{version}-%{release}-root-%(%{__id_u} -n)
%ifarch x86_64
%if 0%{?rhel} >= 6
%if 0%{?rhel} >= 7
%define build_agent2 1
%endif
%endif
@ -44,6 +44,10 @@ Buildroot: %{_tmppath}/zabbix-%{version}-%{release}-root-%(%{__id_u} -n)
%endif
BuildRequires: make
%if 0%{?rhel} == 6
BuildRequires: sqlite-devel
BuildRequires: mysql-devel
%endif
%if 0%{?rhel} >= 7
%if 0%{?rhel} >= 8
BuildRequires: mariadb-connector-c-devel
@ -141,7 +145,7 @@ Group: Applications/Internet
%description sender
Zabbix sender command line utility.
%if 0%{?rhel} >= 7
%if 0%{?rhel} >= 6
%package js
Summary: Zabbix JS
Group: Applications/Internet
@ -153,9 +157,16 @@ Zabbix js command line utility.
Summary: Zabbix proxy for MySQL or MariaDB database
Group: Applications/Internet
Requires: fping
%if 0%{?rhel} >= 7
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
%else
Requires(post): /sbin/chkconfig
Requires(preun): /sbin/chkconfig
Requires(preun): /sbin/service
Requires(postun): /sbin/service
%endif
Provides: zabbix-proxy = %{version}-%{release}
Provides: zabbix-proxy-implementation = %{version}-%{release}
Obsoletes: zabbix
@ -163,7 +174,9 @@ Obsoletes: zabbix-proxy
%description proxy-mysql
Zabbix proxy with MySQL or MariaDB database support.
%endif
%if 0%{?rhel} >= 7
%package proxy-pgsql
Summary: Zabbix proxy for PostgreSQL database
Group: Applications/Internet
@ -178,7 +191,9 @@ Obsoletes: zabbix-proxy
%description proxy-pgsql
Zabbix proxy with PostgreSQL database support.
%endif
%if 0%{?rhel} >= 6
%package proxy-sqlite3
Summary: Zabbix proxy for SQLite3 database
Group: Applications/Internet
@ -193,7 +208,9 @@ Obsoletes: zabbix-proxy
%description proxy-sqlite3
Zabbix proxy with SQLite3 database support.
%endif
%if 0%{?rhel} >= 7
%package server-mysql
Summary: Zabbix server for MySQL or MariaDB database
Group: Applications/Internet
@ -442,7 +459,7 @@ sed -i -e 's|/usr/bin/traceroute|/bin/traceroute|' database/sqlite3/data.sql
# change log directory for Java Gateway
sed -i -e 's|/tmp/zabbix_java.log|/var/log/zabbix/zabbix_java_gateway.log|g' src/zabbix_java/lib/logback.xml
%if 0%{?rhel} >= 7
%if 0%{?rhel} >= 6
# copy sql files for servers
cat database/mysql/schema.sql > database/mysql/create.sql
cat database/mysql/images.sql >> database/mysql/create.sql
@ -489,20 +506,25 @@ build_flags="
%if 0%{?rhel} >= 6
build_flags="$build_flags --with-openssl"
%endif
%if 0%{?rhel} >= 7
%configure $build_flags --enable-proxy --with-sqlite3
make %{?_smp_mflags}
mv src/zabbix_proxy/zabbix_proxy src/zabbix_proxy/zabbix_proxy_sqlite3
%if 0%{?rhel} >= 7
build_flags="$build_flags --enable-server --enable-proxy --enable-java"
%else
build_flags="$build_flags --enable-proxy"
%endif
%configure $build_flags --with-mysql
make %{?_smp_mflags}
%if 0%{?rhel} >= 7
mv src/zabbix_server/zabbix_server src/zabbix_server/zabbix_server_mysql
%endif
mv src/zabbix_proxy/zabbix_proxy src/zabbix_proxy/zabbix_proxy_mysql
%if 0%{?rhel} >= 7
export PATH="/usr/pgsql-12/bin/:$PATH"
export CFLAGS="-I /usr/pgsql-12/include/ $CFLAGS"
export LDFLAGS="-L /usr/pgsql-12/lib/ $LDFLAGS"
@ -510,6 +532,7 @@ export LDFLAGS="-L /usr/pgsql-12/lib/ $LDFLAGS"
make %{?_smp_mflags}
mv src/zabbix_server/zabbix_server src/zabbix_server/zabbix_server_pgsql
mv src/zabbix_proxy/zabbix_proxy src/zabbix_proxy/zabbix_proxy_pgsql
%endif
touch src/zabbix_server/zabbix_server
touch src/zabbix_proxy/zabbix_proxy
@ -536,19 +559,29 @@ mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/run/zabbix
%if 0%{?rhel} >= 7
install -m 0755 -p src/zabbix_server/zabbix_server_* $RPM_BUILD_ROOT%{_sbindir}/
rm $RPM_BUILD_ROOT%{_sbindir}/zabbix_server
%endif
%if 0%{?rhel} >= 6
install -m 0755 -p src/zabbix_proxy/zabbix_proxy_* $RPM_BUILD_ROOT%{_sbindir}/
rm $RPM_BUILD_ROOT%{_sbindir}/zabbix_proxy
%endif
%if 0%{?rhel} >= 7
# delete unnecessary files from java gateway
rm $RPM_BUILD_ROOT%{_sbindir}/zabbix_java/settings.sh
rm $RPM_BUILD_ROOT%{_sbindir}/zabbix_java/startup.sh
rm $RPM_BUILD_ROOT%{_sbindir}/zabbix_java/shutdown.sh
%endif
%if 0%{?rhel} >= 6
# install scripts and modules directories
mkdir -p $RPM_BUILD_ROOT/usr/lib/zabbix
%if 0%{?rhel} >= 7
mv $RPM_BUILD_ROOT%{_datadir}/zabbix/alertscripts $RPM_BUILD_ROOT/usr/lib/zabbix
%endif
mv $RPM_BUILD_ROOT%{_datadir}/zabbix/externalscripts $RPM_BUILD_ROOT/usr/lib/zabbix
%endif
%if 0%{?rhel} >= 7
mv $RPM_BUILD_ROOT%{_sbindir}/zabbix_java/lib/logback.xml $RPM_BUILD_ROOT/%{_sysconfdir}/zabbix/zabbix_java_gateway_logback.xml
rm $RPM_BUILD_ROOT%{_sbindir}/zabbix_java/lib/logback-console.xml
mv $RPM_BUILD_ROOT%{_sbindir}/zabbix_java $RPM_BUILD_ROOT/%{_datadir}/zabbix-java-gateway
@ -622,7 +655,8 @@ cat conf/zabbix_server.conf | sed \
-e '/^# SNMPTrapperFile=.*/a \\nSNMPTrapperFile=/var/log/snmptrap/snmptrap.log' \
-e '/^# SocketDir=.*/a \\nSocketDir=/var/run/zabbix' \
> $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/zabbix_server.conf
%endif
%if 0%{?rhel} >= 6
cat conf/zabbix_proxy.conf | sed \
-e '/^# PidFile=/a \\nPidFile=%{_localstatedir}/run/zabbix/zabbix_proxy.pid' \
-e 's|^LogFile=.*|LogFile=%{_localstatedir}/log/zabbix/zabbix_proxy.log|g' \
@ -632,7 +666,8 @@ cat conf/zabbix_proxy.conf | sed \
-e '/^# SNMPTrapperFile=.*/a \\nSNMPTrapperFile=/var/log/snmptrap/snmptrap.log' \
-e '/^# SocketDir=.*/a \\nSocketDir=/var/run/zabbix' \
> $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/zabbix_proxy.conf
%endif
%if 0%{?rhel} >= 7
cat src/zabbix_java/settings.sh | sed \
-e 's|^PID_FILE=.*|PID_FILE="/var/run/zabbix/zabbix_java.pid"|g' \
> $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/zabbix_java_gateway.conf
@ -644,6 +679,8 @@ mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d
cat %{SOURCE3} | sed \
-e 's|COMPONENT|server|g' \
> $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/zabbix-server
%endif
%if 0%{?rhel} >= 6
cat %{SOURCE3} | sed \
-e 's|COMPONENT|proxy|g' \
> $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/zabbix-proxy
@ -882,9 +919,14 @@ fi
%preun proxy-mysql
if [ "$1" = 0 ]; then
%if 0%{?rhel} >= 7
%systemd_preun zabbix-proxy.service
/usr/sbin/update-alternatives --remove zabbix-proxy \
%{_sbindir}/zabbix_proxy_mysql
%else
/sbin/service zabbix-proxy stop >/dev/null 2>&1
/sbin/chkconfig --del zabbix-proxy
%endif
fi
:
@ -1035,12 +1077,14 @@ fi
%{_bindir}/zabbix_sender
%{_mandir}/man1/zabbix_sender.1*
%if 0%{?rhel} >= 7
%if 0%{?rhel} >= 6
%files js
%defattr(-,root,root,-)
%doc AUTHORS ChangeLog COPYING NEWS README
%{_bindir}/zabbix_js
%endif
%if 0%{?rhel} >= 7
%files java-gateway
%defattr(-,root,root,-)
%doc AUTHORS ChangeLog COPYING NEWS README
@ -1052,7 +1096,9 @@ fi
%{_unitdir}/zabbix-java-gateway.service
%{_prefix}/lib/tmpfiles.d/zabbix-java-gateway.conf
%config(noreplace) %{_sysconfdir}/zabbix/zabbix_java_gateway_logback.xml
%endif
%if 0%{?rhel} >= 6
%files proxy-mysql
%defattr(-,root,root,-)
%doc AUTHORS ChangeLog COPYING NEWS README
@ -1063,10 +1109,14 @@ fi
%attr(0755,zabbix,zabbix) %dir %{_localstatedir}/log/zabbix
%attr(0755,zabbix,zabbix) %dir %{_localstatedir}/run/zabbix
%{_mandir}/man8/zabbix_proxy.8*
%if 0%{?rhel} >= 7
%{_unitdir}/zabbix-proxy.service
%{_prefix}/lib/tmpfiles.d/zabbix-proxy.conf
%endif
%{_sbindir}/zabbix_proxy_mysql
%endif
%if 0%{?rhel} >= 7
%files proxy-pgsql
%defattr(-,root,root,-)
%doc AUTHORS ChangeLog COPYING NEWS README
@ -1080,7 +1130,9 @@ fi
%{_unitdir}/zabbix-proxy.service
%{_prefix}/lib/tmpfiles.d/zabbix-proxy.conf
%{_sbindir}/zabbix_proxy_pgsql
%endif
%if 0%{?rhel} >= 6
%files proxy-sqlite3
%defattr(-,root,root,-)
%doc AUTHORS ChangeLog COPYING NEWS README
@ -1091,10 +1143,14 @@ fi
%attr(0755,zabbix,zabbix) %dir %{_localstatedir}/log/zabbix
%attr(0755,zabbix,zabbix) %dir %{_localstatedir}/run/zabbix
%{_mandir}/man8/zabbix_proxy.8*
%if 0%{?rhel} >= 7
%{_unitdir}/zabbix-proxy.service
%{_prefix}/lib/tmpfiles.d/zabbix-proxy.conf
%endif
%{_sbindir}/zabbix_proxy_sqlite3
%endif
%if 0%{?rhel} >= 7
%files server-mysql
%defattr(-,root,root,-)
%doc AUTHORS ChangeLog COPYING NEWS README

Loading…
Cancel
Save