icinga2/icinga2.spec.in

219 lines
6.0 KiB
Plaintext

%define revision 1
%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 apacheuser apache
%endif
%if "%{_vendor}" == "suse"
%define opensuse_boost_version 1_49_0
%define apacheuser www
%endif
%define logmsg logger -t %{name}/rpm
Summary: network monitoring application
Name: @PACKAGE@
Version: @VERSION@
Release: %{revision}%{?dist}
License: GPLv2+
Group: Applications/System
Source: %{name}-%{version}.tar.gz
URL: http://www.icinga.org/
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: doxygen
BuildRequires: openssl-devel
BuildRequires: gcc-c++
BuildRequires: libstdc++-devel
BuildRequires: automake
BuildRequires: autoconf
BuildRequires: libtool
BuildRequires: flex
BuildRequires: bison
%if "%{_vendor}" == "redhat"
BuildRequires: libtool-ltdl-devel
%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}-signals
Requires: boost%{el5_boost_version}-system
Requires: boost%{el5_boost_version}-test
Requires: boost%{el5_boost_version}-thread
%else
BuildRequires: boost-devel >= 1.41
Requires: boost-program-options >= 1.41
Requires: boost-signals >= 1.41
Requires: boost-system >= 1.41
Requires: boost-test >= 1.41
Requires: boost-thread >= 1.41
%endif
%endif
%if "%{_vendor}" == "suse"
BuildRequires: boost-devel >= 1.41
Requires: libboost_program_options%{opensuse_boost_version}
Requires: libboost_signals%{opensuse_boost_version}
Requires: libboost_system%{opensuse_boost_version}
Requires: libboost_test%{opensuse_boost_version}
Requires: libboost_thread%{opensuse_boost_version}
%endif
Requires: %{name}-common = %{version}
Requires: user(icinga)
Requires(pre): user(icinga)
Requires: group(icinga)
Requires(pre): group(icinga)
Requires: group(icingacmd)
Requires(pre): group(icingacmd)
%description
Icinga is a general-purpose network monitoring application.
%package common
Summary: Common Icinga 2 configuration
Group: Applications/System
Requires(pre): shadow-utils
Requires(post): shadow-utils
Provides: user(icinga)
Provides: group(icinga)
Provides: group(icingacmd)
%description common
Provides common directories, uid and gid among Icinga 2 related
packages.
%package doc
Summary: Documentation for Icinga 2
Group: Applications/System
%description doc
Documentation for Icinga 2
%package ido-mysql
Summary: IDO MySQL database backend for Icinga 2
Group: Applications/System
%if "%{_vendor}" == "suse"
BuildRequires: libmysqlclient-devel
Requires: libmysqlclient18
%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
%description ido-mysql
Icinga 2 IDO mysql database backend. Compatible with Icinga 1.x
IDOUtils schema >= 1.10
%prep
%setup -q -n %{name}-%{version}
%build
%configure --with-icinga-user=$USER \
--with-icinga-group=$USER \
--with-icingacmd-user=$USER \
--with-icingacmd-group=$USER
make %{?_smp_mflags}
%install
[ "%{buildroot}" != "/" ] && [ -d "%{buildroot}" ] && rm -rf %{buildroot}
make install \
DESTDIR="%{buildroot}" \
INSTALL_OPTS="" \
COMMAND_OPTS=""
%clean
[ "%{buildroot}" != "/" ] && [ -d "%{buildroot}" ] && rm -rf %{buildroot}
%pre common
getent group icinga >/dev/null || groupadd -r icinga
getent group icingacmd >/dev/null || groupadd -r icingacmd
getent passwd icinga >/dev/null || /useradd -c "icinga" -s /sbin/nologin -r -d %{_localstatedir}/spool/%{name} -G icingacmd -g icinga icinga
exit 0
%preun
if [ $1 = 0 ]; then
/sbin/service %{name} stop &>/dev/null || :
/sbin/chkconfig --del %{name} || :
fi
%post
%{_sbindir}/usermod -a -G icingacmd %{apacheuser} || :
/sbin/chkconfig --add %{name} || :
/sbin/service %{name} start &>/dev/null || :
%post ido-mysql
ln -s %{_sysconfdir}/%{name}/features-available/ido-mysql.conf %{_sysconfdir}/%{name}/features-enabled/ido-mysql.conf
%postun ido-mysql
[ -f "%{_sysconfdir}/%{name}/features-enabled/ido-mysql.conf" ] && rm -f %{_sysconfdir}/%{name}/features-enabled/ido-mysql.conf
%files
%defattr(-,root,root)
%doc README AUTHORS ChangeLog COPYING COPYING.Exceptions
%attr(755,-,-) %{_sysconfdir}/init.d/%{name}
%attr(0750,icinga,icinga) %dir %{_sysconfdir}/%{name}/conf.d
%attr(0750,icinga,icinga) %dir %{_sysconfdir}/%{name}/features-available
%attr(0750,icinga,icinga) %dir %{_sysconfdir}/%{name}/features-enabled
%config(noreplace) %{_sysconfdir}/%{name}/%{name}.conf
%config(noreplace) %{_sysconfdir}/%{name}/conf.d/*.conf
%config(noreplace) %{_sysconfdir}/%{name}/features-available/*.conf
%config(noreplace) %{_sysconfdir}/%{name}/features-enabled/*.conf
%{_bindir}/%{name}
%{_sbindir}/i2enfeature
%{_sbindir}/i2disfeature
%exclude %{_libdir}/%{name}/libdb_ido_mysql*
%{_libdir}/%{name}
%{_datadir}/doc/%{name}
%{_datadir}/%{name}
%{_mandir}/man8/%{name}.8.gz
%{_localstatedir}/cache/%{name}
%attr(0750,icinga,icinga) %dir %{_localstatedir}/log/%{name}
%attr(0750,icinga,icinga) %dir %{_localstatedir}/log/%{name}/compat
%attr(0750,icinga,icinga) %dir %{_localstatedir}/log/%{name}/compat/archives
%{_localstatedir}/run/%{name}
%{_localstatedir}/lib/%{name}
%attr(2755,icinga,icingacmd) %{_localstatedir}/run/icinga2/cmd
%files common
%attr(0750,icinga,icinga) %dir %{_localstatedir}/spool/%{name}
%files doc
%doc README AUTHORS ChangeLog COPYING COPYING.Exceptions
%files ido-mysql
%{_libdir}/%{name}/libdb_ido_mysql*
%changelog
* Tue Oct 01 2013 Michael Friedrich <michael.friedrich@netways.de> - 0.0.3-1
- revamp package
* Sat May 04 2013 Michael Friedrich <michael.friedrich@netways.de> - 0.0.2-1
- new initscript in initdir
- itl is installed into datadir
- man pages in mandir
- use name macro to avoid typos
* Fri Nov 19 2012 Gunnar Beutner <gunnar.beutner@netways.de> - 0.0.1-1
- initial version