File zabbix.spec of Package zabbix
#
# spec file for package zabbix
#
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# backport...
%{!?_initddir: %{expand: %%global _initddir %{_initrddir}}}
%{!?_rundir: %{expand: %%global _rundir %{_localstatedir}/run}}
%define server_user zabbixs
%define server_group zabbixs
# keep zabbix user for backward compatibility of agent
%define agent_user zabbix
%define agent_group zabbix
%define basic_configuration --enable-proxy --enable-server --enable-agent --sysconfdir=%{_sysconfdir}/zabbix
# globaly defined configure variables
%define _with_openipmi --with-openipmi
%define _with_java --enable-java
%define _with_ipv6 --enable-ipv6
%define _with_ssh2 --with-ssh2
%define _with_ldap --with-ldap
%define _with_libcurl --with-libcurl
#%undefine _with_jabber --with-jabber
%define _with_openipmi --with-openipmi
%define _with_net_snmp --with-net-snmp
%define _with_odbc --with-unixodbc
%define _with_net_snmp --with-net-snmp
%define _with_libxml2 --with-libxml2
%define _with_vmware --with-vmware
# sle 10 and RHEL4 does not have new enough java sdk... (must be separated sle 10 rpm is a bit picky...
%if 0%{?sles_version} && 0%{?sles_version} <= 10
%undefine _with_java
%endif
%if 0%{?rhel_version} && 0%{?rhel_version} <= 406
%undefine _with_java
%endif
%if 0%{?suse_version}
%define apache2_sysconfdir %(%{_sbindir}/apxs2 -q SYSCONFDIR)
%else
# this should be rhel compatible
%define apache2_sysconfdir %(%{_sbindir}/apxs -q SYSCONFDIR)
%endif
%if 0%{?sles_version} == 11
%define php_minor 3
%endif
%define SuSeFirewall_services_dir /etc/sysconfig/SuSEfirewall2.d/services
%define nightly 0
%define is_rc 0
%if 0%{?nightly}
%define rclevel rc1
%define rev 34821
%endif
Name: zabbix
Version: 2.2.13
Release: 0
%if 0%{?nightly}
%else
%endif
Url: http://www.zabbix.com
%if 0%{?nightly}
Source0: http://www.zabbix.com/downloads/nightly/pre-zabbix-%{version}%{rclevel}-%{rev}.tar.gz
%else
%if 0%{?is_rc}
Source0: http://sourceforge.net/projects/zabbix/files/ZABBIX%20Release%20Candidates/%{version}/zabbix-%{version}.tar.gz
%else
Source0: http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/%{version}/zabbix-%{version}.tar.gz
%endif
%endif
Source1: zabbix-rpmlintrc
Source2: zabbix-agentd.init.d
Source3: zabbix-server.init.d
Source4: zabbix-proxy.init.d
Source5: apache2-zabbix.conf
Source6: README.SUSE
Source7: zabbix-agentd.firewall
Source8: zabbix-server.firewall
Source9: zabbix-java-gateway.firewall
Source10: zabbix-java-gateway.init.d
Source11: zabbix-server.service
Source12: zabbix-agentd.service
Source13: zabbix-proxy.service
Source14: zabbix-java-gateway.service
Source15: rn2.2.0.html
Source16: zabbix-tmpfiles.conf
Source17: zabbix-java-gateway.sh
Source18: zabbix-proxy.firewall
# PATCH-FIX-UPSTREAM zabbix-2.0.3_nonvoid_function.patch boris@steki.net fix rpmlint warnings
Patch0: zabbix-2.0.3_nonvoid_function.patch
# PATCH-FIX-UPSTREAM zabbix-2.2.3-run_foreground-v3.patch #ZBXNEXT-611 boris@steki.net Provide a way for daemons to (optionally) run in the foreground.
Patch1: zabbix-2.2.3-run_foreground-v3.patch
# PATCH-FIX-UPSTREAM zabbix-2.2.10-net-snmp_removed_md5.patch #ZBX-9903 boris@steki.net SLE12 and zabbix 2.2.10 usmHMACMD5AuthProtocol
Patch2: zabbix-2.2.10-net-snmp_removed_md5.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%if 0%{?_with_openipmi:1}
BuildRequires: OpenIPMI-devel
%endif
%if 0%{?suse_version}
BuildRequires: apache2-devel
%else
BuildRequires: httpd-devel
%endif
BuildRequires: autoconf
BuildRequires: automake
%if 0%{?suse_version}
BuildRequires: help2man
%endif
%if 0%{?_with_jabber:1}
#BuildRequires: iksemel-devel
%endif
%if 0%{?_with_ssh2:1}
BuildRequires: libssh2-devel
%endif
BuildRequires: libtool
%if 0%{?_with_net_snmp:1}
BuildRequires: net-snmp-devel
%endif
%if 0%{?_with_ldap:1}
BuildRequires: openldap2-devel
%endif
BuildRequires: pkg-config
BuildRequires: postgresql-devel
BuildRequires: sqlite-devel
%if 0%{?_with_java:1}
BuildRequires: java-devel
%endif
%if 0%{?_with_odbc:1}
BuildRequires: unixODBC-devel
%endif
%if 0%{?suse_version} < 1020
BuildRequires: curl-devel
BuildRequires: mysql-devel
BuildRequires: tcpd-devel
%else
BuildRequires: fdupes
BuildRequires: libcurl-devel
BuildRequires: libmysqlclient-devel
%endif
BuildRequires: libxml2-devel
BuildRequires: update-alternatives
Summary: Enterprise-class open source distributed monitoring solution
License: GPL-2.0+
Group: System/Monitoring
%description
Zabbix is an enterprise-class open source distributed monitoring solution.
%package agent
Requires(pre): pwdutils %insserv_prereq %fillup_prereq
Summary: The Zabbix agents
Group: System/Monitoring
%description agent
The Zabbix agent monitors local resources and relays information to the server.
%package server
Requires: zabbix_server_binary = %{version}-%{release}
Requires(pre): pwdutils %insserv_prereq %fillup_prereq
Summary: The Zabbix server
Group: System/Monitoring
%description server
The Zabbix server component.
%package proxy
Requires: zabbix_proxy_binary = %{version}-%{release}
Requires(pre): pwdutils %insserv_prereq %fillup_prereq
Summary: The Zabbix proxy
Group: System/Monitoring
%description proxy
The Zabbix proxy component.
%package phpfrontend
Requires: php5%{?php_minor}
Requires: php5%{?php_minor}-bcmath
Requires: php5%{?php_minor}-ctype
Requires: php5%{?php_minor}-gd
Requires: php5%{?php_minor}-ldap
Requires: php5%{?php_minor}-mbstring
Requires: php5%{?php_minor}-sockets
Summary: Zabbix web frontend (php)
Group: Productivity/Networking/Web/Frontends
%description phpfrontend
The Zabbix PHP frontend allows easy access via standard web browsers.
NOTE: You still have to install the PHP package which contains your db driver!
%package server-mysql
Provides: %{name} = %{version}-%{release}
Provides: zabbix_server_binary = %{version}-%{release}
Requires: %{name}-server = %{version}-%{release}
Requires(post): update-alternatives
Requires(postun): update-alternatives
Summary: Zabbix server with MySQL support
Group: System/Monitoring
%description server-mysql
The Zabbix server compiled with MySQL support.
%package server-postgresql
Provides: %{name} = %{version}-%{release}
Provides: zabbix_server_binary = %{version}-%{release}
Requires: %{name}-server = %{version}-%{release}
Requires(post): update-alternatives
Requires(postun): update-alternatives
Summary: Zabbix server with PostgreSQL support
Group: System/Monitoring
%description server-postgresql
The Zabbix server compiled with PostgreSQL support.
%package server-sqlite
Provides: %{name} = %{version}-%{release}
Provides: zabbix_server_binary = %{version}-%{release}
Requires: %{name}-server = %{version}-%{release}
Requires(post): update-alternatives
Requires(postun): update-alternatives
Summary: Zabbix server with SQLite support
Group: System/Monitoring
%description server-sqlite
The Zabbix server compiled with SQLite support.
%package proxy-mysql
Provides: %{name} = %{version}-%{release}
Provides: zabbix_proxy_binary = %{version}-%{release}
Requires: %{name}-proxy = %{version}-%{release}
Requires(post): update-alternatives
Requires(postun): update-alternatives
Summary: Zabbix proxy with MySQL support
Group: System/Monitoring
%description proxy-mysql
The Zabbix proxy compiled with MySQL support.
%package proxy-postgresql
Provides: %{name} = %{version}-%{release}
Provides: zabbix_proxy_binary = %{version}-%{release}
Requires: %{name}-proxy = %{version}-%{release}
Requires(post): update-alternatives
Requires(postun): update-alternatives
Summary: Zabbix proxy with PostgreSQL support
Group: System/Monitoring
%description proxy-postgresql
The Zabbix proxy compiled with PostgreSQL support.
%package proxy-sqlite
Provides: %{name} = %{version}-%{release}
Provides: zabbix_proxy_binary = %{version}-%{release}
Requires: %{name}-proxy = %{version}-%{release}
Requires(post): update-alternatives
Requires(postun): update-alternatives
Summary: Zabbix proxy with SQLite support
Group: System/Monitoring
%description proxy-sqlite
The Zabbix proxy compiled with SQLite support.
%if 0%{?_with_java:1}
%package java-gateway
Provides: %{name} = %{version}-%{release}
Requires: jre
Summary: Zabbix java gateway
Group: System/Monitoring
%description java-gateway
Zabbix to java jmx gateway
%endif
%prep
%setup -q -n zabbix-%{version}%{?rclevel}
%patch0
%patch1
%patch2
%__cp %{S:6} .
#fix source & config files to respect adapted names
for file in src/zabbix_java/settings.sh conf/*.conf misc/init.d/suse/*/zabbix_* src/zabbix_server/server.c \
src/zabbix_server/alerter/alerter.c src/zabbix_agent/zbxconf.c src/zabbix_agent/zabbix_agentd.c src/zabbix_proxy/proxy.c ChangeLog; do
%__sed -i -e "s#/home/zabbix/bin#%{_bindir}#g" \
-e "s#^[# ]*PidFile=/tmp/zabbix_#PidFile=%{_rundir}/%{agent_user}/zabbix-#g" \
-e "s#^[# ]*LogFile=/tmp/zabbix_#LogFile=%{_localstatedir}/log/%{agent_user}/zabbix-#g" \
-e "s@^[# ]*DBSocket=/tmp/mysql.sock@DBSocket=%{_rundir}/mysql/mysql.sock@g" \
-e "s#DBUser=root#DBUser=zabbix#g" \
-e "s#^[# ]*DBPassword=.*#DBPassword=zabbix#g" \
-e "s#zabbix_agentd.userparams.conf#zabbix-agentd.userparams.conf#g" \
-e "s#zabbix_agentd.conf#zabbix-agentd.conf#g" \
-e "s#zabbix_server.conf#zabbix-server.conf#g" \
-e "s#zabbix_proxy.conf#zabbix-proxy.conf#g" \
-e 's#PID_FILE="/tmp/zabbix_#PID_FILE="%{_rundir}/%{agent_user}/zabbix-#g' \
-e "s#Hostname=Zabbix Server#Hostname=Zabbix_Server#" $file
done
# fix server and proxy config for log and run location...
for file in conf/zabbix_proxy.conf conf/zabbix_server.conf ; do
%__sed -i -e "s#^[# ]*LogFile=/var/log/.*/zabbix-#LogFile=%{_localstatedir}/log/%{server_user}/zabbix-#g" \
-e "s#^[# ]*PidFile=/var/run/.*/zabbix-#PidFile=%{_rundir}/%{server_user}/zabbix-#g" \
-e 's#PID_FILE="/var/run/.*/zabbix-#PID_FILE="%{_rundir}/%{server_user}/zabbix-#g' $file
done
#fix db content to respect adapted names and suse naming conventions
for file in database/*/data.sql; do
%__sed -i -e "s#syslogd#syslog-ng#g" \
-e "s#Syslogd#Syslog-ng#g" \
-e "s#Zabbix_agent#Zabbix-agent#g" \
-e "s#zabbix_agent#zabbix-agent#g" \
-e "s#Zabbix_server#Zabbix-server#g" \
-e "s#zabbix_server#zabbix-server#g" \
-e "s#Zabbix_proxy#Zabbix-proxy#g" \
-e "s#zabbix_proxy#zabbix-proxy#g" \
-e "s#httpd#httpd2-prefork#g" $file
done
##### Fix for date time macros
REF_DATE=$(LANG=C date -r configure +"%%b %%d %%Y")
REF_TIME=$(LANG=C date -r configure +"%%H:%%M:%%S")
sed -i -e "s/__DATE__/\"${REF_DATE}\"/g" -e "s/__TIME__/\"${REF_TIME}\"/g" src/libs/zbxcommon/str.c
#####
##### Fix location of zabbix java gateway location
sed -ri 's@^(ZABBIX_JAVA_CONF=.\{ZABBIX_JAVA_CONF:=).*@\1%{_sysconfdir}/zabbix/zabbix-java-gateway.conf}@g' %{S:17}
%if 0%{?suse_version} < 1110
######### Fix building on SLE 10 #############
sed -ri 's/(_full_libnetsnmp_libs=).*/\1"`$_libnetsnmp_config --libs` -lcrypto"/' configure
##############################################
%endif
%build
# autoreconf not needed anymore
#autoreconf -i
ZABBIX_BASIC_CONFIG="%{expand:%{basic_configuration}} %{?_with_openipmi} %{?_with_java} %{?_with_ipv6} %{?_with_ssh2} %{?_with_ldap} %{?_with_odbc}"
ZABBIX_BASIC_CONFIG="$ZABBIX_BASIC_CONFIG %{?_with_libcurl} %{?_with_jabber} %{?_with_openipmi} %{?_with_net_snmp} %{?_with_vmware} %{?_with_libxml2}"
#build MySQL binaries
# only sle care about 1.5 level of java bytecode others do not
%if 0%{?_with_java:1} && 0%{?sles_version}
JAVAC="javac -source 1.5 -target 1.5"
%else
JAVAC=javac
%endif
export JAVAC
%configure $ZABBIX_BASIC_CONFIG --with-mysql
%__make %{?_smp_mflags} JAVAC="$JAVAC"
%__cp src/zabbix_server/zabbix_server zabbix-server-mysql
%__cp src/zabbix_proxy/zabbix_proxy zabbix-proxy-mysql
#build PostgreSQL binaries
%__make clean
%configure $ZABBIX_BASIC_CONFIG --with-postgresql
%__make %{?_smp_mflags} JAVAC="$JAVAC"
%__cp src/zabbix_server/zabbix_server zabbix-server-postgresql
%__cp src/zabbix_proxy/zabbix_proxy zabbix-proxy-postgresql
#build SQLite binaries
%__make clean
%configure $ZABBIX_BASIC_CONFIG --with-sqlite3
%__make %{?_smp_mflags} JAVAC="$JAVAC"
%__cp src/zabbix_server/zabbix_server zabbix-server-sqlite
%__cp src/zabbix_proxy/zabbix_proxy zabbix-proxy-sqlite
%__cp src/zabbix_get/zabbix_get zabbix-get
%__cp src/zabbix_agent/zabbix_agent zabbix-agent
%__cp src/zabbix_agent/zabbix_agentd zabbix-agentd
%__cp src/zabbix_sender/zabbix_sender zabbix-sender
#generate man pages
for prog in zabbix-server-mysql zabbix-proxy-mysql zabbix-server-postgresql \
zabbix-proxy-postgresql zabbix-server-sqlite zabbix-proxy-sqlite \
zabbix-get zabbix-agent zabbix-agentd zabbix-sender ; do
# workaround should be uncommented if removed patch for compilation..
# echo "#!/bin/sh" >> ${prog}.sh
# echo "./${prog} \$* | sed -e '/Compilation time/d'" >> ${prog}.sh
# chmod 755 ${prog}.sh
# help2man -N -o ${prog}.1 ./${prog}.sh
help2man -N -o ${prog}.1 ./${prog}
done
%install
# SLE 11 does not like new java bytecode so just ignore that check
export NO_BRP_CHECK_BYTECODE_VERSION=true
#install the binaries
#server
%__install -Dm 0755 zabbix-server-mysql %{buildroot}%{_sbindir}/zabbix-server-mysql
%__install -Dm 0755 zabbix-server-postgresql %{buildroot}%{_sbindir}/zabbix-server-postgresql
%__install -Dm 0755 zabbix-server-sqlite %{buildroot}%{_sbindir}/zabbix-server-sqlite
%__install -Dm 0755 src/zabbix_get/zabbix_get %{buildroot}%{_bindir}/zabbix-get
#proxy
%__install -Dm 0755 zabbix-proxy-mysql %{buildroot}%{_sbindir}/zabbix-proxy-mysql
%__install -Dm 0755 zabbix-proxy-postgresql %{buildroot}%{_sbindir}/zabbix-proxy-postgresql
%__install -Dm 0755 zabbix-proxy-sqlite %{buildroot}%{_sbindir}/zabbix-proxy-sqlite
#agents
%__install -Dm 0755 src/zabbix_agent/zabbix_agent %{buildroot}%{_sbindir}/zabbix-agent
%__install -Dm 0755 src/zabbix_agent/zabbix_agentd %{buildroot}%{_sbindir}/zabbix-agentd
%__install -Dm 0755 src/zabbix_sender/zabbix_sender %{buildroot}%{_sbindir}/zabbix-sender
# Manual pages
%__install -Dm 0644 zabbix-agent.1 %{buildroot}%{_mandir}/man1/zabbix-agent.1
%__install -Dm 0644 zabbix-agentd.1 %{buildroot}%{_mandir}/man1/zabbix-agentd.1
%__install -Dm 0644 zabbix-get.1 %{buildroot}%{_mandir}/man1/zabbix-get.1
%__install -Dm 0644 zabbix-proxy-mysql.1 %{buildroot}%{_mandir}/man1/zabbix-proxy-mysql.1
%__install -Dm 0644 zabbix-proxy-postgresql.1 %{buildroot}%{_mandir}/man1/zabbix-proxy-postgresql.1
%__install -Dm 0644 zabbix-proxy-sqlite.1 %{buildroot}%{_mandir}/man1/zabbix-proxy-sqlite.1
%__install -Dm 0644 zabbix-sender.1 %{buildroot}%{_mandir}/man1/zabbix-sender.1
%__install -Dm 0644 zabbix-server-mysql.1 %{buildroot}%{_mandir}/man1/zabbix-server-mysql.1
%__install -Dm 0644 zabbix-server-postgresql.1 %{buildroot}%{_mandir}/man1/zabbix-server-postgresql.1
%__install -Dm 0644 zabbix-server-sqlite.1 %{buildroot}%{_mandir}/man1/zabbix-server-sqlite.1
# update-alternatives handling for manual pages
install -d -m 0755 %{buildroot}%{_sysconfdir}/alternatives
touch -r /bin/true %{buildroot}%{_sysconfdir}/alternatives/zabbix-server
touch -r /bin/true %{buildroot}%{_sysconfdir}/alternatives/zabbix-proxy
touch -r /etc/passwd %{buildroot}%{_sysconfdir}/alternatives/zabbix-server.1%{?ext_man}
touch -r /etc/passwd %{buildroot}%{_sysconfdir}/alternatives/zabbix-proxy.1%{?ext_man}
ln -s %{_sysconfdir}/alternatives/zabbix-server.1 %{buildroot}%{_mandir}/man1/zabbix-server.1
ln -s %{_sysconfdir}/alternatives/zabbix-proxy.1 %{buildroot}%{_mandir}/man1/zabbix-proxy.1
#install the php frontend
%__mkdir_p %{buildroot}%{_datadir}/zabbix
%__cp -r frontends/php/* %{buildroot}%{_datadir}/zabbix
%__install -Dm 0644 %{S:5} %{buildroot}%{apache2_sysconfdir}/conf.d/zabbix.conf
# remove .htaccess files as access rules are moved to zabbix.conf
find %{buildroot}%{_datadir}/zabbix -name .htaccess -exec rm -v {} \;
#create directory structure
%__install -d %{buildroot}%{_localstatedir}/log/%{server_user}
%__install -d %{buildroot}%{_localstatedir}/log/%{agent_user}
%__install -d %{buildroot}%{_rundir}/%{server_user}
%__install -d %{buildroot}%{_rundir}/%{agent_user}
#install the config files
%__install -Dm 0640 conf/zabbix_agent.conf %{buildroot}%{_sysconfdir}/zabbix/zabbix-agent.conf
%__install -Dm 0640 conf/zabbix_agentd.conf %{buildroot}%{_sysconfdir}/zabbix/zabbix-agentd.conf
%__install -Dm 0640 conf/zabbix_server.conf %{buildroot}%{_sysconfdir}/zabbix/zabbix-server.conf
%__install -Dm 0640 conf/zabbix_proxy.conf %{buildroot}%{_sysconfdir}/zabbix/zabbix-proxy.conf
#set the rc sym links
%if 0%{?suse_version} >= 1210
%__ln_s /usr/sbin/service %{buildroot}%{_sbindir}/rczabbix-agentd
%__ln_s /usr/sbin/service %{buildroot}%{_sbindir}/rczabbix-server
%__ln_s /usr/sbin/service %{buildroot}%{_sbindir}/rczabbix-proxy
%if 0%{?_with_java:1}
%__ln_s /usr/sbin/service %{buildroot}%{_sbindir}/rczabbix-java-gateway
%endif
%else
%__ln_s %{_initddir}/zabbix-agentd %{buildroot}%{_sbindir}/rczabbix-agentd
%__ln_s %{_initddir}/zabbix-server %{buildroot}%{_sbindir}/rczabbix-server
%__ln_s %{_initddir}/zabbix-proxy %{buildroot}%{_sbindir}/rczabbix-proxy
%if 0%{?_with_java:1}
%__ln_s %{_initddir}/zabbix-java-gateway %{buildroot}%{_sbindir}/rczabbix-java-gateway
%endif
%endif
%if 0%{?suse_version} <= 1220
#install the init.d scripts
%__install -Dm 0755 %{S:2} %{buildroot}%{_initddir}/zabbix-agentd
%__install -Dm 0755 %{S:3} %{buildroot}%{_initddir}/zabbix-server
%__install -Dm 0755 %{S:4} %{buildroot}%{_initddir}/zabbix-proxy
%if 0%{?_with_java:1}
%__install -Dm 0755 %{S:10} %{buildroot}%{_initddir}/zabbix-java-gateway
%endif
%endif
#install firewall description files
%__install -d 0755 %{buildroot}%{SuSeFirewall_services_dir}
%if 0%{?suse_version} > 1020
%__install -m 0644 %{S:7} %{buildroot}%{SuSeFirewall_services_dir}/zabbix-agentd
%__install -m 0644 %{S:8} %{buildroot}%{SuSeFirewall_services_dir}/zabbix-server
%__install -m 0644 %{S:18} %{buildroot}%{SuSeFirewall_services_dir}/zabbix-proxy
%if 0%{?_with_java:1}
%__install -m 0644 %{S:9} %{buildroot}%{SuSeFirewall_services_dir}/zabbix-java-gateway
%endif
%endif
ln -s %{_sysconfdir}/alternatives/zabbix-proxy %{buildroot}%{_sbindir}/zabbix-proxy
ln -s %{_sysconfdir}/alternatives/zabbix-server %{buildroot}%{_sbindir}/zabbix-server
touch -r /bin/true %{buildroot}%{_sysconfdir}/alternatives/zabbix-server
touch -r /bin/true %{buildroot}%{_sysconfdir}/alternatives/zabbix-proxy
%if 0%{?_with_java:1}
#install java gateway files
%__install -dm 0755 %{buildroot}%{_prefix}/lib/zabbix-java-gateway
%__cp -r src/zabbix_java/lib/*.jar %{buildroot}%{_prefix}/lib/zabbix-java-gateway
%__install -Dm 0644 src/zabbix_java/bin/zabbix-java-gateway-%{version}%{?rclevel}.jar %{buildroot}%{_prefix}/lib/zabbix-java-gateway/zabbix-java-gateway-%{version}%{?rclevel}.jar
%__install -m 0644 src/zabbix_java/settings.sh %{buildroot}%{_sysconfdir}/zabbix/zabbix-java-gateway.conf
%__install -m 0644 src/zabbix_java/lib/logback.xml %{buildroot}%{_sysconfdir}/zabbix/zabbix-java-gateway-log.xml
%__install -m 0755 %{S:17} %{buildroot}%{_bindir}/zabbix-java-gateway
%endif
%if 0%{?suse_version} > 1020
%fdupes %{buildroot}
%endif
# install systemd unit files
%if 0%{?suse_version} >= 1210
%__install -Dm 0644 %{SOURCE11} %{buildroot}/%{_unitdir}/zabbix-server.service
%__install -Dm 0644 %{SOURCE12} %{buildroot}/%{_unitdir}/zabbix-agentd.service
%__install -Dm 0644 %{SOURCE13} %{buildroot}/%{_unitdir}/zabbix-proxy.service
%__install -dm 0755 %{buildroot}/%{_unitdir}/zabbix-server.service.requires
%__install -dm 0755 %{buildroot}/%{_unitdir}/zabbix-proxy.service.requires
%if 0%{?_with_java:1}
%__install -Dm 0644 %{SOURCE14} %{buildroot}/%{_unitdir}/zabbix-java-gateway.service
%endif
# this stupidity is required because i do not wanna create separate zabbix-common
# in case i ever do it will put it under one scope...
mkdir -p %{buildroot}%{_prefix}/lib/tmpfiles.d
sed -e 's@/var/run/zabbix@%{_rundir}/%{server_user}@g; s/root zabbix/root %{server_group}/g' %{SOURCE16} > %{buildroot}%{_prefix}/lib/tmpfiles.d/zabbix-server.conf
sed -e 's@/var/run/zabbix@%{_rundir}/%{server_user}@g; s/root zabbix/root %{server_group}/g' %{SOURCE16} > %{buildroot}%{_prefix}/lib/tmpfiles.d/zabbix-proxy.conf
sed -e 's@/var/run/zabbix@%{_rundir}/%{agent_user}@g; s/root zabbix/root %{agent_group}/g' %{SOURCE16} > %{buildroot}%{_prefix}/lib/tmpfiles.d/zabbix-agentd.conf
sed -e 's/root zabbix/root %{server_group}/g' %{SOURCE16} > %{buildroot}%{_prefix}/lib/tmpfiles.d/zabbix-java-gateway.conf
%endif
###################################################################################
# Release Notes...
cp %{SOURCE15} .
%pre server
%if 0%{?suse_version} >= 1210
%service_add_pre zabbix-server.service
%endif
%{_bindir}/getent group %{server_group} >/dev/null || %{_sbindir}/groupadd -r %{server_group} || :
%{_bindir}/getent passwd %{server_user} >/dev/null || %{_sbindir}/useradd -r -d %{_localstatedir}/lib/%{server_user} -s /bin/false -c "Zabbix Server Daemon" -g %{server_group} %{server_user} || :
%pre proxy
%if 0%{?suse_version} >= 1210
%service_add_pre zabbix-proxy.service
%endif
%{_bindir}/getent group %{server_group} >/dev/null || %{_sbindir}/groupadd -r %{server_group} || :
%{_bindir}/getent passwd %{server_user} >/dev/null || %{_sbindir}/useradd -r -d %{_localstatedir}/lib/%{server_user} -s /bin/false -c "Zabbix Proxy Daemon" -g %{server_group} %{server_user} || :
%pre agent
%if 0%{?suse_version} >= 1210
%service_add_pre zabbix-agentd.service
%endif
%{_bindir}/getent group %{agent_group} >/dev/null || %{_sbindir}/groupadd -r %{agent_group} || :
%{_bindir}/getent passwd %{agent_user} >/dev/null || %{_sbindir}/useradd -r -d %{_localstatedir}/lib/%{agent_user} -s /bin/false -c "Zabbix Agent Daemon" -g %{agent_group} %{agent_user} || :
%if 0%{?_with_java:1}
%pre java-gateway
%if 0%{?suse_version} >= 1210
%service_add_pre zabbix-java-gateway.service
%endif
%{_bindir}/getent group %{server_group} >/dev/null || %{_sbindir}/groupadd -r %{server_group} || :
%{_bindir}/getent passwd %{server_user} >/dev/null || %{_sbindir}/useradd -r -d %{_localstatedir}/lib/%{server_user} -s /bin/false -c "Zabbix Java Daemon" -g %{server_group} %{server_user} || :
%endif
%post server
if [ "$1" -gt 1 ]; then
chown root.%{server_group} %{_sysconfdir}/zabbix/zabbix-server.conf
chmod 0640 %{_sysconfdir}/zabbix/zabbix-server.conf
chown -R root.%{server_group} %{_rundir}/%{server_user} || :
chown -R root.%{server_group} %{_localstatedir}/log/%{server_user} || :
if [ $(stat -c '%a' %{_rundir}/%{server_user}) -ne '770' ]; then
chmod 0770 %{_rundir}/%{server_user}
chmod 0770 %{_localstatedir}/log/%{server_user}
fi
fi
%if 0%{?suse_version} >= 1210
%service_add_post zabbix-server.service
systemd-tmpfiles --create /usr/lib/tmpfiles.d/zabbix-server.conf
%else
%fillup_and_insserv -f zabbix-server
%endif
%post proxy
if [ "$1" -gt 1 ]; then
chown root.%{server_group} %{_sysconfdir}/zabbix/zabbix-proxy.conf
chmod 0640 %{_sysconfdir}/zabbix/zabbix-proxy.conf
chown -R root.%{server_group} %{_rundir}/%{server_user} || :
chown -R root.%{server_group} %{_localstatedir}/log/%{server_user} || :
if [ $(stat -c '%a' %{_rundir}/%{server_user}) -ne '770' ]; then
chmod 0770 %{_rundir}/%{server_user}
chmod 0770 %{_localstatedir}/log/%{server_user}
fi
fi
%if 0%{?suse_version} >= 1210
%service_add_post zabbix-proxy.service
systemd-tmpfiles --create /usr/lib/tmpfiles.d/zabbix-proxy.conf
%else
%fillup_and_insserv -f zabbix-proxy
%endif
%if 0%{?_with_java:1}
%post java-gateway
if [ "$1" -gt 1 ]; then
chown root.%{server_group} %{_sysconfdir}/zabbix/zabbix-java-gateway.conf
chmod 0640 %{_sysconfdir}/zabbix/zabbix-java-gateway.conf
chown -R root.%{server_group} %{_rundir}/%{server_user} || :
chown -R root.%{server_group} %{_localstatedir}/log/%{server_user} || :
if [ $(stat -c '%a' %{_rundir}/%{server_user}) -ne '770' ]; then
chmod 0770 %{_rundir}/%{server_user}
chmod 0770 %{_localstatedir}/log/%{server_user}
fi
fi
%if 0%{?suse_version} >= 1210
%service_add_post zabbix-java-gateway.service
systemd-tmpfiles --create /usr/lib/tmpfiles.d/zabbix-java-gateway.conf
%else
%fillup_and_insserv -f zabbix-java-gateway
%endif
%endif
%post agent
if [ "$1" -gt 1 ]; then
chown root.%{agent_group} %{_sysconfdir}/zabbix/zabbix-agent*.conf
chmod 0640 %{_sysconfdir}/zabbix/zabbix-agent*.conf
chown -R root.%{agent_group} %{_rundir}/%{agent_user} || :
chown -R root.%{agent_group} %{_localstatedir}/log/%{agent_user} || :
if [ $(stat -c '%a' %{_rundir}/%{agent_user}) -ne '770' ]; then
chmod 0770 %{_rundir}/%{agent_user}
chmod 0770 %{_localstatedir}/log/%{agent_user}
fi
fi
%if 0%{?suse_version} >= 1210
%service_add_post zabbix-agentd.service
systemd-tmpfiles --create /usr/lib/tmpfiles.d/zabbix-agentd.conf
%else
%fillup_and_insserv -f zabbix-agentd
%endif
%post server-mysql
%{_sbindir}/update-alternatives --install %{_sbindir}/zabbix-server zabbix-server %{_sbindir}/zabbix-server-mysql 11 \
--slave %{_mandir}/man1/zabbix-server.1%{?ext_man} zabbix-server.1%{?ext_man} %{_mandir}/man1/zabbix-server-mysql.1%{?ext_man}
%post server-postgresql
%{_sbindir}/update-alternatives --install %{_sbindir}/zabbix-server zabbix-server %{_sbindir}/zabbix-server-postgresql 11 \
--slave %{_mandir}/man1/zabbix-server.1%{?ext_man} zabbix-server.1%{?ext_man} %{_mandir}/man1/zabbix-server-postgresql.1%{?ext_man}
%post server-sqlite
%{_sbindir}/update-alternatives --install %{_sbindir}/zabbix-server zabbix-server %{_sbindir}/zabbix-server-sqlite 10 \
--slave %{_mandir}/man1/zabbix-server.1%{?ext_man} zabbix-server.1%{?ext_man} %{_mandir}/man1/zabbix-server-sqlite.1%{?ext_man}
%post proxy-mysql
%{_sbindir}/update-alternatives --install %{_sbindir}/zabbix-proxy zabbix-proxy %{_sbindir}/zabbix-proxy-mysql 11 \
--slave %{_mandir}/man1/zabbix-proxy.1%{?ext_man} zabbix-proxy.1%{?ext_man} %{_mandir}/man1/zabbix-proxy-mysql.1%{?ext_man}
%post proxy-postgresql
%{_sbindir}/update-alternatives --install %{_sbindir}/zabbix-proxy zabbix-proxy %{_sbindir}/zabbix-proxy-postgresql 11 \
--slave %{_mandir}/man1/zabbix-proxy.1%{?ext_man} zabbix-proxy.1%{?ext_man} %{_mandir}/man1/zabbix-proxy-postgresql.1%{?ext_man}
%post proxy-sqlite
%{_sbindir}/update-alternatives --install %{_sbindir}/zabbix-proxy zabbix-proxy %{_sbindir}/zabbix-proxy-sqlite 10 \
--slave %{_mandir}/man1/zabbix-proxy.1%{?ext_man} zabbix-proxy.1%{?ext_man} %{_mandir}/man1/zabbix-proxy-sqlite.1%{?ext_man}
%preun server
%if 0%{?suse_version} >= 1220
%service_del_preun zabbix-server.service
%else
%stop_on_removal zabbix-server
%endif
%preun proxy
%if 0%{?suse_version} >= 1220
%service_del_preun zabbix-proxy.service
%else
%stop_on_removal zabbix-proxy
%endif
%if 0%{?_with_java:1}
%preun java-gateway
%if 0%{?suse_version} >= 1220
%service_del_preun zabbix-java-gateway.service
%else
%stop_on_removal zabbix-java-gateway
%endif
%endif
%preun agent
%if 0%{?suse_version} >= 1220
%service_del_preun zabbix-agentd.service
%else
%stop_on_removal zabbix-agentd
%endif
%preun server-mysql
if [ "$1" = 0 ] ; then
%{_sbindir}/update-alternatives --remove zabbix-server %{_sbindir}/zabbix-server-mysql
fi
%preun server-postgresql
if [ "$1" = 0 ] ; then
%{_sbindir}/update-alternatives --remove zabbix-server %{_sbindir}/zabbix-server-postgresql
fi
%preun server-sqlite
if [ "$1" = 0 ] ; then
%{_sbindir}/update-alternatives --remove zabbix-server %{_sbindir}/zabbix-server-sqlite
fi
%preun proxy-mysql
if [ "$1" = 0 ] ; then
%{_sbindir}/update-alternatives --remove zabbix-proxy %{_sbindir}/zabbix-proxy-mysql
fi
%preun proxy-postgresql
if [ "$1" = 0 ] ; then
%{_sbindir}/update-alternatives --remove zabbix-proxy %{_sbindir}/zabbix-proxy-postgresql
fi
%preun proxy-sqlite
if [ "$1" = 0 ] ; then
%{_sbindir}/update-alternatives --remove zabbix-proxy %{_sbindir}/zabbix-proxy-sqlite
fi
%postun server
%if 0%{?suse_version} >= 1220
%service_del_postun zabbix-server.service
%else
%restart_on_update zabbix-server
%insserv_cleanup
%endif
%postun proxy
%if 0%{?suse_version} >= 1220
%service_del_postun zabbix-proxy.service
%else
%restart_on_update zabbix-proxy
%insserv_cleanup
%endif
%if 0%{?_with_java:1}
%postun java-gateway
%if 0%{?suse_version} >= 1220
%service_del_postun zabbix-java-gateway.service
%else
%restart_on_update zabbix-java-gateway
%insserv_cleanup
%endif
%endif
%postun agent
%if 0%{?suse_version} >= 1220
%service_del_postun zabbix-agentd.service
%else
%restart_on_update zabbix-agentd
%insserv_cleanup
%endif
%clean
[[ %{buildroot} != "" && %{buildroot} != "/" ]] && %__rm -rf %{buildroot}
%files server
%defattr(-,root,root)
%doc AUTHORS ChangeLog database/*/ upgrades/dbpatches rn2.2.0.html
%if 0%{?suse_version} <= 1220
%{_initddir}/zabbix-server
%endif
%dir %{_sysconfdir}/zabbix
%config(noreplace) %attr(0640, root, %{server_group}) %{_sysconfdir}/zabbix/zabbix-server.conf
%if 0%{?suse_version} && 0%{?suse_version} > 1020
%config %{SuSeFirewall_services_dir}/zabbix-server
%endif
%{_bindir}/zabbix-get
%{_sbindir}/zabbix-server
%{_sbindir}/rczabbix-server
%attr(0770,root,%{server_group}) %dir %{_localstatedir}/log/%{server_user}
%ghost %attr(0770,root,%{server_group}) %dir %{_rundir}/%{server_user}
%{_mandir}/man1/zabbix-get.1*
%{_mandir}/man1/zabbix-server.1%{?ext_man}
%if 0%{?suse_version} >= 1220
%{_unitdir}/zabbix-server.service
%{_unitdir}/zabbix-server.service.requires
%{_prefix}/lib/tmpfiles.d/zabbix-server.conf
%endif
%ghost %{_sysconfdir}/alternatives/zabbix-server
%ghost %{_sysconfdir}/alternatives/zabbix-server.1%{?ext_man}
%files proxy
%defattr(-,root,root)
%if 0%{?suse_version} <= 1220
%{_initddir}/zabbix-proxy
%endif
%{_sbindir}/zabbix-proxy
%{_sbindir}/rczabbix-proxy
%dir %{_sysconfdir}/zabbix
%config(noreplace) %attr(0640, root, %{server_group}) %{_sysconfdir}/zabbix/zabbix-proxy.conf
%if 0%{?suse_version} && 0%{?suse_version} > 1020
%config %{SuSeFirewall_services_dir}/zabbix-proxy
%endif
%attr(0770,root,%{server_group}) %dir %{_localstatedir}/log/%{server_user}
%ghost %attr(0770,root,%{server_group}) %dir %{_rundir}/%{server_user}
%{_mandir}/man1/zabbix-proxy.1%{?ext_man}
%if 0%{?suse_version} >= 1220
%{_unitdir}/zabbix-proxy.service
%{_unitdir}/zabbix-proxy.service.requires
%{_prefix}/lib/tmpfiles.d/zabbix-proxy.conf
%endif
%ghost %{_sysconfdir}/alternatives/zabbix-proxy
%ghost %{_sysconfdir}/alternatives/zabbix-proxy.1%{?ext_man}
%files agent
%defattr(-,root,root)
%if 0%{?suse_version} <= 1220
%{_initddir}/zabbix-agentd
%endif
%dir %{_sysconfdir}/zabbix
%config(noreplace) %attr(0640, root, %{agent_group}) %{_sysconfdir}/zabbix/zabbix-agent*.conf
%if 0%{?suse_version} && 0%{?suse_version} > 1020
%config %{SuSeFirewall_services_dir}/zabbix-agentd
%endif
%{_sbindir}/rczabbix-agentd
%{_sbindir}/zabbix-agent
%{_sbindir}/zabbix-agentd
%{_sbindir}/zabbix-sender
%attr(0770,root,%{agent_group}) %dir %{_localstatedir}/log/%{agent_user}
%ghost %attr(0770,root,%{agent_group}) %dir %{_rundir}/%{agent_user}
%{_mandir}/man1/zabbix-agentd.1%{?ext_man}
%{_mandir}/man1/zabbix-agent.1%{?ext_man}
%{_mandir}/man1/zabbix-sender.1%{?ext_man}
%if 0%{?suse_version} >= 1220
%{_unitdir}/zabbix-agentd.service
%{_prefix}/lib/tmpfiles.d/zabbix-agentd.conf
%endif
%files phpfrontend
%defattr(-,root,root)
%doc README.SUSE
%dir %{apache2_sysconfdir}
%dir %{apache2_sysconfdir}/conf.d
%config(noreplace) %{apache2_sysconfdir}/conf.d/zabbix.conf
%{_datadir}/zabbix
%files server-mysql
%defattr(-,root,root)
%{_sbindir}/zabbix-server-mysql
%if 0%{?suse_version} >= 1130
%ghost %_sysconfdir/alternatives/zabbix-server
%ghost %_sysconfdir/alternatives/zabbix-server.1%{?ext_man}
%endif
%{_mandir}/man1/zabbix-server-mysql.1%{?ext_man}
%files server-postgresql
%defattr(-,root,root)
%{_sbindir}/zabbix-server-postgresql
%if 0%{?suse_version} >= 1130
%ghost %_sysconfdir/alternatives/zabbix-server
%ghost %_sysconfdir/alternatives/zabbix-server.1%{?ext_man}
%endif
%{_mandir}/man1/zabbix-server-postgresql.1%{?ext_man}
%files server-sqlite
%defattr(-,root,root)
%{_sbindir}/zabbix-server-sqlite
%if 0%{?suse_version} >= 1130
%ghost %_sysconfdir/alternatives/zabbix-server
%ghost %_sysconfdir/alternatives/zabbix-server.1%{?ext_man}
%endif
%{_mandir}/man1/zabbix-server-sqlite.1%{?ext_man}
%files proxy-mysql
%defattr(-,root,root)
%{_sbindir}/zabbix-proxy-mysql
%if 0%{?suse_version} >= 1130
%ghost %_sysconfdir/alternatives/zabbix-proxy
%ghost %_sysconfdir/alternatives/zabbix-proxy.1%{?ext_man}
%endif
%{_mandir}/man1/zabbix-proxy-mysql.1%{?ext_man}
%files proxy-postgresql
%defattr(-,root,root)
%{_sbindir}/zabbix-proxy-postgresql
%if 0%{?suse_version} >= 1130
%ghost %_sysconfdir/alternatives/zabbix-proxy
%ghost %_sysconfdir/alternatives/zabbix-proxy.1%{?ext_man}
%endif
%{_mandir}/man1/zabbix-proxy-postgresql.1%{?ext_man}
%files proxy-sqlite
%defattr(-,root,root)
%{_sbindir}/zabbix-proxy-sqlite
%if 0%{?suse_version} >= 1130
%ghost %_sysconfdir/alternatives/zabbix-proxy
%ghost %_sysconfdir/alternatives/zabbix-proxy.1%{?ext_man}
%endif
%{_mandir}/man1/zabbix-proxy-sqlite.1%{?ext_man}
%if 0%{?_with_java:1}
%files java-gateway
%defattr(-,root,root)
%dir %{_sysconfdir}/zabbix
%config(noreplace) %attr(0640, root, %{server_group}) %{_sysconfdir}/zabbix/zabbix-java-gateway.conf
%config(noreplace) %attr(0640, root, %{server_group}) %{_sysconfdir}/zabbix/zabbix-java-gateway-log.xml
%dir %{_prefix}/lib/zabbix-java-gateway
%{_bindir}/zabbix-java-gateway
%{_prefix}/lib/zabbix-java-gateway/zabbix-java-gateway-%{version}%{?rclevel}.jar
%{_prefix}/lib/zabbix-java-gateway/android-json-4.3_r3.1.jar
%{_prefix}/lib/zabbix-java-gateway/slf4j-api-1.6.1.jar
%{_prefix}/lib/zabbix-java-gateway/logback-core-0.9.27.jar
%{_prefix}/lib/zabbix-java-gateway/logback-classic-0.9.27.jar
%if 0%{?suse_version} <= 1220
%{_initddir}/zabbix-java-gateway
%endif
%{_sbindir}/rczabbix-java-gateway
%attr(0770,root,%{server_group}) %dir %{_localstatedir}/log/%{server_user}
%ghost %attr(0770,root,%{server_group}) %dir %{_rundir}/%{server_user}
%if 0%{?suse_version} > 1020
%config %{SuSeFirewall_services_dir}/zabbix-java-gateway
%endif
%if 0%{?suse_version} >= 1220
%{_unitdir}/zabbix-java-gateway.service
%{_prefix}/lib/tmpfiles.d/zabbix-java-gateway.conf
%endif
%endif
%changelog