1 #/******************************************************************************
3 # * Copyright (C) 2012-2014 Icinga Development Team (http://www.icinga.org) *
5 # * This program is free software; you can redistribute it and/or *
6 # * modify it under the terms of the GNU General Public License *
7 # * as published by the Free Software Foundation; either version 2 *
8 # * of the License, or (at your option) any later version. *
10 # * This program is distributed in the hope that it will be useful, *
11 # * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 # * GNU General Public License for more details. *
15 # * You should have received a copy of the GNU General Public License *
16 # * along with this program; if not, write to the Free Software Foundation *
17 # * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
18 # ******************************************************************************/
22 %if "%{_vendor}" == "redhat"
23 %define el5_boost_version 141
24 %define el5_boost_libs %{_libdir}/boost%{el5_boost_version}
25 %define el5_boost_includes /usr/include/boost%{el5_boost_version}
26 %define apachename httpd
27 %define apacheconfdir %{_sysconfdir}/httpd/conf.d
28 %define apacheuser apache
29 %define apachegroup apache
31 %if "%{_vendor}" == "suse"
33 %if 0%{?suse_version} >= 1310
34 %define opensuse_boost_version 1_53_0
36 %define opensuse_boost_version 1_49_0
38 %define sles_boost_version 1_54_0
39 %define apachename apache2
40 %define apacheconfdir %{_sysconfdir}/apache2/conf.d
41 %define apacheuser wwwrun
42 %define apachegroup www
45 %define icinga_user icinga
46 %define icinga_group icinga
47 %define icingacmd_group icingacmd
48 %define icingaweb2name icingaweb2
49 %define icingaweb2version 2.0.0
51 %define icingaclassicconfdir %{_sysconfdir}/icinga
53 %define logmsg logger -t %{name}/rpm
55 Summary: Network monitoring application
58 Release: %{revision}%{?dist}
60 Group: Applications/System
61 Source: %{name}-%{version}.tar.gz
62 URL: http://www.icinga.org/
63 BuildRoot: %{_tmppath}/%{name}-%{version}-build
65 Requires: %{name}-bin = %{version}
66 #Requires: %{name}-ido-mysql = %{version}
67 #Requires: %{icingaweb2name} >= %{icingaweb2version}
70 Meta package for Icinga 2 Core, DB IDO and Web.
73 Summary: Icinga 2 binaries and libraries
74 Group: Applications/System
76 BuildRequires: doxygen
78 BuildRequires: python-sphinx
79 BuildRequires: openssl-devel
80 BuildRequires: gcc-c++
81 BuildRequires: libstdc++-devel
83 BuildRequires: flex >= 2.5.35
87 %if "%{_vendor}" == "redhat"
88 %if 0%{?el5} || 0%{?rhel} == 5 || "%{?dist}" == ".el5"
90 BuildRequires: boost%{el5_boost_version}-devel
91 BuildRequires: boost%{el5_boost_version}
92 Requires: boost%{el5_boost_version}-program-options
93 Requires: boost%{el5_boost_version}-system
94 Requires: boost%{el5_boost_version}-test
95 Requires: boost%{el5_boost_version}-thread
96 Requires: boost%{el5_boost_version}-regex
98 BuildRequires: boost-devel >= 1.41
99 Requires: boost-program-options >= 1.41
100 Requires: boost-system >= 1.41
101 Requires: boost-test >= 1.41
102 Requires: boost-thread >= 1.41
103 Requires: boost-regex >= 1.41
109 %if "%{_vendor}" == "suse"
111 # note: sles_version macro is not set in SLES11 anymore
112 # note: sles service packs are not under version control
113 %if 0%{?suse_version} == 1110
114 BuildRequires: gcc-fortran
115 BuildRequires: libgfortran43
116 BuildRequires: boost-license%{sles_boost_version}
117 BuildRequires: boost-devel >= 1.41
118 Requires: boost-license%{sles_boost_version}
119 Requires: libboost_program_options%{sles_boost_version}
120 Requires: libboost_system%{sles_boost_version}
121 Requires: libboost_test%{sles_boost_version}
122 Requires: libboost_thread%{sles_boost_version}
123 Requires: libboost_regex%{sles_boost_version}
126 %if 0%{?suse_version} >= 1210
127 BuildRequires: boost-devel >= 1.41
128 Requires: libboost_program_options%{opensuse_boost_version}
129 Requires: libboost_system%{opensuse_boost_version}
130 Requires: libboost_test%{opensuse_boost_version}
131 Requires: libboost_thread%{opensuse_boost_version}
132 Requires: libboost_regex%{opensuse_boost_version}
137 Requires: %{name}-common = %{version}
140 Icinga 2 is a general-purpose network monitoring application.
141 Provides binaries and libraries for Icinga 2 Core.
144 Summary: Common Icinga 2 configuration
145 Group: Applications/System
146 %if "%{_vendor}" == "redhat"
147 Requires(pre): shadow-utils
148 Requires(post): shadow-utils
152 Provides common directories, uid and gid among Icinga 2 related
157 Summary: Documentation for Icinga 2
158 Group: Applications/System
159 Requires: %{name} = %{version}-%{release}
162 Documentation for Icinga 2
166 Summary: IDO MySQL database backend for Icinga 2
167 Group: Applications/System
168 %if "%{_vendor}" == "suse"
169 BuildRequires: libmysqlclient-devel
170 %if 0%{?suse_version} >= 1210
171 Requires: libmysqlclient18
173 Requires: libmysqlclient15
176 %if "%{_vendor}" == "redhat"
177 # el5 only provides mysql package
178 %if 0%{?el5} || 0%{?rhel} == 5 || "%{?dist}" == ".el5"
181 BuildRequires: mysql-libs
184 BuildRequires: mysql-devel
187 Requires: %{name} = %{version}-%{release}
189 %description ido-mysql
190 Icinga 2 IDO mysql database backend. Compatible with Icinga 1.x
191 IDOUtils schema >= 1.10
195 Summary: IDO PostgreSQL database backend for Icinga 2
196 Group: Applications/System
197 %if "%{_vendor}" == "suse"
198 BuildRequires: postgresql-libs
200 %if "%{_vendor}" == "redhat"
201 # el5 only provides mysql package
202 %if 0%{?el5} || 0%{?rhel} == 5 || "%{?dist}" == ".el5"
203 BuildRequires: postgresql84
206 BuildRequires: postgresql-devel
207 Requires: postgresql-libs
208 Requires: %{name} = %{version}-%{release}
210 %description ido-pgsql
211 Icinga 2 IDO PostgreSQL database backend. Compatible with Icinga 1.x
212 IDOUtils schema >= 1.10
215 %package classicui-config
216 Summary: Icinga 2 Classic UI Standalone configuration
217 Group: Applications/System
218 BuildRequires: %{apachename}
219 Requires: %{apachename}
220 Requires: %{name} = %{version}-%{release}
221 Provides: icinga-classicui-config
222 Conflicts: icinga-gui-config
224 %description classicui-config
225 Icinga 1.x Classic UI Standalone configuration with locations
230 %setup -q -n %{name}-%{version}
233 CMAKE_OPTS="-DCMAKE_INSTALL_PREFIX=/usr \
234 -DCMAKE_INSTALL_SYSCONFDIR=/etc \
235 -DCMAKE_INSTALL_LOCALSTATEDIR=/var \
236 -DCMAKE_BUILD_TYPE=RelWithDebInfo \
237 -DICINGA2_USER=%{icinga_user} \
238 -DICINGA2_GROUP=%{icinga_group} \
239 -DICINGA2_COMMAND_USER=%{icinga_user} \
240 -DICINGA2_COMMAND_GROUP=%{icingacmd_group}"
241 %if "%{_vendor}" == "redhat"
242 %if 0%{?el5} || 0%{?rhel} == 5 || "%{?dist}" == ".el5"
243 # Boost_VERSION 1.41.0 vs 101400 - disable build tests
244 # details in https://dev.icinga.org/issues/5033
245 CMAKE_OPTS="$CMAKE_OPTS -DBOOST_LIBRARYDIR=/usr/lib/boost141 \
246 -DBOOST_INCLUDEDIR=/usr/include/boost141 \
247 -DBoost_ADDITIONAL_VERSIONS='1.41;1.41.0' \
248 -DBoost_NO_SYSTEM_PATHS=TRUE \
249 -DBUILD_TESTING=FALSE \
250 -DBoost_NO_BOOST_CMAKE=TRUE"
259 [ "%{buildroot}" != "/" ] && [ -d "%{buildroot}" ] && rm -rf %{buildroot}
261 DESTDIR="%{buildroot}"
263 # install classicui config
264 install -D -m 0644 etc/icinga/icinga-classic.htpasswd %{buildroot}%{icingaclassicconfdir}/passwd
265 install -D -m 0644 etc/icinga/cgi.cfg %{buildroot}%{icingaclassicconfdir}/cgi.cfg
266 install -D -m 0644 etc/icinga/icinga-classic-apache.conf %{buildroot}%{apacheconfdir}/icinga.conf
268 # fix plugin path on x64
269 %if "%{_vendor}" != "suse"
270 sed -i 's@PluginDir = .*@PluginDir = "%{_libdir}/nagios/plugins"@' %{buildroot}/%{_sysconfdir}/%{name}/constants.conf
273 # remove features-enabled symlinks
274 rm -f %{buildroot}/%{_sysconfdir}/%{name}/features-enabled/*.conf
277 [ "%{buildroot}" != "/" ] && [ -d "%{buildroot}" ] && rm -rf %{buildroot}
280 getent group %{icinga_group} >/dev/null || %{_sbindir}/groupadd -r %{icinga_group}
281 getent group %{icingacmd_group} >/dev/null || %{_sbindir}/groupadd -r %{icingacmd_group}
282 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}
286 %if 0%{?suse_version}
288 %{fillup_and_insserv icinga2}
292 # initial installation, enable default features
293 %{_sbindir}/icinga2-enable-feature checker
294 %{_sbindir}/icinga2-enable-feature notification
295 %{_sbindir}/icinga2-enable-feature mainlog
300 %restart_on_update icinga2
303 if [ "$1" = "0" ]; then
304 # deinstallation of the package - remove enabled features
305 rm -rf %{_sysconfdir}/%{name}/features-enabled
311 %stop_on_removal icinga2
317 /sbin/chkconfig --add icinga2
321 # initial installation, enable default features
322 %{_sbindir}/icinga2-enable-feature checker
323 %{_sbindir}/icinga2-enable-feature notification
324 %{_sbindir}/icinga2-enable-feature mainlog
330 if [ "$1" -ge "1" ]; then
331 /sbin/service icinga2 condrestart >/dev/null 2>&1 || :
334 if [ "$1" = "0" ]; then
335 # deinstallation of the package - remove enabled features
336 rm -rf %{_sysconfdir}/%{name}/features-enabled
341 if [ "$1" = "0" ]; then
342 /sbin/service icinga2 stop > /dev/null 2>&1
343 /sbin/chkconfig --del icinga2
352 # initial installation, enable ido-mysql feature
353 %{_sbindir}/icinga2-enable-feature ido-mysql
359 if [ "$1" = "0" ]; then
360 # deinstallation of the package - remove feature
361 test -x %{_sbindir}/icinga2-disable-feature && %{_sbindir}/icinga2-disable-feature ido-mysql
369 # initial installation, enable ido-pgsql feature
370 %{_sbindir}/icinga2-enable-feature ido-pgsql
376 if [ "$1" = "0" ]; then
377 # deinstallation of the package - remove feature
378 test -x %{_sbindir}/icinga2-disable-feature && %{_sbindir}/icinga2-disable-feature ido-pgsql
383 %post classicui-config
386 # initial installation, enable features
387 %{_sbindir}/icinga2-enable-feature statusdata
388 %{_sbindir}/icinga2-enable-feature compatlog
389 %{_sbindir}/icinga2-enable-feature command
394 %postun classicui-config
395 if [ "$1" = "0" ]; then
396 # deinstallation of the package - remove feature
397 test -x %{_sbindir}/icinga2-disable-feature && %{_sbindir}/icinga2-disable-feature statusdata
398 test -x %{_sbindir}/icinga2-disable-feature && %{_sbindir}/icinga2-disable-feature compatlog
399 test -x %{_sbindir}/icinga2-disable-feature && %{_sbindir}/icinga2-disable-feature command
407 %defattr(-,root,root,-)
408 %doc COPYING COPYING.Exceptions README NEWS AUTHORS ChangeLog
409 %attr(755,-,-) %{_sysconfdir}/init.d/%{name}
410 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}
411 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/conf.d
412 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/features-available
413 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/features-enabled
414 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/scripts
415 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/%{name}.conf
416 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/constants.conf
417 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/conf.d/*.conf
418 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/features-available/*.conf
419 %config(noreplace) %{_sysconfdir}/%{name}/scripts/*
421 %{_bindir}/%{name}-migrate-config
422 %{_bindir}/%{name}-build-ca
423 %{_bindir}/%{name}-build-key
424 %{_bindir}/%{name}-sign-key
425 %{_sbindir}/%{name}-enable-feature
426 %{_sbindir}/%{name}-disable-feature
427 %{_sbindir}/%{name}-setup-agent
428 %{_sbindir}/%{name}-discover-agent
429 %exclude %{_libdir}/%{name}/libdb_ido_mysql*
430 %exclude %{_libdir}/%{name}/libdb_ido_pgsql*
433 %exclude %{_datadir}/%{name}/itl
434 %{_mandir}/man8/%{name}.8.gz
436 %attr(0755,%{icinga_user},%{icinga_group}) %{_localstatedir}/cache/%{name}
437 %attr(0755,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/log/%{name}
438 %attr(0755,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/log/%{name}/compat
439 %attr(0755,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/log/%{name}/compat/archives
440 %attr(0755,%{icinga_user},%{icinga_group}) %ghost %{_localstatedir}/run/%{name}
441 %attr(0750,%{icinga_user},%{icinga_group}) %{_localstatedir}/lib/%{name}
443 %attr(2755,%{icinga_user},%{icingacmd_group}) %ghost %{_localstatedir}/run/icinga2/cmd
446 %defattr(-,root,root,-)
447 %doc COPYING COPYING.Exceptions README NEWS AUTHORS ChangeLog
448 %attr(755,-,-) %{_sysconfdir}/logrotate.d/%{name}
449 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/spool/%{name}
450 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/spool/%{name}/perfdata
451 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/spool/%{name}/tmp
452 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_datadir}/%{name}/itl
453 %{_datadir}/%{name}/itl
456 %defattr(-,root,root,-)
457 %doc COPYING COPYING.Exceptions README NEWS AUTHORS ChangeLog
458 %{_datadir}/doc/%{name}
459 %docdir %{_datadir}/doc/%{name}
462 %defattr(-,root,root,-)
463 %doc components/db_ido_mysql/schema COPYING COPYING.Exceptions README NEWS AUTHORS ChangeLog
464 %{_libdir}/%{name}/libdb_ido_mysql*
467 %defattr(-,root,root,-)
468 %doc components/db_ido_pgsql/schema COPYING COPYING.Exceptions README NEWS AUTHORS ChangeLog
469 %{_libdir}/%{name}/libdb_ido_pgsql*
471 %files classicui-config
472 %defattr(-,root,root,-)
473 %attr(0751,%{icinga_user},%{icinga_group}) %dir %{icingaclassicconfdir}
474 %config(noreplace) %{icingaclassicconfdir}/cgi.cfg
475 %config(noreplace) %{apacheconfdir}/icinga.conf
476 %config(noreplace) %attr(0640,root,%{apachegroup}) %{icingaclassicconfdir}/passwd