1 #/******************************************************************************
3 # * Copyright (C) 2012-2013 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"
32 %define opensuse_boost_version 1_49_0
33 %define sles_boost_version 1_54_0
34 %define apachename apache2
35 %define apacheconfdir %{_sysconfdir}/apache2/conf.d
36 %define apacheuser wwwrun
37 %define apachegroup www
40 %define icinga_user icinga
41 %define icinga_group icinga
42 %define icingacmd_group icingacmd
44 %define icingaclassicconfdir %{_sysconfdir}/icinga
46 %define logmsg logger -t %{name}/rpm
48 Summary: network monitoring application
51 Release: %{revision}%{?dist}
53 Group: Applications/System
54 Source: %{name}-%{version}.tar.gz
55 URL: http://www.icinga.org/
56 BuildRoot: %{_tmppath}/%{name}-%{version}-build
58 BuildRequires: doxygen
59 BuildRequires: openssl-devel
60 BuildRequires: gcc-c++
61 BuildRequires: libstdc++-devel
65 BuildRequires: %{apachename}
67 %if "%{_vendor}" == "redhat"
68 %if 0%{?el5} || 0%{?rhel} == 5 || "%{?dist}" == ".el5"
70 BuildRequires: boost%{el5_boost_version}-devel
71 BuildRequires: boost%{el5_boost_version}
72 Requires: boost%{el5_boost_version}-program-options
73 Requires: boost%{el5_boost_version}-system
74 Requires: boost%{el5_boost_version}-test
75 Requires: boost%{el5_boost_version}-thread
77 BuildRequires: boost-devel >= 1.41
78 Requires: boost-program-options >= 1.41
79 Requires: boost-system >= 1.41
80 Requires: boost-test >= 1.41
81 Requires: boost-thread >= 1.41
85 %if "%{_vendor}" == "suse"
86 %if 0%{?sles_version} == 11
87 BuildRequires: libgfortran46
88 BuildRequires: boost-license%{sles_boost_version}
89 BuildRequires: boost-devel >= 1.41
90 Requires: boost-license%{sles_boost_version}
91 Requires: libboost_program_options%{sles_boost_version}
92 Requires: libboost_system%{sles_boost_version}
93 Requires: libboost_test%{sles_boost_version}
94 Requires: libboost_thread%{sles_boost_version}
96 BuildRequires: boost-devel >= 1.41
97 Requires: libboost_program_options%{opensuse_boost_version}
98 Requires: libboost_system%{opensuse_boost_version}
99 Requires: libboost_test%{opensuse_boost_version}
100 Requires: libboost_thread%{opensuse_boost_version}
104 Requires: %{name}-common = %{version}
107 Icinga is a general-purpose network monitoring application.
110 Summary: Common Icinga 2 configuration
111 Group: Applications/System
112 %if "%{_vendor}" == "redhat"
113 Requires(pre): shadow-utils
114 Requires(post): shadow-utils
118 Provides common directories, uid and gid among Icinga 2 related
123 Summary: Documentation for Icinga 2
124 Group: Applications/System
125 Requires: %{name} = %{version}-%{release}
128 Documentation for Icinga 2
132 Summary: IDO MySQL database backend for Icinga 2
133 Group: Applications/System
134 %if "%{_vendor}" == "suse"
135 BuildRequires: libmysqlclient-devel
136 Requires: libmysqlclient18
138 %if "%{_vendor}" == "redhat"
139 # el5 only provides mysql package
140 %if 0%{?el5} || 0%{?rhel} == 5 || "%{?dist}" == ".el5"
143 BuildRequires: mysql-libs
146 BuildRequires: mysql-devel
149 Requires: %{name} = %{version}-%{release}
151 %description ido-mysql
152 Icinga 2 IDO mysql database backend. Compatible with Icinga 1.x
153 IDOUtils schema >= 1.10
155 %package classicui-config
156 Summary: Icinga 2 Classic UI Standalone configuration
157 Group: Applications/System
158 Requires: %{apachename}
159 Requires: %{name} = %{version}-%{release}
160 Provides: icinga-classicui-config
161 Conflicts: icinga-gui-config
163 %description classicui-config
164 Icinga 1.x Classic UI Standalone configuration with locations
169 %setup -q -n %{name}-%{version}
172 CMAKE_OPTS="-DCMAKE_INSTALL_PREFIX=/usr \
173 -DCMAKE_INSTALL_SYSCONFDIR=/etc \
174 -DCMAKE_INSTALL_LOCALSTATEDIR=/var \
175 -DCMAKE_BUILD_TYPE=RelWithDebInfo \
176 -DICINGA2_USER=%{icinga_user} \
177 -DICINGA2_GROUP=%{icinga_group} \
178 -DICINGA2_COMMAND_USER=%{icinga_user} \
179 -DICINGA2_COMMAND_GROUP=%{icingacmd_group}"
180 %if "%{_vendor}" == "redhat"
181 %if 0%{?el5} || 0%{?rhel} == 5 || "%{?dist}" == ".el5"
182 CMAKE_OPTS="$CMAKE_OPTS -DBOOST_LIBRARYDIR=/usr/lib/boost141 \
183 -DBOOST_INCLUDEDIR=/usr/include/boost141 \
184 -DBoost_ADDITIONAL_VERSIONS='1.41;1.41.0'"
192 [ "%{buildroot}" != "/" ] && [ -d "%{buildroot}" ] && rm -rf %{buildroot}
194 DESTDIR="%{buildroot}"
196 # install classicui config
197 install -D -m 0644 etc/icinga/icinga-classic.htpasswd %{buildroot}%{icingaclassicconfdir}/passwd
198 install -D -m 0644 etc/icinga/cgi.cfg %{buildroot}%{icingaclassicconfdir}/cgi.cfg
199 install -D -m 0644 etc/icinga/icinga-classic-apache.conf %{buildroot}%{apacheconfdir}/icinga.conf
201 # fix plugin path on x64
202 sed -i 's@plugindir = .*@plugindir = "%{_libdir}/nagios/plugins"@' %{buildroot}/%{_sysconfdir}/%{name}/conf.d/macros.conf
205 [ "%{buildroot}" != "/" ] && [ -d "%{buildroot}" ] && rm -rf %{buildroot}
208 getent group %{icinga_group} >/dev/null || %{_sbindir}/groupadd -r %{icinga_group}
209 getent group %{icingacmd_group} >/dev/null || %{_sbindir}/groupadd -r %{icingacmd_group}
210 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}
216 # initial installation, enable ido-mysql feature
217 %{_sbindir}/icinga2-enable-feature ido-mysql
221 if [ "$1" = "0" ]; then
222 # deinstallation of the package - remove feature
223 test -x %{_sbindir}/icinga2-disable-feature && %{_sbindir}/icinga2-disable-feature ido-mysql
226 %post classicui-config
229 # initial installation, enable features
230 %{_sbindir}/icinga2-enable-feature statusdata
231 %{_sbindir}/icinga2-enable-feature compatlog
232 %{_sbindir}/icinga2-enable-feature command
235 %postun classicui-config
236 if [ "$1" = "0" ]; then
237 # deinstallation of the package - remove feature
238 test -x %{_sbindir}/icinga2-disable-feature && %{_sbindir}/icinga2-disable-feature statusdata
239 test -x %{_sbindir}/icinga2-disable-feature && %{_sbindir}/icinga2-disable-feature compatlog
240 test -x %{_sbindir}/icinga2-disable-feature && %{_sbindir}/icinga2-disable-feature command
244 %defattr(-,root,root,-)
245 %doc COPYING COPYING.Exceptions README NEWS AUTHORS ChangeLog
246 %attr(755,-,-) %{_sysconfdir}/init.d/%{name}
247 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/conf.d
248 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/features-available
249 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/features-enabled
250 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/%{name}.conf
251 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/conf.d/*.conf
252 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/features-available/*.conf
253 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/features-enabled/*.conf
255 %{_bindir}/%{name}-migrate-config
256 %{_bindir}/%{name}-build-ca
257 %{_bindir}/%{name}-build-key
258 %{_sbindir}/%{name}-enable-feature
259 %{_sbindir}/%{name}-disable-feature
260 %exclude %{_libdir}/%{name}/libdb_ido_mysql*
263 %exclude %{_datadir}/%{name}/itl
264 %{_mandir}/man8/%{name}.8.gz
266 %attr(0755,%{icinga_user},%{icinga_group}) %{_localstatedir}/cache/%{name}
267 %attr(0755,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/log/%{name}
268 %attr(0755,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/log/%{name}/compat
269 %attr(0755,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/log/%{name}/compat/archives
270 %attr(0755,%{icinga_user},%{icinga_group}) %{_localstatedir}/run/%{name}
271 %attr(0750,%{icinga_user},%{icinga_group}) %{_localstatedir}/lib/%{name}
273 %attr(2755,%{icinga_user},%{icingacmd_group}) %{_localstatedir}/run/icinga2/cmd
276 %defattr(-,root,root,-)
277 %doc COPYING COPYING.Exceptions README NEWS AUTHORS ChangeLog
278 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/spool/%{name}
279 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_datadir}/%{name}/itl
280 %{_datadir}/%{name}/itl
283 %defattr(-,root,root,-)
284 %doc COPYING COPYING.Exceptions README NEWS AUTHORS ChangeLog
285 %{_datadir}/doc/%{name}
286 %docdir %{_datadir}/doc/%{name}
289 %defattr(-,root,root,-)
290 %doc components/db_ido_mysql/schema COPYING COPYING.Exceptions README NEWS AUTHORS ChangeLog
291 %{_libdir}/%{name}/libdb_ido_mysql*
293 %files classicui-config
294 %defattr(-,root,root,-)
295 %config(noreplace) %{icingaclassicconfdir}/cgi.cfg
296 %config(noreplace) %{apacheconfdir}/icinga.conf
297 %config(noreplace) %attr(0640,root,%{apachegroup}) %{icingaclassicconfdir}/passwd
301 * Tue Oct 01 2013 Michael Friedrich <michael.friedrich@netways.de> - 0.0.3-1
304 * Sat May 04 2013 Michael Friedrich <michael.friedrich@netways.de> - 0.0.2-1
305 - new initscript in initdir
306 - itl is installed into datadir
307 - man pages in mandir
308 - use name macro to avoid typos
310 * Fri Nov 19 2012 Gunnar Beutner <gunnar.beutner@netways.de> - 0.0.1-1