icinga2/icinga2.spec.in

287 lines
8.9 KiB
Plaintext
Raw Normal View History

%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 apachename httpd
%define apacheconfdir %{_sysconfdir}/httpd/conf.d
2013-10-13 19:15:52 +02:00
%define apacheuser apache
%define apachegroup apache
%endif
%if "%{_vendor}" == "suse"
%define opensuse_boost_version 1_49_0
2013-10-09 15:04:07 +02:00
%define sles_boost_version 1_54_0
%define apachename apache2
%define apacheconfdir %{_sysconfdir}/apache2/conf.d
2013-10-13 19:15:52 +02:00
%define apacheuser wwwrun
%define apachegroup www
%endif
%define icinga_user icinga
%define icinga_group icinga
%define icingacmd_group icingacmd
%define icingaclassicconfdir %{_sysconfdir}/icinga
%define logmsg logger -t %{name}/rpm
2012-05-26 14:42:03 +02:00
Summary: network monitoring application
Name: @PACKAGE@
Version: @VERSION@
Release: %{revision}%{?dist}
License: GPLv2+
2012-05-26 23:12:46 +02:00
Group: Applications/System
2012-05-27 16:21:50 +02:00
Source: %{name}-%{version}.tar.gz
2012-05-26 14:42:03 +02:00
URL: http://www.icinga.org/
BuildRoot: %{_tmppath}/%{name}-%{version}-build
2013-08-16 16:17:14 +02:00
BuildRequires: doxygen
2012-05-26 14:42:03 +02:00
BuildRequires: openssl-devel
BuildRequires: gcc-c++
2013-08-16 16:17:14 +02:00
BuildRequires: libstdc++-devel
BuildRequires: automake
BuildRequires: autoconf
BuildRequires: libtool
BuildRequires: flex
BuildRequires: bison
BuildRequires: %{apachename}
%if "%{_vendor}" == "redhat"
2013-10-03 12:28:13 +02:00
BuildRequires: libtool-ltdl-devel
%if 0%{?el5} || 0%{?rhel} == 5 || "%{?dist}" == ".el5"
# el5 requires EPEL
2013-10-07 17:48:33 +02:00
BuildRequires: boost%{el5_boost_version}-devel
2013-10-07 18:03:48 +02:00
BuildRequires: boost%{el5_boost_version}
2013-10-07 17:48:33 +02:00
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
2013-10-07 18:03:48 +02:00
%endif
%endif
2013-10-03 12:28:13 +02:00
%if "%{_vendor}" == "suse"
2013-10-09 15:04:07 +02:00
%if 0%{?sles_version} == 11
2013-10-09 16:11:31 +02:00
BuildRequires: libgfortran46
BuildRequires: boost-license%{sles_boost_version}
2013-10-09 15:04:07 +02:00
BuildRequires: boost-devel >= 1.41
2013-10-09 16:11:31 +02:00
Requires: boost-license%{sles_boost_version}
2013-10-09 15:04:07 +02:00
Requires: libboost_program_options%{sles_boost_version}
Requires: libboost_signals%{sles_boost_version}
Requires: libboost_system%{sles_boost_version}
Requires: libboost_test%{sles_boost_version}
Requires: libboost_thread%{sles_boost_version}
%else
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
2013-10-09 16:11:31 +02:00
%endif
Requires: %{name}-common = %{version}
2012-05-26 14:42:03 +02:00
%description
2012-05-27 16:21:50 +02:00
Icinga is a general-purpose network monitoring application.
2012-05-26 14:42:03 +02:00
%package common
Summary: Common Icinga 2 configuration
Group: Applications/System
%if "%{_vendor}" == "redhat"
Requires(pre): shadow-utils
Requires(post): shadow-utils
%endif
%description common
Provides common directories, uid and gid among Icinga 2 related
packages.
%package doc
Summary: Documentation for Icinga 2
Group: Applications/System
2013-10-14 10:31:03 +02:00
Requires: %{name} = %{version}-%{release}
%description doc
Documentation for Icinga 2
%package ido-mysql
2013-10-03 12:28:13 +02:00
Summary: IDO MySQL database backend for Icinga 2
Group: Applications/System
%if "%{_vendor}" == "suse"
BuildRequires: libmysqlclient-devel
Requires: libmysqlclient18
%endif
%if "%{_vendor}" == "redhat"
2013-10-07 17:53:53 +02:00
# el5 only provides mysql package
%if 0%{?el5} || 0%{?rhel} == 5 || "%{?dist}" == ".el5"
BuildRequires: mysql
%else
2013-10-03 14:27:06 +02:00
BuildRequires: mysql-libs
2013-10-03 14:32:35 +02:00
BuildRequires: mysql
2013-10-07 18:03:48 +02:00
%endif
BuildRequires: mysql-devel
Requires: mysql
%endif
2013-10-14 10:31:03 +02:00
Requires: %{name} = %{version}-%{release}
2013-10-07 17:53:53 +02:00
%description ido-mysql
Icinga 2 IDO mysql database backend. Compatible with Icinga 1.x
IDOUtils schema >= 1.10
%package classicui-config
Summary: Icinga 2 Classic UI Standalone configuration
Group: Applications/System
Requires: %{apachename}
Requires: %{name} = %{version}-%{release}
Provides: icinga-classicui-config
Conflicts: icinga-gui-config
%description classicui-config
Icinga 1.x Classic UI Standalone configuration with locations
for Icinga 2.
2012-05-26 14:42:03 +02:00
%prep
2012-05-27 16:21:50 +02:00
%setup -q -n %{name}-%{version}
2012-05-26 14:42:03 +02:00
%build
%configure --with-icinga-user=%{icinga_user} \
--with-icinga-group=%{icinga_group} \
--with-icingacmd-user=%{icinga_user} \
--with-icingacmd-group=%{icingacmd_group}
2012-05-27 16:21:50 +02:00
make %{?_smp_mflags}
2012-05-26 14:42:03 +02:00
%install
2012-05-27 16:21:50 +02:00
[ "%{buildroot}" != "/" ] && [ -d "%{buildroot}" ] && rm -rf %{buildroot}
make install \
DESTDIR="%{buildroot}" \
INSTALL_OPTS="" \
COMMAND_OPTS=""
# install classicui config
install -D -m 0644 etc/icinga/icinga-classic.htpasswd %{buildroot}%{icingaclassicconfdir}/passwd
install -D -m 0644 etc/icinga/cgi.cfg %{buildroot}%{icingaclassicconfdir}/cgi.cfg
install -D -m 0644 etc/icinga/icinga-classic-apache.conf %{buildroot}%{apacheconfdir}/icinga.conf
# fix plugin path on x64
sed -i 's@plugindir = .*@plugindir = "%{_libdir}/nagios/plugins"@' %{buildroot}/%{_sysconfdir}/%{name}/conf.d/macros.conf
%clean
[ "%{buildroot}" != "/" ] && [ -d "%{buildroot}" ] && rm -rf %{buildroot}
%pre common
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
2012-05-26 14:42:03 +02:00
%post ido-mysql
if [ ${1:-0} -eq 1 ]
then
# initial installation, enable ido-mysql feature
%{_sbindir}/i2enfeature ido-mysql
fi
%postun ido-mysql
if [ "$1" = "0" ]; then
# deinstallation of the package - remove feature
test -x %{_sbindir}/i2disfeature && %{_sbindir}/i2disfeature ido-mysql
fi
%post classicui-config
if [ ${1:-0} -eq 1 ]
then
# initial installation, enable features
%{_sbindir}/i2enfeature statusdata
%{_sbindir}/i2enfeature compatlog
%{_sbindir}/i2enfeature command
fi
%postun classicui-config
if [ "$1" = "0" ]; then
# deinstallation of the package - remove feature
test -x %{_sbindir}/i2disfeature && %{_sbindir}/i2disfeature statusdata
test -x %{_sbindir}/i2disfeature && %{_sbindir}/i2disfeature compatlog
test -x %{_sbindir}/i2disfeature && %{_sbindir}/i2disfeature command
fi
2012-05-26 14:42:03 +02:00
%files
2013-10-13 19:15:52 +02:00
%defattr(-,root,root,-)
%attr(755,-,-) %{_sysconfdir}/init.d/%{name}
%attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/conf.d
%attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/features-available
%attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/features-enabled
%config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/%{name}.conf
%config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/conf.d/*.conf
%config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/features-available/*.conf
%config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/features-enabled/*.conf
2013-08-16 14:52:34 +02:00
%{_bindir}/%{name}
2013-10-11 06:31:21 +02:00
%{_bindir}/icinga2-migrate-config
2013-10-17 14:39:10 +02:00
%{_bindir}/icinga2-build-ca
%{_bindir}/icinga2-build-key
%{_sbindir}/i2enfeature
2013-10-03 11:48:43 +02:00
%{_sbindir}/i2disfeature
%exclude %{_libdir}/%{name}/libdb_ido_mysql*
%{_libdir}/%{name}
%{_datadir}/%{name}
%exclude %{_datadir}/%{name}/itl
%{_mandir}/man8/%{name}.8.gz
2013-10-13 18:53:57 +02:00
%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
2013-10-13 18:53:57 +02:00
%attr(0755,%{icinga_user},%{icinga_group}) %{_localstatedir}/run/%{name}
%attr(0750,%{icinga_user},%{icinga_group}) %{_localstatedir}/lib/%{name}
2013-08-16 16:58:31 +02:00
%attr(2755,%{icinga_user},%{icingacmd_group}) %{_localstatedir}/run/icinga2/cmd
%files common
2013-10-13 19:15:52 +02:00
%defattr(-,root,root,-)
%attr(0750,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/spool/%{name}
%attr(0750,%{icinga_user},%{icinga_group}) %dir %{_datadir}/%{name}/itl
%{_datadir}/%{name}/itl
%files doc
2013-10-13 19:15:52 +02:00
%defattr(-,root,root,-)
%{_datadir}/doc/%{name}
%docdir %{_datadir}/doc/%{name}
%files ido-mysql
2013-10-13 19:15:52 +02:00
%defattr(-,root,root,-)
%doc components/db_ido_mysql/schema
%{_libdir}/%{name}/libdb_ido_mysql*
%files classicui-config
2013-10-13 19:15:52 +02:00
%defattr(-,root,root,-)
%config(noreplace) %{icingaclassicconfdir}/cgi.cfg
%config(noreplace) %{apacheconfdir}/icinga.conf
2013-10-14 00:24:13 +02:00
%config(noreplace) %attr(0640,root,%{apachegroup}) %{icingaclassicconfdir}/passwd
%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