diff --git a/zabbix-agent.sysconfig b/zabbix-agent.sysconfig new file mode 100644 index 0000000000000000000000000000000000000000..6ebb06b7c6913ee5d4dc489825fb8250424692f2 --- /dev/null +++ b/zabbix-agent.sysconfig @@ -0,0 +1,4 @@ +# Configuration file for /etc/init.d/zabbix-agent service + +# User to run zabbix agent as +ZABBIX_AGENT_USER=zabbix diff --git a/zabbix-agent2.init b/zabbix-agent2.init new file mode 100644 index 0000000000000000000000000000000000000000..e7a0224feb71c9cb89a0c1ec26ad8af768f30fcb --- /dev/null +++ b/zabbix-agent2.init @@ -0,0 +1,97 @@ +#!/bin/sh +# +# chkconfig: - 86 14 +# description: Zabbix agent 2 daemon +# processname: zabbix_agent2 +# config: /etc/zabbix/zabbix_agent2.conf +# + +### BEGIN INIT INFO +# Provides: zabbix-agent2 +# Required-Start: $local_fs $network +# Required-Stop: $local_fs $network +# Should-Start: zabbix zabbix-proxy +# Should-Stop: zabbix zabbix-proxy +# Default-Start: +# Default-Stop: 0 1 2 3 4 5 6 +# Short-Description: Start and stop Zabbix agent 2 +# Description: Zabbix agent 2 +### END INIT INFO + +# Source function library. +. /etc/rc.d/init.d/functions + +if [ -x /usr/sbin/zabbix_agent2 ]; then + exec=/usr/sbin/zabbix_agent2 +else + exit 5 +fi + +prog=${exec##*/} +conf=/etc/zabbix/zabbix_agent2.conf +pidfile=$(grep -e "^PidFile=.*$" $conf | cut -d= -f2 | tr -d '\r') +timeout=10 + +if [ -f /etc/sysconfig/zabbix-agent2 ]; then + . /etc/sysconfig/zabbix-agent2 +fi + +if [ -n "$ZABBIX_AGENT_USER" ]; then + user_conf="--user=$ZABBIX_AGENT_USER" +else + user_conf='' +fi + +lockfile=/var/lock/subsys/zabbix-agent2 + +start() +{ + echo -n $"Starting Zabbix agent 2: " + daemon $user_conf $exec -c $conf & + rv=$? + echo + [ $rv -eq 0 ] && touch $lockfile + return $rv +} + +stop() +{ + echo -n $"Shutting down Zabbix agent 2: " + killproc -p $pidfile -d $timeout $prog + rv=$? + echo + [ $rv -eq 0 ] && rm -f $lockfile + return $rv +} + +restart() +{ + stop + start +} + +case "$1" in + start|stop|restart) + $1 + ;; + force-reload) + restart + ;; + status) + status -p $pidfile $prog + ;; + try-restart|condrestart) + if status $prog >/dev/null ; then + restart + fi + ;; + reload) + action $"Service ${0##*/} does not support the reload action: " /bin/false + exit 3 + ;; + *) + echo $"Usage: $0 {start|stop|status|restart|try-restart|force-reload}" + exit 2 + ;; +esac + diff --git a/zabbix-agent2.sysconfig b/zabbix-agent2.sysconfig new file mode 100644 index 0000000000000000000000000000000000000000..900743c66c83abf4ad622fd432a1a18a4e390467 --- /dev/null +++ b/zabbix-agent2.sysconfig @@ -0,0 +1,4 @@ +# Configuration file for /etc/init.d/zabbix-agent2 service + +# User to run zabbix agent as +ZABBIX_AGENT_USER=zabbix diff --git a/zabbix-web-fcgi.conf b/zabbix-web-fcgi.conf new file mode 100644 index 0000000000000000000000000000000000000000..e28a1604d32e8ed5ff7d5b3216d23b3e7f220d77 --- /dev/null +++ b/zabbix-web-fcgi.conf @@ -0,0 +1,37 @@ +# +# Zabbix monitoring system php web frontend +# + +Alias /zabbix /usr/share/zabbix + +ProxyTimeout 300 + + + Options FollowSymLinks + AllowOverride None + Require all granted + + + DirectoryIndex index.php + + + + SetHandler "proxy:unix:/run/php-fpm/zabbix.sock|fcgi://localhost" + + + + + Require all denied + + + + Require all denied + + + + Require all denied + + + + Require all denied + diff --git a/zabbix.spec b/zabbix.spec index 0886186495529052ffe24c9cccc308d02f9a34e2..bd53f4ce782d3e48ff3fffb7bbba01a46a770ca7 100644 --- a/zabbix.spec +++ b/zabbix.spec @@ -1,11 +1,11 @@ Name: zabbix Version: 5.2.6 -Release: 1 +Release: 2 Summary: The Enterprise-class open source monitoring solution License: GPLv2+ URL: http://www.zabbix.com/ Source0: %{name}-%{version}.tar.gz -Source1: zabbix-web22.conf +Source1: zabbix-web22.conf Source2: zabbix-web24.conf Source3: zabbix-logrotate.in Source4: zabbix-java-gateway.init @@ -19,8 +19,12 @@ Source13: zabbix-java-gateway.service Source14: zabbix_java_gateway-sysd Source15: zabbix-tmpfiles.conf Source16: zabbix-php-fpm.conf -Source17: zabbix-nginx.conf -Source18: zabbix-agent2.service +Source17: zabbix-web-fcgi.conf +Source18: zabbix-nginx.conf +Source19: zabbix-agent2.service +Source20: zabbix-agent.sysconfig +Source21: zabbix-agent2.init +Source22: zabbix-agent2.sysconfig Patch0: config.patch Patch1: fping3-sourceip-option.patch @@ -33,10 +37,12 @@ Buildroot: %{_tmppath}/zabbix-%{version}-%{release}-root-%(%{__id_u} -n) %ifarch x86_64 %{!?build_agent2: %global build_agent2 1} %endif -%endif + + %{!?build_proxy: %global build_proxy 1} %{!?build_java_gateway: %global build_java_gateway 1} + %{!?build_server: %global build_server 1} %{!?build_frontend: %global build_frontend 1} @@ -44,9 +50,9 @@ Buildroot: %{_tmppath}/zabbix-%{version}-%{release}-root-%(%{__id_u} -n) %{!?build_with_pgsql: %global build_with_pgsql 1} %{!?build_with_sqlite: %global build_with_sqlite 1} -%if 0%{?build_with_mysql} == 0 && 0%{?build_with_pgsql} == 0 +%if 0%{build_with_mysql} == 0 && 0%{build_with_pgsql} == 0 %global build_server 0 -%if 0%{?build_with_sqlite} == 0 +%if 0%{build_with_sqlite} == 0 %global build_proxy 0 %endif %endif @@ -54,26 +60,21 @@ Buildroot: %{_tmppath}/zabbix-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: make BuildRequires: mysql-devel BuildRequires: postgresql-devel +BuildRequires: sqlite-devel BuildRequires: net-snmp-devel BuildRequires: openldap-devel BuildRequires: gnutls-devel -BuildRequires: sqlite-devel BuildRequires: unixODBC-devel BuildRequires: curl-devel >= 7.13.1 BuildRequires: OpenIPMI-devel >= 2 -BuildRequires: libssh-devel -%else -BuildRequires: libssh2-devel -%endif +BuildRequires: libssh-devel >= 0.9.0 BuildRequires: java-devel >= 1.6.0 BuildRequires: libxml2-devel -BuildRequires: pcre-devel BuildRequires: libevent-devel -BuildRequires: openssl-devel >= 1.1.0 -%else +BuildRequires: pcre-devel BuildRequires: openssl-devel >= 1.0.1 -%endif BuildRequires: systemd +BuildRequires: golang %description Zabbix is the ultimate enterprise-level software designed for @@ -81,7 +82,7 @@ real-time monitoring of millions of metrics collected from tens of thousands of servers, virtual machines and network devices. %package agent -Summary: Zabbix Agent +Summary: Old Zabbix Agent Group: Applications/Internet Requires: logrotate Requires(pre): /usr/sbin/useradd @@ -179,18 +180,6 @@ Obsoletes: zabbix-proxy %description proxy-sqlite3 Zabbix proxy with SQLite3 database support. -%package java-gateway -Summary: Zabbix java gateway -Group: Applications/Internet -Requires: java >= 1.6.0 -Requires(post): systemd -Requires(preun): systemd -Requires(postun): systemd -Obsoletes: zabbix - -%description java-gateway -Zabbix java gateway - %package server-mysql Summary: Zabbix server for MySQL or MariaDB database Group: Applications/Internet @@ -224,12 +213,9 @@ Zabbix server with PostgresSQL database support. Summary: Zabbix web frontend common package Group: Application/Internet BuildArch: noarch -Requires: dejavu-fonts +Requires: dejavu-sans-fonts Requires(post): %{_sbindir}/update-alternatives Requires(preun): %{_sbindir}/update-alternatives -Suggests: zabbix-web-deps -Suggests: zabbix-apache-conf -Suggests: zabbix-nginx-conf %description web Zabbix web frontend common package @@ -238,23 +224,14 @@ Zabbix web frontend common package Summary: PHP dependencies metapackage for frontend Group: Application/Internet BuildArch: noarch -Requires: zabbix-web -Requires: php7-sockets -Requires: php7-gettext -Requires: php7-gd -Requires: php7-bcmath -Requires: php7-mbstring -Requires: php7-ldap -Requires: php7-zlib -%else -Requires: php72-sockets -Requires: php72-gettext -Requires: php72-gd -Requires: php72-bcmath -Requires: php72-mbstring -Requires: php72-ldap -Requires: php72-zlib -%endif +Requires: zabbix-web = %{version}-%{release} +Requires: php-gd >= 7.2 +Requires: php-bcmath >= 7.2 +Requires: php-mbstring >= 7.2 +Requires: php-xml >= 7.2 +Requires: php-ldap >= 7.2 +Requires: php-json >= 7.2 +Requires: php-fpm >= 7.2 Requires: zabbix-web = %{version}-%{release} Requires: zabbix-web-database = %{version}-%{release} @@ -265,9 +242,9 @@ PHP dependencies metapackage for frontend Summary: Zabbix web frontend for MySQL Group: Applications/Internet BuildArch: noarch -Requires: php-mysql Requires: zabbix-web = %{version}-%{release} Requires: zabbix-web-deps = %{version}-%{release} +Requires: php-mysqlnd Provides: zabbix-web-database = %{version}-%{release} %description web-mysql @@ -277,50 +254,62 @@ Zabbix web frontend for MySQL Summary: Zabbix web frontend for PostgreSQL Group: Applications/Internet BuildArch: noarch -Requires: php-pgsql Requires: zabbix-web = %{version}-%{release} Requires: zabbix-web-deps = %{version}-%{release} +Requires: php-pgsql Provides: zabbix-web-database = %{version}-%{release} %description web-pgsql Zabbix web frontend for PostgreSQL -%package web-japanese -Summary: Japanese font settings for frontend -Group: Applications/Internet -BuildArch: noarch -Requires: ipa-pgothic-fonts -Requires: zabbix-web = %{version}-%{release} -Requires(post): %{_sbindir}/update-alternatives -Requires(preun): %{_sbindir}/update-alternatives - -%description web-japanese -Japanese font configuration for Zabbix web frontend - %package apache-conf Summary: Automatic zabbix frontend configuration with apache Group: Applications/Internet BuildArch: noarch Requires: zabbix-web-deps = %{version}-%{release} -Requires: apache2 -Requires: apache2-mod_php7 >= 7.2 -%else -Requires: apache2-mod_php72 -%endif +Requires: httpd %description apache-conf -Automatic zabbix frontend configuration with apache +Zabbix frontend configuration for apache %package nginx-conf -Summary: Automatic zabbix frontend configuration with nginx +Summary: Zabbix frontend configuration for nginx and php-fpm Group: Applications/Internet BuildArch: noarch Requires: zabbix-web-deps = %{version}-%{release} Requires: nginx -Requires: php-fpm >= 7.2 %description nginx-conf -Automatic zabbix frontend configuration with nginx +Zabbix frontend configuration for nginx and php-fpm + +%package web-japanese +Summary: Japanese font settings for Zabbix frontend +Group: Applications/Internet +BuildArch: noarch +Requires: google-noto-sans-cjk-ttc-fonts +Requires: glibc-langpack-ja +Requires: zabbix-web = %{version}-%{release} +Requires(post): %{_sbindir}/update-alternatives +Requires(preun): %{_sbindir}/update-alternatives + +%description web-japanese +Japanese font configuration for Zabbix web frontend + +%package java-gateway +Summary: Zabbix java gateway +Group: Applications/Internet +Requires: java-headless >= 1.6.0 +Requires(post): systemd +Requires(preun): systemd +Requires(postun): systemd +Obsoletes: zabbix + +%description java-gateway +Zabbix java gateway + +# +# prep +# %prep %setup0 -q -n %{name}-%{version}%{?alphatag} @@ -358,7 +347,7 @@ sed -i -e 's|/usr/bin/traceroute|/bin/traceroute|' database/sqlite3/data.sql %endif %if 0%{?build_server} -# copy sql files for servers +# sql files for servers cat database/mysql/schema.sql > database/mysql/create.sql cat database/mysql/images.sql >> database/mysql/create.sql cat database/mysql/data.sql >> database/mysql/create.sql @@ -372,7 +361,7 @@ gzip database/postgresql/timescaledb.sql %endif %if 0%{?build_proxy} -# sql files for proxyes +# sql files for proxies gzip database/mysql/schema.sql gzip database/postgresql/schema.sql gzip database/sqlite3/schema.sql @@ -390,6 +379,7 @@ sed -i -e 's|/tmp/zabbix_java.log|/var/log/zabbix/zabbix_java_gateway.log|g' src # pass 3: If only one database is enabled, then it must occur with pass 3. %build +export GOPROXY=https://goproxy.cn build_conf_common=" --enable-dependency-tracking --sysconfdir=/etc/zabbix @@ -401,13 +391,11 @@ build_conf_common=" --with-openipmi --with-unixodbc --with-ssh -%else - --with-ssh2 -%endif --with-libxml2 --with-libevent --with-libpcre --with-openssl + " # setup pass 3 @@ -427,7 +415,7 @@ build_db_3=mysql # setup pass 2 - +%if 0%{?build_with_pgsql} && ( 0%{?build_server} || 0%{?build_proxy} ) build_conf_2=" %if 0%{?build_server} --enable-server @@ -512,11 +500,15 @@ fi # %install - +export GOPROXY=https://goproxy.cn rm -rf $RPM_BUILD_ROOT mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log/zabbix mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/run/zabbix mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d +mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/zabbix +mkdir -p $RPM_BUILD_ROOT%{_datadir} +mkdir -p $RPM_BUILD_ROOT%{_datadir}/man/man8 + %if 0%{?build_agent2} make DESTDIR=$RPM_BUILD_ROOT GOBIN=$RPM_BUILD_ROOT%{_sbindir} install @@ -526,8 +518,6 @@ make DESTDIR=$RPM_BUILD_ROOT install %if 0%{?build_agent} -mv $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/zabbix_agentd.conf.d $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/zabbix_agentd.d -install -dm 755 $RPM_BUILD_ROOT%{_docdir}/zabbix-agent-%{version} cat conf/zabbix_agentd.conf | sed \ -e "/# User=zabbix/a# NOTE: This option is overriden by settings in systemd service file!" \ -e '/^# PidFile=/a \\nPidFile=%{_localstatedir}/run/zabbix/zabbix_agentd.pid' \ @@ -535,27 +525,36 @@ cat conf/zabbix_agentd.conf | sed \ -e '/^# LogFileSize=.*/a \\nLogFileSize=0' \ -e '/^# Include=$/a \\nInclude=%{_sysconfdir}/zabbix/zabbix_agentd.d/*.conf' \ > $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/zabbix_agentd.conf +mv $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/zabbix_agentd.conf.d $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/zabbix_agentd.d +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 install -Dm 0644 -p %{SOURCE10} $RPM_BUILD_ROOT%{_unitdir}/zabbix-agent.service install -Dm 0644 -p %{SOURCE15} $RPM_BUILD_ROOT%{_prefix}/lib/tmpfiles.d/zabbix-agent.conf + +%else +%if 0%{?build_agent2} +rm $RPM_BUILD_ROOT%{_sbindir}/zabbix_agentd +rm $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/zabbix_agentd.conf +%endif %endif %if 0%{?build_agent2} -mkdir $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/zabbix_agent2.d + cat src/go/conf/zabbix_agent2.conf | sed \ -e '/^# PidFile=/a \\nPidFile=%{_localstatedir}/run/zabbix/zabbix_agent2.pid' \ -e 's|^LogFile=.*|LogFile=%{_localstatedir}/log/zabbix/zabbix_agent2.log|g' \ -e '/^# LogFileSize=.*/a \\nLogFileSize=0' \ -e '/^# Include=$/a \\nInclude=%{_sysconfdir}/zabbix/zabbix_agent2.d/*.conf' \ > $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/zabbix_agent2.conf -cp man/zabbix_agent2.man $RPM_BUILD_ROOT%{_mandir}/man8/zabbix_agent2.8 cat %{SOURCE3} | sed \ -e 's|COMPONENT|agent2|g' \ > $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/zabbix-agent2 -install -Dm 0644 -p %{SOURCE18} $RPM_BUILD_ROOT%{_unitdir}/zabbix-agent2.service +mkdir $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/zabbix_agent2.d +cp man/zabbix_agent2.man $RPM_BUILD_ROOT%{_mandir}/man8/zabbix_agent2.8 +install -Dm 0644 -p %{SOURCE19} $RPM_BUILD_ROOT%{_unitdir}/zabbix-agent2.service install -Dm 0644 -p %{SOURCE15} $RPM_BUILD_ROOT%{_prefix}/lib/tmpfiles.d/zabbix_agent2.conf %endif @@ -567,14 +566,13 @@ mv $RPM_BUILD_ROOT%{_datadir}/zabbix/externalscripts $RPM_BUILD_ROOT/usr/lib/zab %if 0%{?build_proxy} +mv $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/zabbix_proxy.conf.d $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/zabbix_proxy.d install -m 0755 -p src/zabbix_proxy/zabbix_proxy_* $RPM_BUILD_ROOT%{_sbindir}/ rm $RPM_BUILD_ROOT%{_sbindir}/zabbix_proxy -mv $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/zabbix_proxy.conf.d $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/zabbix_proxy.d 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' \ -e '/^# LogFileSize=/a \\nLogFileSize=0' \ - -e '/^# ExternalScripts=/a \\nExternalScripts=/usr/lib/zabbix/externalscripts' \ -e 's:^# ExternalScripts=${datadir}/zabbix/externalscripts:# ExternalScripts=/usr/lib/zabbix/externalscripts:' \ -e 's|^DBUser=root|DBUser=zabbix|g' \ -e '/^# SNMPTrapperFile=.*/a \\nSNMPTrapperFile=/var/log/snmptrap/snmptrap.log' \ @@ -589,10 +587,10 @@ install -Dm 0644 -p %{SOURCE15} $RPM_BUILD_ROOT%{_prefix}/lib/tmpfiles.d/zabbix- %if 0%{?build_server} +mv $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/zabbix_server.conf.d $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/zabbix_server.d install -m 0755 -p src/zabbix_server/zabbix_server_* $RPM_BUILD_ROOT%{_sbindir}/ rm $RPM_BUILD_ROOT%{_sbindir}/zabbix_server mv $RPM_BUILD_ROOT%{_datadir}/zabbix/alertscripts $RPM_BUILD_ROOT/usr/lib/zabbix -mv $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/zabbix_server.conf.d $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/zabbix_server.d cat conf/zabbix_server.conf | sed \ -e '/^# PidFile=/a \\nPidFile=%{_localstatedir}/run/zabbix/zabbix_server.pid' \ -e 's|^LogFile=.*|LogFile=%{_localstatedir}/log/zabbix/zabbix_server.log|g' \ @@ -614,16 +612,12 @@ install -Dm 0644 -p %{SOURCE15} $RPM_BUILD_ROOT%{_prefix}/lib/tmpfiles.d/zabbix- %if 0%{?build_frontend} find ui -name '*.orig' | xargs rm -f cp -a ui/* $RPM_BUILD_ROOT%{_datadir}/zabbix - -# install frontend configuration files mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/web touch $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/web/zabbix.conf.php mv $RPM_BUILD_ROOT%{_datadir}/zabbix/conf/maintenance.inc.php $RPM_BUILD_ROOT%{_sysconfdir}/zabbix/web/ - -# drop config files in place -install -Dm 0644 -p %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/apache2/conf.d/zabbix.conf -install -Dm 0644 -p %{SOURCE16} $RPM_BUILD_ROOT%{_sysconfdir}/php7/fpm/php-fpm.d/zabbix.conf -install -Dm 0644 -p %{SOURCE17} $RPM_BUILD_ROOT%{_sysconfdir}/nginx/conf.d/zabbix.conf +install -Dm 0644 -p %{SOURCE16} $RPM_BUILD_ROOT%{_sysconfdir}/php-fpm.d/zabbix.conf +install -Dm 0644 -p %{SOURCE17} $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf.d/zabbix.conf +install -Dm 0644 -p %{SOURCE18} $RPM_BUILD_ROOT%{_sysconfdir}/nginx/conf.d/zabbix.conf %endif @@ -631,10 +625,8 @@ install -Dm 0644 -p %{SOURCE17} $RPM_BUILD_ROOT%{_sysconfdir}/nginx/conf.d/zabbi 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 -mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/zabbix 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 -mkdir -p $RPM_BUILD_ROOT%{_datadir} mv $RPM_BUILD_ROOT%{_sbindir}/zabbix_java $RPM_BUILD_ROOT%{_datadir}/zabbix-java-gateway install -m 0755 -p %{SOURCE14} $RPM_BUILD_ROOT%{_sbindir}/zabbix_java_gateway cat src/zabbix_java/settings.sh | sed \ @@ -650,10 +642,12 @@ rm -rf $RPM_BUILD_ROOT # -# files $scriptlets +# files & scriptlets # + %if 0%{?build_agent} + %files agent %defattr(-,root,root,-) %doc AUTHORS ChangeLog COPYING NEWS README conf/zabbix_agentd/userparameter_mysql.conf @@ -667,6 +661,7 @@ rm -rf $RPM_BUILD_ROOT %{_unitdir}/zabbix-agent.service %{_prefix}/lib/tmpfiles.d/zabbix-agent.conf + %files get %defattr(-,root,root,-) %doc AUTHORS ChangeLog COPYING NEWS README @@ -690,6 +685,7 @@ getent passwd zabbix > /dev/null || \ %systemd_post zabbix-agent.service : + %preun agent if [ "$1" = 0 ]; then %systemd_preun zabbix-agent.service @@ -709,6 +705,7 @@ fi %endif + %if 0%{?build_agent2} %files agent2 %defattr(-,root,root,-) @@ -723,6 +720,7 @@ fi %{_unitdir}/zabbix-agent2.service %{_prefix}/lib/tmpfiles.d/zabbix_agent2.conf + %pre agent2 getent group zabbix > /dev/null || groupadd -r zabbix getent passwd zabbix > /dev/null || \ @@ -745,7 +743,6 @@ fi %postun agent2 %systemd_postun_with_restart zabbix-agent2.service -: %endif @@ -800,7 +797,7 @@ fi %endif - +%if 0%{?build_with_pgsql} %files proxy-pgsql %defattr(-,root,root,-) %doc AUTHORS ChangeLog COPYING NEWS README @@ -930,7 +927,6 @@ fi %endif - %files server-pgsql %defattr(-,root,root,-) %doc AUTHORS ChangeLog COPYING NEWS README @@ -973,19 +969,21 @@ fi %systemd_postun_with_restart zabbix-server.service : %endif -%endif %if 0%{?build_frontend} %files web %defattr(-,root,root,-) +%dir %{_sysconfdir}/zabbix/web +%ghost %config(noreplace) %{_sysconfdir}/zabbix/web/zabbix.conf.php %doc AUTHORS ChangeLog COPYING NEWS README -%dir %attr(0750,wwwrun,www) %{_sysconfdir}/zabbix/web -%ghost %attr(0644,wwwrun,www) %config(noreplace) %{_sysconfdir}/zabbix/web/zabbix.conf.php %config(noreplace) %{_sysconfdir}/zabbix/web/maintenance.inc.php %{_datadir}/zabbix %files web-deps +%config(noreplace) %{_sysconfdir}/php-fpm.d/zabbix.conf + +%files web-japanese %defattr(-,root,root,-) %files web-mysql @@ -994,17 +992,13 @@ fi %files web-pgsql %defattr(-,root,root,-) -%files web-japanese -%defattr(-,root,root,-) - %files apache-conf -%doc AUTHORS ChangeLog COPYING NEWS README -%config(noreplace) %{_sysconfdir}/apache2/conf.d/zabbix.conf +%defattr(-,root,root,-) +%config(noreplace) %{_sysconfdir}/httpd/conf.d/zabbix.conf %files nginx-conf -%doc AUTHORS ChangeLog COPYING NEWS README +%defattr(-,root,root,-) %config(noreplace) %{_sysconfdir}/nginx/conf.d/zabbix.conf -%config(noreplace) %{_sysconfdir}/php7/fpm/php-fpm.d/zabbix.conf %post web # The fonts directory was moved into assets subdirectory at one point. @@ -1023,40 +1017,39 @@ then fi fi /usr/sbin/update-alternatives --install %{_datadir}/zabbix/assets/fonts/graphfont.ttf \ - zabbix-web-font %{_datadir}/fonts/truetype/DejaVuSans.ttf 10 + zabbix-web-font %{_datadir}/fonts/dejavu/DejaVuSans.ttf 10 : %post web-japanese -/usr/sbin/update-alternatives --install %{_datadir}/zabbix/assets/fonts/graphfont.ttf \ - zabbix-web-font %{_datadir}/fonts/truetype/ipagp.ttf 20 +/usr/sbin/update-alternatives --install %{_datadir}/zabbix/assets/fonts/graphfont.ttf zabbix-web-font \ + %{_datadir}/fonts/google-noto-cjk/NotoSansCJK-Regular.ttc 20 : +# The user apache must be available for these to work. +# It is provided by httpd or php-fpm packages. %post apache-conf if [ -d /etc/zabbix/web ]; then - chown wwwrun:www /etc/zabbix/web -fi -if [ $1 == 1 ]; then - a2enmod php7 + chown apache:apache /etc/zabbix/web/ fi : %post nginx-conf if [ -d /etc/zabbix/web ]; then - chown wwwrun:www /etc/zabbix/web + chown apache:apache /etc/zabbix/web/ fi : %preun web if [ "$1" = 0 ]; then /usr/sbin/update-alternatives --remove zabbix-web-font \ - %{_datadir}/fonts/truetype/DejaVuSans.ttf + %{_datadir}/fonts/dejavu/DejaVuSans.ttf fi : %preun web-japanese if [ "$1" = 0 ]; then /usr/sbin/update-alternatives --remove zabbix-web-font \ - %{_datadir}/fonts/truetype/ipagp.ttf + %{_datadir}/fonts/google-noto-cjk/NotoSansCJK-Regular.ttc fi : %endif @@ -1094,9 +1087,13 @@ fi %postun java-gateway %systemd_postun_with_restart zabbix-java-gateway.service +: %endif %changelog +* Fri May 14 2021 duyiwei - 5.2.6-2 +- solve the problem that missing or redundant if/endif + * Fri Apr 16 2021 duyiwei - 5.2.6-1 - init