]> granicus.if.org Git - icinga2/blob - icinga2.spec
Add man pages to packages
[icinga2] / icinga2.spec
1 #/******************************************************************************
2 # * Icinga 2                                                                   *
3 # * Copyright (C) 2012-2014 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 2.beta2.dev
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 # opensuse 13
33 %if 0%{?suse_version} >= 1310
34 %define opensuse_boost_version 1_53_0
35 %else
36 %define opensuse_boost_version 1_49_0
37 %endif
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
43 %endif
44
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
50
51 %define icingaclassicconfdir %{_sysconfdir}/icinga
52
53 %define logmsg logger -t %{name}/rpm
54
55 Summary: Network monitoring application
56 Name: icinga2
57 Version: 2.0.0
58 Release: %{revision}%{?dist}
59 License: GPLv2+
60 Group: Applications/System
61 Source: %{name}-%{version}.tar.gz
62 URL: http://www.icinga.org/
63 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
64
65 Requires: %{name}-bin = %{version}
66 #Requires: %{name}-ido-mysql = %{version}
67 #Requires: %{icingaweb2name} >= %{icingaweb2version}
68
69 %description
70 Meta package for Icinga 2 Core, DB IDO and Web.
71
72 %package bin
73 Summary:      Icinga 2 binaries and libraries
74 Group:        Applications/System
75
76 BuildRequires: openssl-devel
77 BuildRequires: gcc-c++
78 BuildRequires: libstdc++-devel
79 BuildRequires: cmake
80 BuildRequires: flex >= 2.5.35
81 BuildRequires: bison
82 BuildRequires: make
83
84 # redhat
85 %if "%{_vendor}" == "redhat"
86 %if 0%{?el5} || 0%{?rhel} == 5 || "%{?dist}" == ".el5"
87 # el5 requires EPEL
88 BuildRequires: boost%{el5_boost_version}-devel
89 BuildRequires: boost%{el5_boost_version}
90 Requires: boost%{el5_boost_version}-program-options
91 Requires: boost%{el5_boost_version}-system
92 Requires: boost%{el5_boost_version}-test
93 Requires: boost%{el5_boost_version}-thread
94 Requires: boost%{el5_boost_version}-regex
95 %else
96 BuildRequires: boost-devel >= 1.41
97 Requires: boost-program-options >= 1.41
98 Requires: boost-system >= 1.41
99 Requires: boost-test >= 1.41
100 Requires: boost-thread >= 1.41
101 Requires: boost-regex >= 1.41
102 %endif
103 %endif
104 #redhat
105
106 # suse
107 %if "%{_vendor}" == "suse"
108 # sles
109 # note: sles_version macro is not set in SLES11 anymore
110 # note: sles service packs are not under version control
111 %if 0%{?suse_version} == 1110
112 BuildRequires: gcc-fortran
113 BuildRequires: libgfortran43
114 BuildRequires: boost-license%{sles_boost_version}
115 BuildRequires: boost-devel >= 1.41
116 Requires: boost-license%{sles_boost_version}
117 Requires: libboost_program_options%{sles_boost_version}
118 Requires: libboost_system%{sles_boost_version}
119 Requires: libboost_test%{sles_boost_version}
120 Requires: libboost_thread%{sles_boost_version}
121 Requires: libboost_regex%{sles_boost_version}
122 %endif
123 # opensuse
124 %if 0%{?suse_version} >= 1210
125 BuildRequires: boost-devel >= 1.41
126 Requires: libboost_program_options%{opensuse_boost_version}
127 Requires: libboost_system%{opensuse_boost_version}
128 Requires: libboost_test%{opensuse_boost_version}
129 Requires: libboost_thread%{opensuse_boost_version}
130 Requires: libboost_regex%{opensuse_boost_version}
131 %endif
132 %endif
133 # suse
134
135 Requires: %{name}-common = %{version}
136
137 %description bin
138 Icinga 2 is a general-purpose network monitoring application.
139 Provides binaries and libraries for Icinga 2 Core.
140
141 %package common
142 Summary:      Common Icinga 2 configuration
143 Group:        Applications/System
144 %if "%{_vendor}" == "redhat"
145 Requires(pre): shadow-utils
146 Requires(post): shadow-utils
147 %endif
148
149 %description common
150 Provides common directories, uid and gid among Icinga 2 related
151 packages.
152
153
154 %package doc
155 Summary:      Documentation for Icinga 2
156 Group:        Applications/System
157 Requires:     %{name} = %{version}-%{release}
158
159 %description doc
160 Documentation for Icinga 2
161
162
163 %package ido-mysql
164 Summary:      IDO MySQL database backend for Icinga 2
165 Group:        Applications/System
166 %if "%{_vendor}" == "suse"
167 BuildRequires: libmysqlclient-devel
168 %if 0%{?suse_version} >= 1210
169 Requires: libmysqlclient18
170 %else
171 Requires: libmysqlclient15
172 %endif
173 %endif
174 %if "%{_vendor}" == "redhat"
175 # el5 only provides mysql package
176 %if 0%{?el5} || 0%{?rhel} == 5 || "%{?dist}" == ".el5"
177 BuildRequires: mysql
178 %else
179 BuildRequires: mysql-libs
180 BuildRequires: mysql
181 %endif
182 BuildRequires: mysql-devel
183 Requires: mysql
184 %endif
185 Requires: %{name} = %{version}-%{release}
186
187 %description ido-mysql
188 Icinga 2 IDO mysql database backend. Compatible with Icinga 1.x
189 IDOUtils schema >= 1.10
190
191
192 %package ido-pgsql
193 Summary:      IDO PostgreSQL database backend for Icinga 2
194 Group:        Applications/System
195 %if "%{_vendor}" == "suse"
196 BuildRequires: postgresql-libs
197 %endif
198 BuildRequires: postgresql-devel
199 Requires: postgresql-libs
200 Requires: %{name} = %{version}-%{release}
201
202 %description ido-pgsql
203 Icinga 2 IDO PostgreSQL database backend. Compatible with Icinga 1.x
204 IDOUtils schema >= 1.10
205
206
207 %package classicui-config
208 Summary:      Icinga 2 Classic UI Standalone configuration
209 Group:        Applications/System
210 BuildRequires: %{apachename}
211 Requires:     %{apachename}
212 Requires:     %{name} = %{version}-%{release}
213 Provides:     icinga-classicui-config
214 Conflicts:    icinga-gui-config
215
216 %description classicui-config
217 Icinga 1.x Classic UI Standalone configuration with locations
218 for Icinga 2.
219
220
221 %prep
222 %setup -q -n %{name}-%{version}
223
224 %build
225 CMAKE_OPTS="-DCMAKE_INSTALL_PREFIX=/usr \
226          -DCMAKE_INSTALL_SYSCONFDIR=/etc \
227                  -DCMAKE_INSTALL_LOCALSTATEDIR=/var \
228          -DCMAKE_BUILD_TYPE=RelWithDebInfo \
229          -DICINGA2_USER=%{icinga_user} \
230          -DICINGA2_GROUP=%{icinga_group} \
231              -DICINGA2_COMMAND_USER=%{icinga_user} \
232              -DICINGA2_COMMAND_GROUP=%{icingacmd_group}"
233 %if "%{_vendor}" == "redhat"
234 %if 0%{?el5} || 0%{?rhel} == 5 || "%{?dist}" == ".el5"
235 # Boost_VERSION 1.41.0 vs 101400 - disable build tests
236 # details in https://dev.icinga.org/issues/5033
237 CMAKE_OPTS="$CMAKE_OPTS -DBOOST_LIBRARYDIR=/usr/lib/boost141 \
238  -DBOOST_INCLUDEDIR=/usr/include/boost141 \
239  -DBoost_ADDITIONAL_VERSIONS='1.41;1.41.0' \
240  -DBoost_NO_SYSTEM_PATHS=TRUE \
241  -DBUILD_TESTING=FALSE \
242  -DBoost_NO_BOOST_CMAKE=TRUE"
243 %endif
244 %endif
245
246 cmake $CMAKE_OPTS .
247
248 make %{?_smp_mflags}
249
250 %install
251 [ "%{buildroot}" != "/" ] && [ -d "%{buildroot}" ] && rm -rf %{buildroot}
252 make install \
253         DESTDIR="%{buildroot}"
254
255 # install classicui config
256 install -D -m 0644 etc/icinga/icinga-classic.htpasswd %{buildroot}%{icingaclassicconfdir}/passwd
257 install -D -m 0644 etc/icinga/cgi.cfg %{buildroot}%{icingaclassicconfdir}/cgi.cfg
258 install -D -m 0644 etc/icinga/icinga-classic-apache.conf %{buildroot}%{apacheconfdir}/icinga.conf
259
260 # fix plugin path on x64
261 %if "%{_vendor}" != "suse"
262 sed -i 's@PluginDir = .*@PluginDir = "%{_libdir}/nagios/plugins"@' %{buildroot}/%{_sysconfdir}/%{name}/constants.conf
263 %endif
264
265 # remove features-enabled symlinks
266 rm -f %{buildroot}/%{_sysconfdir}/%{name}/features-enabled/*.conf
267
268 %clean
269 [ "%{buildroot}" != "/" ] && [ -d "%{buildroot}" ] && rm -rf %{buildroot}
270
271 %pre common
272 getent group %{icinga_group} >/dev/null || %{_sbindir}/groupadd -r %{icinga_group}
273 getent group %{icingacmd_group} >/dev/null || %{_sbindir}/groupadd -r %{icingacmd_group}
274 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}
275 exit 0
276
277 # all restart/feature actions belong to icinga2-bin
278 %post bin
279 # suse
280 %if 0%{?suse_version}
281
282 %fillup_and_insserv %{name}
283
284 # initial installation, enable default features
285 %{_sbindir}/icinga2-enable-feature checker notification mainlog
286
287 exit 0
288
289 %else
290 # rhel
291
292 /sbin/chkconfig --add %{name}
293
294 if [ ${1:-0} -eq 1 ]
295 then
296         # initial installation, enable default features
297         %{_sbindir}/icinga2-enable-feature checker notification mainlog
298 fi
299
300 exit 0
301
302 %endif
303 # suse/rhel
304
305 %postun bin
306 # suse
307 %if 0%{?suse_version}
308
309 %restart_on_update %{name}
310 %insserv_cleanup
311
312 if [ "$1" = "0" ]; then
313         # deinstallation of the package - remove enabled features
314         rm -rf %{_sysconfdir}/%{name}/features-enabled
315 fi
316
317 exit 0
318
319 %else
320 # rhel
321
322 if [ "$1" -ge  "1" ]; then
323         /sbin/service %{name} condrestart >/dev/null 2>&1 || :
324 fi
325
326 if [ "$1" = "0" ]; then
327         # deinstallation of the package - remove enabled features
328         rm -rf %{_sysconfdir}/%{name}/features-enabled
329 fi
330
331 exit 0
332 %endif
333 # suse / rhel
334
335 %preun bin
336 # suse
337 %if 0%{?suse_version}
338
339 if [ "$1" = "0" ]; then
340         %stop_on_removal %{name}
341 fi
342
343 exit 0
344
345 %else
346 # rhel
347
348 if [ "$1" = "0" ]; then
349         /sbin/service %{name} stop > /dev/null 2>&1 || :
350         /sbin/chkconfig --del %{name} || :
351 fi
352
353 exit 0
354
355 %endif
356 # suse / rhel
357
358 %post ido-mysql
359 if [ ${1:-0} -eq 1 ]
360 then
361         # initial installation, enable ido-mysql feature
362         %{_sbindir}/icinga2-enable-feature ido-mysql
363 fi
364
365 exit 0
366
367 %postun ido-mysql
368 if [ "$1" = "0" ]; then
369         # deinstallation of the package - remove feature
370         test -x %{_sbindir}/icinga2-disable-feature && %{_sbindir}/icinga2-disable-feature ido-mysql
371 fi
372
373 exit 0
374
375 %post ido-pgsql
376 if [ ${1:-0} -eq 1 ]
377 then
378         # initial installation, enable ido-pgsql feature
379         %{_sbindir}/icinga2-enable-feature ido-pgsql
380 fi
381
382 exit 0
383
384 %postun ido-pgsql
385 if [ "$1" = "0" ]; then
386         # deinstallation of the package - remove feature
387         test -x %{_sbindir}/icinga2-disable-feature && %{_sbindir}/icinga2-disable-feature ido-pgsql
388 fi
389
390 exit 0
391
392 %post classicui-config
393 if [ ${1:-0} -eq 1 ]
394 then
395         # initial installation, enable features
396         %{_sbindir}/icinga2-enable-feature statusdata compatlog command
397 fi
398
399 exit 0
400
401 %postun classicui-config
402 if [ "$1" = "0" ]; then
403         # deinstallation of the package - remove feature
404         test -x %{_sbindir}/icinga2-disable-feature && %{_sbindir}/icinga2-disable-feature statusdata
405         test -x %{_sbindir}/icinga2-disable-feature && %{_sbindir}/icinga2-disable-feature compatlog
406         test -x %{_sbindir}/icinga2-disable-feature && %{_sbindir}/icinga2-disable-feature command
407 fi
408
409 exit 0
410
411 %files
412
413 %files bin
414 %defattr(-,root,root,-)
415 %doc COPYING COPYING.Exceptions README NEWS AUTHORS ChangeLog
416 %attr(755,-,-) %{_sysconfdir}/init.d/%{name}
417 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}
418 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/conf.d
419 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/conf.d/hosts
420 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/conf.d/hosts/localhost
421 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/features-available
422 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/features-enabled
423 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/scripts
424 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/zones.d
425 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/%{name}.conf
426 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/constants.conf
427 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/zones.conf
428 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/conf.d/*.conf
429 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/conf.d/hosts/*.conf
430 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/conf.d/hosts/localhost/*.conf
431 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/features-available/*.conf
432 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/zones.d/*
433 %config(noreplace) %{_sysconfdir}/%{name}/scripts/*
434 %{_sbindir}/%{name}
435 %{_bindir}/%{name}-build-ca
436 %{_bindir}/%{name}-build-key
437 %{_bindir}/%{name}-sign-key
438 %{_sbindir}/%{name}-enable-feature
439 %{_sbindir}/%{name}-disable-feature
440 %exclude %{_libdir}/%{name}/libdb_ido_mysql*
441 %exclude %{_libdir}/%{name}/libdb_ido_pgsql*
442 %{_libdir}/%{name}
443 %{_datadir}/%{name}
444 %exclude %{_datadir}/%{name}/include
445 %{_mandir}/man8/%{name}.8.gz
446 %{_mandir}/man8/%{name}-enable-feature.8.gz
447 %{_mandir}/man8/%{name}-disable-feature.8.gz
448 %{_mandir}/man8/%{name}-build-ca.8.gz
449 %{_mandir}/man8/%{name}-build-key.8.gz
450 %{_mandir}/man8/%{name}-sign-key.8.gz
451
452 %attr(0755,%{icinga_user},%{icinga_group}) %{_localstatedir}/cache/%{name}
453 %attr(0755,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/log/%{name}
454 %attr(0755,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/log/%{name}/compat
455 %attr(0755,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/log/%{name}/compat/archives
456 %attr(0755,%{icinga_user},%{icinga_group}) %ghost %{_localstatedir}/run/%{name}
457 %attr(0750,%{icinga_user},%{icinga_group}) %{_localstatedir}/lib/%{name}
458
459 %attr(2755,%{icinga_user},%{icingacmd_group}) %ghost %{_localstatedir}/run/icinga2/cmd
460
461 %files common
462 %defattr(-,root,root,-)
463 %doc COPYING COPYING.Exceptions README NEWS AUTHORS ChangeLog tools/syntax
464 %config(noreplace) %attr(755,-,-) %{_sysconfdir}/logrotate.d/%{name}
465 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/spool/%{name}
466 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/spool/%{name}/perfdata
467 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/spool/%{name}/tmp
468 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_datadir}/%{name}/include
469 %{_datadir}/%{name}/include
470
471 %files doc
472 %defattr(-,root,root,-)
473 %{_datadir}/doc/%{name}
474 %docdir %{_datadir}/doc/%{name}
475
476 %files ido-mysql
477 %defattr(-,root,root,-)
478 %doc components/db_ido_mysql/schema COPYING COPYING.Exceptions README NEWS AUTHORS ChangeLog
479 %{_libdir}/%{name}/libdb_ido_mysql*
480
481 %files ido-pgsql
482 %defattr(-,root,root,-)
483 %doc components/db_ido_pgsql/schema COPYING COPYING.Exceptions README NEWS AUTHORS ChangeLog
484 %{_libdir}/%{name}/libdb_ido_pgsql*
485
486 %files classicui-config
487 %defattr(-,root,root,-)
488 %attr(0751,%{icinga_user},%{icinga_group}) %dir %{icingaclassicconfdir}
489 %config(noreplace) %{icingaclassicconfdir}/cgi.cfg
490 %config(noreplace) %{apacheconfdir}/icinga.conf
491 %config(noreplace) %attr(0640,root,%{apachegroup}) %{icingaclassicconfdir}/passwd
492
493
494 %changelog