]> granicus.if.org Git - icinga2/blob - icinga2.spec
Merge branch 'feature/livestatus-regexp-filter-5007' into next
[icinga2] / icinga2.spec
1 #/******************************************************************************
2 # * Icinga 2                                                                   *
3 # * Copyright (C) 2012-2013 Icinga Development Team (http://www.icinga.org/)   *
4 # *                                                                            *
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.                     *
9 # *                                                                            *
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.                               *
14 # *                                                                            *
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 # ******************************************************************************/
19
20 %define revision 1
21
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
30 %endif
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
38 %endif
39
40 %define icinga_user icinga
41 %define icinga_group icinga
42 %define icingacmd_group icingacmd
43
44 %define icingaclassicconfdir %{_sysconfdir}/icinga
45
46 %define logmsg logger -t %{name}/rpm
47
48 Summary: network monitoring application
49 Name: icinga2
50 Version: 0.0.3
51 Release: %{revision}%{?dist}
52 License: GPLv2+
53 Group: Applications/System
54 Source: %{name}-%{version}.tar.gz
55 URL: http://www.icinga.org/
56 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
57
58 BuildRequires: doxygen
59 BuildRequires: openssl-devel
60 BuildRequires: gcc-c++
61 BuildRequires: libstdc++-devel
62 BuildRequires: cmake
63 BuildRequires: flex
64 BuildRequires: bison
65 BuildRequires: %{apachename}
66
67 %if "%{_vendor}" == "redhat"
68 %if 0%{?el5} || 0%{?rhel} == 5 || "%{?dist}" == ".el5"
69 # el5 requires EPEL
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
76 Requires: boost%{el5_boost_version}-regex
77 %else
78 BuildRequires: boost-devel >= 1.41
79 Requires: boost-program-options >= 1.41
80 Requires: boost-system >= 1.41
81 Requires: boost-test >= 1.41
82 Requires: boost-thread >= 1.41
83 Requires: boost-regex >= 1.41
84 %endif
85 %endif
86
87 %if "%{_vendor}" == "suse"
88 %if 0%{?sles_version} == 11
89 BuildRequires: libgfortran46
90 BuildRequires: boost-license%{sles_boost_version}
91 BuildRequires: boost-devel >= 1.41
92 Requires: boost-license%{sles_boost_version}
93 Requires: libboost_program_options%{sles_boost_version}
94 Requires: libboost_system%{sles_boost_version}
95 Requires: libboost_test%{sles_boost_version}
96 Requires: libboost_thread%{sles_boost_version}
97 %else
98 BuildRequires: boost-devel >= 1.41
99 Requires: libboost_program_options%{opensuse_boost_version}
100 Requires: libboost_system%{opensuse_boost_version}
101 Requires: libboost_test%{opensuse_boost_version}
102 Requires: libboost_thread%{opensuse_boost_version}
103 Requires: libboost_regex%{opensuse_boost_version}
104 %endif
105 %endif
106
107 Requires: %{name}-common = %{version}
108
109 %description
110 Icinga is a general-purpose network monitoring application.
111
112 %package common
113 Summary:      Common Icinga 2 configuration
114 Group:        Applications/System
115 %if "%{_vendor}" == "redhat"
116 Requires(pre): shadow-utils
117 Requires(post): shadow-utils
118 %endif
119
120 %description common
121 Provides common directories, uid and gid among Icinga 2 related
122 packages.
123
124
125 %package doc
126 Summary:      Documentation for Icinga 2
127 Group:        Applications/System
128 Requires:     %{name} = %{version}-%{release}
129
130 %description doc
131 Documentation for Icinga 2
132
133
134 %package ido-mysql
135 Summary:      IDO MySQL database backend for Icinga 2
136 Group:        Applications/System
137 %if "%{_vendor}" == "suse"
138 BuildRequires: libmysqlclient-devel
139 Requires: libmysqlclient18
140 %endif
141 %if "%{_vendor}" == "redhat"
142 # el5 only provides mysql package
143 %if 0%{?el5} || 0%{?rhel} == 5 || "%{?dist}" == ".el5"
144 BuildRequires: mysql
145 %else
146 BuildRequires: mysql-libs
147 BuildRequires: mysql
148 %endif
149 BuildRequires: mysql-devel
150 Requires: mysql
151 %endif
152 Requires: %{name} = %{version}-%{release}
153
154 %description ido-mysql
155 Icinga 2 IDO mysql database backend. Compatible with Icinga 1.x
156 IDOUtils schema >= 1.10
157
158
159 %package ido-pgsql
160 Summary:      IDO PostgreSQL database backend for Icinga 2
161 Group:        Applications/System
162 %if "%{_vendor}" == "suse"
163 BuildRequires: postgresql-libs
164 %endif
165 %if "%{_vendor}" == "redhat"
166 # el5 only provides mysql package
167 %if 0%{?el5} || 0%{?rhel} == 5 || "%{?dist}" == ".el5"
168 BuildRequires: postgresql84
169 %endif
170 %endif
171 BuildRequires: postgresql-devel
172 Requires: postgresql-libs
173 Requires: %{name} = %{version}-%{release}
174
175 %description ido-pgsql
176 Icinga 2 IDO PostgreSQL database backend. Compatible with Icinga 1.x
177 IDOUtils schema >= 1.10
178
179
180 %package classicui-config
181 Summary:      Icinga 2 Classic UI Standalone configuration
182 Group:        Applications/System
183 Requires:     %{apachename}
184 Requires:     %{name} = %{version}-%{release}
185 Provides:     icinga-classicui-config
186 Conflicts:    icinga-gui-config
187
188 %description classicui-config
189 Icinga 1.x Classic UI Standalone configuration with locations
190 for Icinga 2.
191
192
193 %prep
194 %setup -q -n %{name}-%{version}
195
196 %build
197 CMAKE_OPTS="-DCMAKE_INSTALL_PREFIX=/usr \
198          -DCMAKE_INSTALL_SYSCONFDIR=/etc \
199                  -DCMAKE_INSTALL_LOCALSTATEDIR=/var \
200          -DCMAKE_BUILD_TYPE=RelWithDebInfo \
201          -DICINGA2_USER=%{icinga_user} \
202          -DICINGA2_GROUP=%{icinga_group} \
203              -DICINGA2_COMMAND_USER=%{icinga_user} \
204              -DICINGA2_COMMAND_GROUP=%{icingacmd_group}"
205 %if "%{_vendor}" == "redhat"
206 %if 0%{?el5} || 0%{?rhel} == 5 || "%{?dist}" == ".el5"
207 CMAKE_OPTS="$CMAKE_OPTS -DBOOST_LIBRARYDIR=/usr/lib/boost141 \
208  -DBOOST_INCLUDEDIR=/usr/include/boost141 \
209  -DBoost_ADDITIONAL_VERSIONS='1.41;1.41.0'"
210 %endif
211 %endif
212 cmake $CMAKE_OPTS . 
213
214 make %{?_smp_mflags}
215
216 %install
217 [ "%{buildroot}" != "/" ] && [ -d "%{buildroot}" ] && rm -rf %{buildroot}
218 make install \
219         DESTDIR="%{buildroot}"
220
221 # install classicui config
222 install -D -m 0644 etc/icinga/icinga-classic.htpasswd %{buildroot}%{icingaclassicconfdir}/passwd
223 install -D -m 0644 etc/icinga/cgi.cfg %{buildroot}%{icingaclassicconfdir}/cgi.cfg
224 install -D -m 0644 etc/icinga/icinga-classic-apache.conf %{buildroot}%{apacheconfdir}/icinga.conf
225
226 # fix plugin path on x64
227 sed -i 's@plugindir = .*@plugindir = "%{_libdir}/nagios/plugins"@' %{buildroot}/%{_sysconfdir}/%{name}/conf.d/macros.conf
228
229 %clean
230 [ "%{buildroot}" != "/" ] && [ -d "%{buildroot}" ] && rm -rf %{buildroot}
231
232 %pre common
233 getent group %{icinga_group} >/dev/null || %{_sbindir}/groupadd -r %{icinga_group}
234 getent group %{icingacmd_group} >/dev/null || %{_sbindir}/groupadd -r %{icingacmd_group}
235 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}
236 exit 0
237
238 %post ido-mysql
239 if [ ${1:-0} -eq 1 ]
240 then
241         # initial installation, enable ido-mysql feature
242         %{_sbindir}/icinga2-enable-feature ido-mysql
243 fi
244
245 %postun ido-mysql
246 if [ "$1" = "0" ]; then
247         # deinstallation of the package - remove feature
248         test -x %{_sbindir}/icinga2-disable-feature && %{_sbindir}/icinga2-disable-feature ido-mysql
249 fi
250
251 %post ido-pgsql
252 if [ ${1:-0} -eq 1 ]
253 then
254         # initial installation, enable ido-pgsql feature
255         %{_sbindir}/icinga2-enable-feature ido-pgsql
256 fi
257
258 %postun ido-pgsql
259 if [ "$1" = "0" ]; then
260         # deinstallation of the package - remove feature
261         test -x %{_sbindir}/icinga2-disable-feature && %{_sbindir}/icinga2-disable-feature ido-pgsql
262 fi
263
264 %post classicui-config
265 if [ ${1:-0} -eq 1 ]
266 then
267         # initial installation, enable features
268         %{_sbindir}/icinga2-enable-feature statusdata
269         %{_sbindir}/icinga2-enable-feature compatlog
270         %{_sbindir}/icinga2-enable-feature command
271 fi
272
273 %postun classicui-config
274 if [ "$1" = "0" ]; then
275         # deinstallation of the package - remove feature
276         test -x %{_sbindir}/icinga2-disable-feature && %{_sbindir}/icinga2-disable-feature statusdata
277         test -x %{_sbindir}/icinga2-disable-feature && %{_sbindir}/icinga2-disable-feature compatlog
278         test -x %{_sbindir}/icinga2-disable-feature && %{_sbindir}/icinga2-disable-feature command
279 fi
280
281 %files
282 %defattr(-,root,root,-)
283 %doc COPYING COPYING.Exceptions README NEWS AUTHORS ChangeLog
284 %attr(755,-,-) %{_sysconfdir}/init.d/%{name}
285 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/conf.d
286 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/features-available
287 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/features-enabled
288 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/%{name}.conf
289 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/conf.d/*.conf
290 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/features-available/*.conf
291 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/features-enabled/*.conf
292 %{_sbindir}/%{name}
293 %{_bindir}/%{name}-migrate-config
294 %{_bindir}/%{name}-build-ca
295 %{_bindir}/%{name}-build-key
296 %{_sbindir}/%{name}-enable-feature
297 %{_sbindir}/%{name}-disable-feature
298 %exclude %{_libdir}/%{name}/libdb_ido_mysql*
299 %{_libdir}/%{name}
300 %{_datadir}/%{name}
301 %exclude %{_datadir}/%{name}/itl
302 %{_mandir}/man8/%{name}.8.gz
303
304 %attr(0755,%{icinga_user},%{icinga_group}) %{_localstatedir}/cache/%{name}
305 %attr(0755,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/log/%{name}
306 %attr(0755,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/log/%{name}/compat
307 %attr(0755,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/log/%{name}/compat/archives
308 %attr(0755,%{icinga_user},%{icinga_group}) %{_localstatedir}/run/%{name}
309 %attr(0750,%{icinga_user},%{icinga_group}) %{_localstatedir}/lib/%{name}
310
311 %attr(2755,%{icinga_user},%{icingacmd_group}) %{_localstatedir}/run/icinga2/cmd
312
313 %files common
314 %defattr(-,root,root,-)
315 %doc COPYING COPYING.Exceptions README NEWS AUTHORS ChangeLog
316 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/spool/%{name}
317 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_datadir}/%{name}/itl
318 %{_datadir}/%{name}/itl
319
320 %files doc
321 %defattr(-,root,root,-)
322 %doc COPYING COPYING.Exceptions README NEWS AUTHORS ChangeLog
323 %{_datadir}/doc/%{name}
324 %docdir %{_datadir}/doc/%{name}
325
326 %files ido-mysql
327 %defattr(-,root,root,-)
328 %doc components/db_ido_mysql/schema COPYING COPYING.Exceptions README NEWS AUTHORS ChangeLog
329 %{_libdir}/%{name}/libdb_ido_mysql*
330
331 %files ido-pgsql
332 %defattr(-,root,root,-)
333 %doc components/db_ido_pgsql/schema COPYING COPYING.Exceptions README NEWS AUTHORS ChangeLog
334 %{_libdir}/%{name}/libdb_ido_pgsql*
335
336 %files classicui-config
337 %defattr(-,root,root,-)
338 %config(noreplace) %{icingaclassicconfdir}/cgi.cfg
339 %config(noreplace) %{apacheconfdir}/icinga.conf
340 %config(noreplace) %attr(0640,root,%{apachegroup}) %{icingaclassicconfdir}/passwd
341
342
343 %changelog
344 * Tue Oct 01 2013 Michael Friedrich <michael.friedrich@netways.de> - 0.0.3-1
345 - revamp package
346
347 * Sat May 04 2013 Michael Friedrich <michael.friedrich@netways.de> - 0.0.2-1
348 - new initscript in initdir
349 - itl is installed into datadir
350 - man pages in mandir
351 - use name macro to avoid typos
352
353 * Fri Nov 19 2012 Gunnar Beutner <gunnar.beutner@netways.de> - 0.0.1-1
354 - initial version