#/******************************************************************************
# * Icinga 2 *
-# * Copyright (C) 2012-2014 Icinga Development Team (http://www.icinga.org) *
+# * Copyright (C) 2012-2015 Icinga Development Team (http://www.icinga.org) *
# * *
# * This program is free software; you can redistribute it and/or *
# * modify it under the terms of the GNU General Public License *
%define revision 1
+# make sure that _rundir is working on older systems
+%if ! %{defined _rundir}
+%define _rundir %{_localstatedir}/run
+%endif
+
+%define _libexecdir %{_prefix}/lib/
+
%if "%{_vendor}" == "redhat"
-%define el5_boost_version 141
-%define el5_boost_libs %{_libdir}/boost%{el5_boost_version}
-%define el5_boost_includes /usr/include/boost%{el5_boost_version}
%define apachename httpd
%define apacheconfdir %{_sysconfdir}/httpd/conf.d
%define apacheuser apache
%define apachegroup apache
%if 0%{?el5}%{?el6}
%define use_systemd 0
+%if %(uname -m) != "x86_64"
+%define march_flag -march=i686
+%endif
%else
# fedora and el>=7
%define use_systemd 1
%endif
%if "%{_vendor}" == "suse"
+%define apachename apache2
+%define apacheconfdir %{_sysconfdir}/apache2/conf.d
+%define apacheuser wwwrun
+%define apachegroup www
%if 0%{?suse_version} >= 1310
%define use_systemd 1
-%define opensuse_boost_version 1_53_0
%else
%define use_systemd 0
-%define opensuse_boost_version 1_49_0
%endif
-%define sles_boost_version 1_54_0
-%define apachename apache2
-%define apacheconfdir %{_sysconfdir}/apache2/conf.d
-%define apacheuser wwwrun
-%define apachegroup www
%endif
%define icinga_user icinga
Summary: Network monitoring application
Name: icinga2
-Version: 2.0.1
+Version: 2.3.8
Release: %{revision}%{?dist}
License: GPL-2.0+
Group: Applications/System
-Source: %{name}-%{version}.tar.gz
-URL: http://www.icinga.org/
+Source: https://github.com/Icinga/%{name}/archive/v%{version}.tar.gz
+URL: https://www.icinga.org/
BuildRoot: %{_tmppath}/%{name}-%{version}-build
-
-Requires: %{name}-bin = %{version}
-#Requires: %{name}-ido-mysql = %{version}
-#Requires: %{icingaweb2name} >= %{icingaweb2version}
+Requires: %{name}-bin = %{version}-%{release}
%description
Meta package for Icinga 2 Core, DB IDO and Web.
Summary: Icinga 2 binaries and libraries
Group: Applications/System
-BuildRequires: openssl-devel
+%if "%{_vendor}" == "suse"
+PreReq: permissions
+Provides: monitoring_daemon
+Recommends: monitoring-plugins
+%if 0%{?suse_version} >= 1310
+BuildRequires: libyajl-devel
+%endif
+%endif
+BuildRequires: libedit-devel
+BuildRequires: ncurses-devel
+%if "%{_vendor}" == "suse" && 0%{?suse_version} < 1210
+BuildRequires: gcc47-c++
+BuildRequires: libstdc++47-devel
+BuildRequires: libopenssl1-devel
+%else
BuildRequires: gcc-c++
BuildRequires: libstdc++-devel
+BuildRequires: openssl-devel
+%endif
BuildRequires: cmake
BuildRequires: flex >= 2.5.35
BuildRequires: bison
BuildRequires: make
-# redhat
-%if "%{_vendor}" == "redhat"
-%if 0%{?el5} || 0%{?rhel} == 5 || "%{?dist}" == ".el5"
-# el5 requires EPEL
-BuildRequires: boost%{el5_boost_version}-devel
-BuildRequires: boost%{el5_boost_version}
-Requires: boost%{el5_boost_version}-program-options
-Requires: boost%{el5_boost_version}-system
-Requires: boost%{el5_boost_version}-test
-Requires: boost%{el5_boost_version}-thread
-Requires: boost%{el5_boost_version}-regex
+%if 0%{?build_icinga_org} && "%{_vendor}" == "redhat" && (0%{?el5} || 0%{?rhel} == 5 || "%{?dist}" == ".el5")
+# el5 requires packages.icinga.org
+BuildRequires: boost153-devel
+%else
+%if 0%{?build_icinga_org} && "%{_vendor}" == "suse" && 0%{?suse_version} < 1310
+# sles 11 sp3 requires packages.icinga.org
+BuildRequires: boost153-devel
%else
BuildRequires: boost-devel >= 1.41
-Requires: boost-program-options >= 1.41
-Requires: boost-system >= 1.41
-Requires: boost-test >= 1.41
-Requires: boost-thread >= 1.41
-Requires: boost-regex >= 1.41
-%endif
-%endif
-#redhat
-
-# suse
-%if "%{_vendor}" == "suse"
-# sles
-# note: sles_version macro is not set in SLES11 anymore
-# note: sles service packs are not under version control
-%if 0%{?suse_version} == 1110
-BuildRequires: gcc-fortran
-BuildRequires: libgfortran43
-BuildRequires: boost-license%{sles_boost_version}
-BuildRequires: boost-devel >= 1.41
-Requires: boost-license%{sles_boost_version}
-Requires: libboost_program_options%{sles_boost_version}
-Requires: libboost_system%{sles_boost_version}
-Requires: libboost_test%{sles_boost_version}
-Requires: libboost_thread%{sles_boost_version}
-Requires: libboost_regex%{sles_boost_version}
-%endif
-# opensuse
-%if 0%{?suse_version} >= 1210
-BuildRequires: boost-devel >= 1.41
-Requires: libboost_program_options%{opensuse_boost_version}
-Requires: libboost_system%{opensuse_boost_version}
-Requires: libboost_test%{opensuse_boost_version}
-Requires: libboost_thread%{opensuse_boost_version}
-Requires: libboost_regex%{opensuse_boost_version}
%endif
%endif
-# suse
%if 0%{?use_systemd}
BuildRequires: systemd
Requires: systemd
%endif
-Requires: %{name}-common = %{version}
+Requires: %{name}-common = %{version}-%{release}
%description bin
Icinga 2 is a general-purpose network monitoring application.
Group: Applications/System
%if "%{_vendor}" == "suse"
BuildRequires: libmysqlclient-devel
+%if 0%{?suse_version} >= 1310
+BuildRequires: mysql-devel
%endif
-%if "%{_vendor}" == "redhat"
-# el5 only provides mysql package
-%if 0%{?el5} || 0%{?rhel} == 5 || "%{?dist}" == ".el5"
-BuildRequires: mysql
+
%else
-BuildRequires: mysql-libs
-BuildRequires: mysql
-%endif
BuildRequires: mysql-devel
-Requires: mysql
-%endif
+%endif #suse
+
Requires: %{name} = %{version}-%{release}
%description ido-mysql
Icinga 2 IDO mysql database backend. Compatible with Icinga 1.x
-IDOUtils schema >= 1.10
+IDOUtils schema >= 1.12
%package ido-pgsql
Summary: IDO PostgreSQL database backend for Icinga 2
Group: Applications/System
BuildRequires: postgresql-devel
-Requires: postgresql-libs
Requires: %{name} = %{version}-%{release}
%description ido-pgsql
Icinga 2 IDO PostgreSQL database backend. Compatible with Icinga 1.x
-IDOUtils schema >= 1.10
+IDOUtils schema >= 1.12
%package classicui-config
BuildRequires: %{apachename}
Requires: %{apachename}
Requires: %{name} = %{version}-%{release}
+%if "%{_vendor}" == "suse"
+Recommends: icinga-www
+%endif
Provides: icinga-classicui-config
Conflicts: icinga-gui-config
-DCMAKE_INSTALL_SYSCONFDIR=/etc \
-DCMAKE_INSTALL_LOCALSTATEDIR=/var \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
+ -DCMAKE_VERBOSE_MAKEFILE=ON \
+ -DBoost_NO_BOOST_CMAKE=ON \
+ -DICINGA2_RUNDIR=%{_rundir} \
-DICINGA2_USER=%{icinga_user} \
-DICINGA2_GROUP=%{icinga_group} \
- -DICINGA2_COMMAND_USER=%{icinga_user} \
-DICINGA2_COMMAND_GROUP=%{icingacmd_group}"
%if "%{_vendor}" == "redhat"
%if 0%{?el5} || 0%{?rhel} == 5 || "%{?dist}" == ".el5"
# Boost_VERSION 1.41.0 vs 101400 - disable build tests
# details in https://dev.icinga.org/issues/5033
-CMAKE_OPTS="$CMAKE_OPTS -DBOOST_LIBRARYDIR=/usr/lib/boost141 \
- -DBOOST_INCLUDEDIR=/usr/include/boost141 \
- -DBoost_ADDITIONAL_VERSIONS='1.41;1.41.0' \
+CMAKE_OPTS="$CMAKE_OPTS -DBOOST_LIBRARYDIR=/usr/lib/boost153 \
+ -DBOOST_INCLUDEDIR=/usr/include/boost153 \
+ -DBoost_ADDITIONAL_VERSIONS='1.53;1.53.0' \
-DBoost_NO_SYSTEM_PATHS=TRUE \
-DBUILD_TESTING=FALSE \
-DBoost_NO_BOOST_CMAKE=TRUE"
%if "%{_vendor}" != "suse"
CMAKE_OPTS="$CMAKE_OPTS -DICINGA2_PLUGINDIR=%{_libdir}/nagios/plugins"
%else
+%if 0%{?suse_version} < 1310
+CMAKE_OPTS="$CMAKE_OPTS -DBOOST_LIBRARYDIR=/usr/lib/boost153 \
+ -DBOOST_INCLUDEDIR=/usr/include/boost153 \
+ -DBoost_ADDITIONAL_VERSIONS='1.53;1.53.0' \
+ -DBoost_NO_SYSTEM_PATHS=TRUE \
+ -DBUILD_TESTING=FALSE \
+ -DBoost_NO_BOOST_CMAKE=TRUE"
+%endif
CMAKE_OPTS="$CMAKE_OPTS -DICINGA2_PLUGINDIR=%{_prefix}/lib/nagios/plugins"
%endif
CMAKE_OPTS="$CMAKE_OPTS -DUSE_SYSTEMD=ON"
%endif
-cmake $CMAKE_OPTS .
+cmake $CMAKE_OPTS -DCMAKE_C_FLAGS:STRING="%{optflags} %{?march_flag}" -DCMAKE_CXX_FLAGS:STRING="%{optflags} %{?march_flag}" .
make %{?_smp_mflags}
-rm -f components/db_ido_*sql/schema/upgrade/.gitignore
%install
-[ "%{buildroot}" != "/" ] && [ -d "%{buildroot}" ] && rm -rf %{buildroot}
make install \
DESTDIR="%{buildroot}"
getent group %{icinga_group} >/dev/null || %{_sbindir}/groupadd -r %{icinga_group}
getent group %{icingacmd_group} >/dev/null || %{_sbindir}/groupadd -r %{icingacmd_group}
getent passwd %{icinga_user} >/dev/null || %{_sbindir}/useradd -c "icinga" -s /sbin/nologin -r -d %{_localstatedir}/spool/%{name} -G %{icingacmd_group} -g %{icinga_group} %{icinga_user}
-exit 0
-
%if "%{_vendor}" == "suse"
%if 0%{?use_systemd}
-%pre bin
%service_add_pre %{name}.service
%endif
%endif
+exit 0
+%if "%{_vendor}" == "suse"
+%verifyscript bin
+%verify_permissions -e %{_rundir}/%{name}/cmd
-# all restart/feature actions belong to icinga2-bin
+%if 0%{?suse_version} >= 1310
%post bin
-# suse
-%if 0%{?suse_version}
+%set_permissions %{_rundir}/%{name}/cmd
+%endif
+%endif
+%post common
+# suse
+%if "%{_vendor}" == "suse"
%if 0%{?use_systemd}
%fillup_only %{name}
%service_add_post %{name}.service
%endif
# initial installation, enable default features
-%{_sbindir}/icinga2-enable-feature checker notification mainlog
+for feature in checker notification mainlog; do
+ ln -sf ../features-available/${feature}.conf %{_sysconfdir}/%{name}/features-enabled/${feature}.conf
+done
exit 0
if [ ${1:-0} -eq 1 ]
then
# initial installation, enable default features
- %{_sbindir}/icinga2-enable-feature checker notification mainlog
+ for feature in checker notification mainlog; do
+ ln -sf ../features-available/${feature}.conf %{_sysconfdir}/%{name}/features-enabled/${feature}.conf
+ done
fi
exit 0
%endif
# suse/rhel
-%postun bin
+%postun common
# suse
-%if 0%{?suse_version}
+%if "%{_vendor}" == "suse"
%if 0%{?using_systemd}
%service_del_postun %{name}.service
%else
exit 0
-%preun bin
+%preun common
# suse
-%if 0%{?suse_version}
+%if "%{_vendor}" == "suse"
%if 0%{?use_systemd}
%service_del_preun %{name}.service
if [ ${1:-0} -eq 1 ]
then
# initial installation, enable ido-mysql feature
- %{_sbindir}/icinga2-enable-feature ido-mysql
+ ln -sf ../features-available/ido-mysql.conf %{_sysconfdir}/%{name}/features-enabled/ido-mysql.conf
fi
exit 0
%postun ido-mysql
if [ "$1" = "0" ]; then
# deinstallation of the package - remove feature
- test -x %{_sbindir}/icinga2-disable-feature && %{_sbindir}/icinga2-disable-feature ido-mysql
+ rm -f %{_sysconfdir}/%{name}/features-enabled/ido-mysql.conf
fi
exit 0
if [ ${1:-0} -eq 1 ]
then
# initial installation, enable ido-pgsql feature
- %{_sbindir}/icinga2-enable-feature ido-pgsql
+ ln -sf ../features-available/ido-pgsql.conf %{_sysconfdir}/%{name}/features-enabled/ido-pgsql.conf
fi
exit 0
%postun ido-pgsql
if [ "$1" = "0" ]; then
# deinstallation of the package - remove feature
- test -x %{_sbindir}/icinga2-disable-feature && %{_sbindir}/icinga2-disable-feature ido-pgsql
+ rm -f %{_sysconfdir}/%{name}/features-enabled/ido-pgsql.conf
fi
exit 0
if [ ${1:-0} -eq 1 ]
then
# initial installation, enable features
- %{_sbindir}/icinga2-enable-feature statusdata compatlog command
+ for feature in statusdata compatlog command; do
+ ln -sf ../features-available/${feature}.conf %{_sysconfdir}/%{name}/features-enabled/${feature}.conf
+ done
fi
exit 0
%postun classicui-config
if [ "$1" = "0" ]; then
# deinstallation of the package - remove feature
- test -x %{_sbindir}/icinga2-disable-feature && %{_sbindir}/icinga2-disable-feature statusdata
- test -x %{_sbindir}/icinga2-disable-feature && %{_sbindir}/icinga2-disable-feature compatlog
- test -x %{_sbindir}/icinga2-disable-feature && %{_sbindir}/icinga2-disable-feature command
+ for feature in statusdata compatlog command; do
+ rm -f %{_sysconfdir}/%{name}/features-enabled/${feature}.conf
+ done
fi
exit 0
%files
+%defattr(-,root,root,-)
+%doc COPYING
%files bin
%defattr(-,root,root,-)
-%doc COPYING COPYING.Exceptions README NEWS AUTHORS ChangeLog
+%doc COPYING COPYING.Exceptions README.md NEWS AUTHORS ChangeLog
+%{_sbindir}/%{name}
+%exclude %{_libdir}/%{name}/libdb_ido_mysql*
+%exclude %{_libdir}/%{name}/libdb_ido_pgsql*
+%dir %{_libdir}/%{name}
+%{_libdir}/%{name}/*.so*
+%{_datadir}/%{name}
+%exclude %{_datadir}/%{name}/include
+%{_mandir}/man8/%{name}.8.gz
+
+%attr(0750,%{icinga_user},%{icingacmd_group}) %{_localstatedir}/cache/%{name}
+%attr(0750,%{icinga_user},%{icingacmd_group}) %dir %{_localstatedir}/log/%{name}
+%attr(0750,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/log/%{name}/crash
+%attr(0750,%{icinga_user},%{icingacmd_group}) %dir %{_localstatedir}/log/%{name}/compat
+%attr(0750,%{icinga_user},%{icingacmd_group}) %dir %{_localstatedir}/log/%{name}/compat/archives
+%attr(0750,%{icinga_user},%{icinga_group}) %{_localstatedir}/lib/%{name}
+
+%attr(0750,%{icinga_user},%{icingacmd_group}) %ghost %{_rundir}/%{name}
+%attr(2750,%{icinga_user},%{icingacmd_group}) %ghost %{_rundir}/%{name}/cmd
+
+%files common
+%defattr(-,root,root,-)
+%doc COPYING COPYING.Exceptions README.md NEWS AUTHORS ChangeLog tools/syntax
+%attr(0750,%{icinga_user},%{icingacmd_group}) %dir %{_localstatedir}/log/%{name}
+%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
+%{_sysconfdir}/bash_completion.d/%{name}
%if 0%{?use_systemd}
-%attr(644,-,0) %{_unitdir}/%{name}.service
+%attr(644,root,root) %{_unitdir}/%{name}.service
%else
-%attr(755,-,-) %{_sysconfdir}/init.d/%{name}
+%attr(755,root,root) %{_sysconfdir}/init.d/%{name}
%endif
%if "%{_vendor}" == "suse"
%{_sbindir}/rc%{name}
%endif
%attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}
%attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/conf.d
-%attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/conf.d/hosts
-%attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/conf.d/hosts/localhost
%attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/features-available
+%exclude %{_sysconfdir}/%{name}/features-available/ido-*.conf
%attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/features-enabled
+%attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/repository.d
%attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/scripts
+%attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/repository.d
%attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/zones.d
%config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/%{name}.conf
+%config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/init.conf
%config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/constants.conf
%config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/zones.conf
%config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/conf.d/*.conf
-%config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/conf.d/hosts/*.conf
-%config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/conf.d/hosts/localhost/*.conf
%config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/features-available/*.conf
+%config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/repository.d/*
%config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/zones.d/*
%config(noreplace) %{_sysconfdir}/%{name}/scripts/*
-%{_sbindir}/%{name}
-%{_bindir}/%{name}-build-ca
-%{_bindir}/%{name}-build-key
-%{_bindir}/%{name}-sign-key
-%{_sbindir}/%{name}-enable-feature
-%{_sbindir}/%{name}-disable-feature
-%{_sbindir}/%{name}-prepare-dirs
-%exclude %{_libdir}/%{name}/libdb_ido_mysql*
-%exclude %{_libdir}/%{name}/libdb_ido_pgsql*
-%{_libdir}/%{name}
-%{_datadir}/%{name}
-%exclude %{_datadir}/%{name}/include
-%{_mandir}/man8/%{name}.8.gz
-%{_mandir}/man8/%{name}-enable-feature.8.gz
-%{_mandir}/man8/%{name}-disable-feature.8.gz
-%{_mandir}/man8/%{name}-build-ca.8.gz
-%{_mandir}/man8/%{name}-build-key.8.gz
-%{_mandir}/man8/%{name}-sign-key.8.gz
-%{_mandir}/man8/%{name}-prepare-dirs.8.gz
-
-%attr(0755,%{icinga_user},%{icinga_group}) %{_localstatedir}/cache/%{name}
-%attr(0755,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/log/%{name}
-%attr(0755,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/log/%{name}/compat
-%attr(0755,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/log/%{name}/compat/archives
-%attr(0755,%{icinga_user},%{icinga_group}) %ghost %{_localstatedir}/run/%{name}
-%attr(0750,%{icinga_user},%{icinga_group}) %{_localstatedir}/lib/%{name}
-
-%attr(2755,%{icinga_user},%{icingacmd_group}) %ghost %{_localstatedir}/run/icinga2/cmd
-
-%files common
-%defattr(-,root,root,-)
-%doc COPYING COPYING.Exceptions README NEWS AUTHORS ChangeLog tools/syntax
-%attr(0755,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/log/%{name}
-%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
+%dir %{_libexecdir}/%{name}
+%{_libexecdir}/%{name}/prepare-dirs
+%{_libexecdir}/%{name}/safe-reload
%attr(0750,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/spool/%{name}
-%attr(0750,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/spool/%{name}/perfdata
+%attr(0770,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/spool/%{name}/perfdata
%attr(0750,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/spool/%{name}/tmp
%attr(0750,%{icinga_user},%{icinga_group}) %dir %{_datadir}/%{name}/include
%{_datadir}/%{name}/include
%files ido-mysql
%defattr(-,root,root,-)
-%doc components/db_ido_mysql/schema COPYING COPYING.Exceptions README NEWS AUTHORS ChangeLog
+%doc COPYING COPYING.Exceptions README.md NEWS AUTHORS ChangeLog
+%config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/features-available/ido-mysql.conf
%{_libdir}/%{name}/libdb_ido_mysql*
+%{_datadir}/icinga2-ido-mysql
%files ido-pgsql
%defattr(-,root,root,-)
-%doc components/db_ido_pgsql/schema COPYING COPYING.Exceptions README NEWS AUTHORS ChangeLog
+%doc COPYING COPYING.Exceptions README.md NEWS AUTHORS ChangeLog
+%config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/features-available/ido-pgsql.conf
%{_libdir}/%{name}/libdb_ido_pgsql*
+%{_datadir}/icinga2-ido-pgsql
%files classicui-config
%defattr(-,root,root,-)
%config(noreplace) %{apacheconfdir}/icinga.conf
%config(noreplace) %attr(0640,root,%{apachegroup}) %{icingaclassicconfdir}/passwd
-
%changelog