]> granicus.if.org Git - icinga2/blob - icinga2.spec
spec: Fix icinga2-ido-* description
[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 1
21
22 # make sure that _rundir is working on older systems
23 %if ! %{defined _rundir}
24 %define _rundir %{_localstatedir}/run
25 %endif
26
27 %define _libexecdir %{_prefix}/lib/
28
29 %if "%{_vendor}" == "redhat"
30 %define apachename httpd
31 %define apacheconfdir %{_sysconfdir}/httpd/conf.d
32 %define apacheuser apache
33 %define apachegroup apache
34 %if 0%{?el5}%{?el6}
35 %define use_systemd 0
36 %if %(uname -m) != "x86_64"
37 %define march_flag -march=i686
38 %endif
39 %else
40 # fedora and el>=7
41 %define use_systemd 1
42 %endif
43 %endif
44
45 %if "%{_vendor}" == "suse"
46 %define apachename apache2
47 %define apacheconfdir  %{_sysconfdir}/apache2/conf.d
48 %define apacheuser wwwrun
49 %define apachegroup www
50 %if 0%{?suse_version} >= 1310
51 %define use_systemd 1
52 %else
53 %define use_systemd 0
54 %endif
55 %endif
56
57 %define icinga_user icinga
58 %define icinga_group icinga
59 %define icingacmd_group icingacmd
60 %define icingaweb2name icingaweb2
61 %define icingaweb2version 2.0.0
62
63 %define icingaclassicconfdir %{_sysconfdir}/icinga
64
65 %define logmsg logger -t %{name}/rpm
66
67 Summary: Network monitoring application
68 Name: icinga2
69 Version: 2.2.1
70 Release: %{revision}%{?dist}
71 License: GPL-2.0+
72 Group: Applications/System
73 Source: https://github.com/Icinga/%{name}/archive/v%{version}.tar.gz
74 URL: http://www.icinga.org/
75 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
76 Requires: %{name}-bin = %{version}-%{release}
77
78 %description
79 Meta package for Icinga 2 Core, DB IDO and Web.
80
81 %package bin
82 Summary:      Icinga 2 binaries and libraries
83 Group:        Applications/System
84
85 %if "%{_vendor}" == "suse"
86 PreReq:        permissions
87 Provides:      monitoring_daemon
88 Recommends:    monitoring-plugins
89 %if 0%{?suse_version} >= 1310
90 BuildRequires: libyajl-devel
91 %endif
92 %endif
93 BuildRequires: openssl-devel
94 BuildRequires: gcc-c++
95 BuildRequires: libstdc++-devel
96 BuildRequires: cmake
97 BuildRequires: flex >= 2.5.35
98 BuildRequires: bison
99 BuildRequires: make
100
101 %if "%{_vendor}" == "redhat" && (0%{?el5} || 0%{?rhel} == 5 || "%{?dist}" == ".el5")
102 # el5 requires packages.icinga.org
103 BuildRequires: boost153-devel
104 %else
105 BuildRequires: boost-devel >= 1.41
106 %endif
107
108 %if 0%{?use_systemd}
109 BuildRequires: systemd
110 Requires: systemd
111 %endif
112
113 Requires: %{name}-common = %{version}-%{release}
114
115 %description bin
116 Icinga 2 is a general-purpose network monitoring application.
117 Provides binaries and libraries for Icinga 2 Core.
118
119 %package common
120 Summary:      Common Icinga 2 configuration
121 Group:        Applications/System
122 %if "%{_vendor}" == "redhat"
123 Requires(pre): shadow-utils
124 Requires(post): shadow-utils
125 %endif
126 %if "%{_vendor}" == "suse"
127 Recommends:   logrotate
128 %endif
129
130 %description common
131 Provides common directories, uid and gid among Icinga 2 related
132 packages.
133
134
135 %package doc
136 Summary:      Documentation for Icinga 2
137 Group:        Applications/System
138 Requires:     %{name} = %{version}-%{release}
139
140 %description doc
141 Provides documentation for Icinga 2.
142
143
144 %package ido-mysql
145 Summary:      IDO MySQL database backend for Icinga 2
146 Group:        Applications/System
147 %if "%{_vendor}" == "suse"
148 BuildRequires: libmysqlclient-devel
149 %endif
150 BuildRequires: mysql-devel
151 Requires: %{name} = %{version}-%{release}
152
153 %description ido-mysql
154 Icinga 2 IDO mysql database backend. Compatible with Icinga 1.x
155 IDOUtils schema >= 1.12
156
157
158 %package ido-pgsql
159 Summary:      IDO PostgreSQL database backend for Icinga 2
160 Group:        Applications/System
161 BuildRequires: postgresql-devel
162 Requires: %{name} = %{version}-%{release}
163
164 %description ido-pgsql
165 Icinga 2 IDO PostgreSQL database backend. Compatible with Icinga 1.x
166 IDOUtils schema >= 1.12
167
168
169 %package classicui-config
170 Summary:      Icinga 2 Classic UI Standalone configuration
171 Group:        Applications/System
172 BuildRequires: %{apachename}
173 Requires:     %{apachename}
174 Requires:     %{name} = %{version}-%{release}
175 %if "%{_vendor}" == "suse"
176 Recommends:   icinga-www
177 %endif
178 Provides:     icinga-classicui-config
179 Conflicts:    icinga-gui-config
180
181 %description classicui-config
182 Icinga 1.x Classic UI Standalone configuration with locations
183 for Icinga 2.
184
185
186 %prep
187 %setup -q -n %{name}-%{version}
188
189 %build
190 CMAKE_OPTS="-DCMAKE_INSTALL_PREFIX=/usr \
191          -DCMAKE_INSTALL_SYSCONFDIR=/etc \
192          -DCMAKE_INSTALL_LOCALSTATEDIR=/var \
193          -DCMAKE_BUILD_TYPE=RelWithDebInfo \
194          -DCMAKE_VERBOSE_MAKEFILE=ON \
195          -DBoost_NO_BOOST_CMAKE=ON \
196          -DICINGA2_RUNDIR=%{_rundir} \
197          -DICINGA2_USER=%{icinga_user} \
198          -DICINGA2_GROUP=%{icinga_group} \
199          -DICINGA2_COMMAND_GROUP=%{icingacmd_group} \
200          -DICINGA2_UNITY_BUILD=TRUE"
201 %if "%{_vendor}" == "redhat"
202 %if 0%{?el5} || 0%{?rhel} == 5 || "%{?dist}" == ".el5"
203 # Boost_VERSION 1.41.0 vs 101400 - disable build tests
204 # details in https://dev.icinga.org/issues/5033
205 CMAKE_OPTS="$CMAKE_OPTS -DBOOST_LIBRARYDIR=/usr/lib \
206  -DBOOST_INCLUDEDIR=/usr/include \
207  -DBoost_ADDITIONAL_VERSIONS='1.53;1.53.0' \
208  -DBoost_NO_SYSTEM_PATHS=TRUE \
209  -DBUILD_TESTING=FALSE \
210  -DBoost_NO_BOOST_CMAKE=TRUE"
211 %endif
212 %endif
213
214 %if "%{_vendor}" != "suse"
215 CMAKE_OPTS="$CMAKE_OPTS -DICINGA2_PLUGINDIR=%{_libdir}/nagios/plugins"
216 %else
217 CMAKE_OPTS="$CMAKE_OPTS -DICINGA2_PLUGINDIR=%{_prefix}/lib/nagios/plugins"
218 %endif
219
220 %if 0%{?use_systemd}
221 CMAKE_OPTS="$CMAKE_OPTS -DUSE_SYSTEMD=ON"
222 %endif
223
224 cmake $CMAKE_OPTS -DCMAKE_C_FLAGS:STRING="%{optflags} %{?march_flag}" -DCMAKE_CXX_FLAGS:STRING="%{optflags} %{?march_flag}" .
225
226 make %{?_smp_mflags}
227
228
229 %install
230 make install \
231         DESTDIR="%{buildroot}"
232
233 # install classicui config
234 install -D -m 0644 etc/icinga/icinga-classic.htpasswd %{buildroot}%{icingaclassicconfdir}/passwd
235 install -D -m 0644 etc/icinga/cgi.cfg %{buildroot}%{icingaclassicconfdir}/cgi.cfg
236 install -D -m 0644 etc/icinga/icinga-classic-apache.conf %{buildroot}%{apacheconfdir}/icinga.conf
237
238 # remove features-enabled symlinks
239 rm -f %{buildroot}/%{_sysconfdir}/%{name}/features-enabled/*.conf
240
241 # enable suse rc links
242 %if "%{_vendor}" == "suse"
243 %if 0%{?use_systemd}
244   ln -sf /usr/sbin/service %{buildroot}%{_sbindir}/rc%{name}
245 %else
246   ln -sf ../../%{_initrddir}/%{name} "%{buildroot}%{_sbindir}/rc%{name}"
247 %endif
248 mkdir -p "%{buildroot}%{_localstatedir}/adm/fillup-templates/"
249 mv "%{buildroot}%{_sysconfdir}/sysconfig/%{name}" "%{buildroot}%{_localstatedir}/adm/fillup-templates/sysconfig.%{name}"
250 %endif
251
252
253 %clean
254 [ "%{buildroot}" != "/" ] && [ -d "%{buildroot}" ] && rm -rf %{buildroot}
255
256 %pre common
257 getent group %{icinga_group} >/dev/null || %{_sbindir}/groupadd -r %{icinga_group}
258 getent group %{icingacmd_group} >/dev/null || %{_sbindir}/groupadd -r %{icingacmd_group}
259 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}
260
261 %if "%{_vendor}" == "suse"
262 %if 0%{?use_systemd}
263   %service_add_pre %{name}.service
264 %endif
265 %endif
266 exit 0
267
268 %if "%{_vendor}" == "suse"
269 %verifyscript bin
270 %verify_permissions -e %{_rundir}/%{name}/cmd
271
272 %if 0%{?suse_version} >= 1310
273 %post bin
274 %set_permissions %{_rundir}/%{name}/cmd
275 %endif
276 %endif
277
278 %post common
279 # suse
280 %if "%{_vendor}" == "suse"
281 %if 0%{?use_systemd}
282 %fillup_only  %{name}
283 %service_add_post %{name}.service
284 %else
285 %fillup_and_insserv %{name}
286 %endif
287
288 # initial installation, enable default features
289 for feature in checker notification mainlog; do
290         ln -sf ../features-available/${feature}.conf %{_sysconfdir}/%{name}/features-enabled/${feature}.conf
291 done
292
293 exit 0
294
295 %else
296 # rhel
297
298 %if 0%{?use_systemd}
299 %systemd_post %{name}.service
300 %else
301 /sbin/chkconfig --add %{name}
302 %endif
303
304 if [ ${1:-0} -eq 1 ]
305 then
306         # initial installation, enable default features
307         for feature in checker notification mainlog; do
308                 ln -sf ../features-available/${feature}.conf %{_sysconfdir}/%{name}/features-enabled/${feature}.conf
309         done
310 fi
311
312 exit 0
313
314 %endif
315 # suse/rhel
316
317 %postun common
318 # suse
319 %if "%{_vendor}" == "suse"
320 %if 0%{?using_systemd}
321   %service_del_postun %{name}.service
322 %else
323   %restart_on_update %{name}
324   %insserv_cleanup
325 %endif
326
327 %else
328 # rhel
329
330 %if 0%{?use_systemd}
331 %systemd_postun_with_restart %{name}.service
332 %else
333 if [ "$1" -ge  "1" ]; then
334         /sbin/service %{name} condrestart >/dev/null 2>&1 || :
335 fi
336 %endif
337
338 %endif
339 # suse / rhel
340
341 if [ "$1" = "0" ]; then
342         # deinstallation of the package - remove enabled features
343         rm -rf %{_sysconfdir}/%{name}/features-enabled
344 fi
345
346 exit 0
347
348 %preun common
349 # suse
350 %if "%{_vendor}" == "suse"
351
352 %if 0%{?use_systemd}
353   %service_del_preun %{name}.service
354 %else
355   %stop_on_removal %{name}
356 %endif
357
358 exit 0
359
360 %else
361 # rhel
362
363 %if 0%{?use_systemd}
364 %systemd_preun %{name}.service
365 %else
366 if [ "$1" = "0" ]; then
367         /sbin/service %{name} stop > /dev/null 2>&1 || :
368         /sbin/chkconfig --del %{name} || :
369 fi
370 %endif
371
372 exit 0
373
374 %endif
375 # suse / rhel
376
377 %post ido-mysql
378 if [ ${1:-0} -eq 1 ]
379 then
380         # initial installation, enable ido-mysql feature
381         ln -sf ../features-available/ido-mysql.conf %{_sysconfdir}/%{name}/features-enabled/ido-mysql.conf
382 fi
383
384 exit 0
385
386 %postun ido-mysql
387 if [ "$1" = "0" ]; then
388         # deinstallation of the package - remove feature
389         rm -f %{_sysconfdir}/%{name}/features-enabled/ido-mysql.conf
390 fi
391
392 exit 0
393
394 %post ido-pgsql
395 if [ ${1:-0} -eq 1 ]
396 then
397         # initial installation, enable ido-pgsql feature
398         ln -sf ../features-available/ido-pgsql.conf %{_sysconfdir}/%{name}/features-enabled/ido-pgsql.conf
399 fi
400
401 exit 0
402
403 %postun ido-pgsql
404 if [ "$1" = "0" ]; then
405         # deinstallation of the package - remove feature
406         rm -f %{_sysconfdir}/%{name}/features-enabled/ido-pgsql.conf
407 fi
408
409 exit 0
410
411 %post classicui-config
412 if [ ${1:-0} -eq 1 ]
413 then
414         # initial installation, enable features
415         for feature in statusdata compatlog command; do
416                 ln -sf ../features-available/${feature}.conf %{_sysconfdir}/%{name}/features-enabled/${feature}.conf
417         done
418 fi
419
420 exit 0
421
422 %postun classicui-config
423 if [ "$1" = "0" ]; then
424         # deinstallation of the package - remove feature
425         for feature in statusdata compatlog command; do
426                 rm -f %{_sysconfdir}/%{name}/features-enabled/${feature}.conf
427         done
428 fi
429
430 exit 0
431
432 %files
433 %defattr(-,root,root,-)
434 %doc COPYING
435
436 %files bin
437 %defattr(-,root,root,-)
438 %doc COPYING COPYING.Exceptions README.md NEWS AUTHORS ChangeLog
439 %{_sbindir}/%{name}
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
447 %attr(0750,%{icinga_user},%{icingacmd_group}) %{_localstatedir}/cache/%{name}
448 %attr(0750,%{icinga_user},%{icingacmd_group}) %dir %{_localstatedir}/log/%{name}
449 %attr(0750,%{icinga_user},%{icingacmd_group}) %dir %{_localstatedir}/log/%{name}/compat
450 %attr(0750,%{icinga_user},%{icingacmd_group}) %dir %{_localstatedir}/log/%{name}/compat/archives
451 %attr(0750,%{icinga_user},%{icinga_group}) %{_localstatedir}/lib/%{name}
452
453 %attr(0750,%{icinga_user},%{icingacmd_group}) %ghost %{_rundir}/%{name}
454 %attr(2750,%{icinga_user},%{icingacmd_group}) %ghost %{_rundir}/%{name}/cmd
455
456 %files common
457 %defattr(-,root,root,-)
458 %doc COPYING COPYING.Exceptions README.md NEWS AUTHORS ChangeLog tools/syntax
459 %attr(0750,%{icinga_user},%{icingacmd_group}) %dir %{_localstatedir}/log/%{name}
460 %config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
461 %{_sysconfdir}/bash_completion.d/%{name}
462 %if 0%{?use_systemd}
463 %attr(644,root,root) %{_unitdir}/%{name}.service
464 %else
465 %attr(755,root,root) %{_sysconfdir}/init.d/%{name}
466 %endif
467 %if "%{_vendor}" == "suse"
468 %{_sbindir}/rc%{name}
469 %{_localstatedir}/adm/fillup-templates/sysconfig.%{name}
470 %else
471 %config(noreplace) %{_sysconfdir}/sysconfig/%{name}
472 %endif
473 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}
474 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/conf.d
475 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/features-available
476 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/features-enabled
477 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/repository.d
478 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/scripts
479 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/repository.d
480 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/zones.d
481 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/%{name}.conf
482 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/init.conf
483 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/constants.conf
484 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/zones.conf
485 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/conf.d/*.conf
486 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/features-available/*.conf
487 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/repository.d/*
488 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/zones.d/*
489 %config(noreplace) %{_sysconfdir}/%{name}/scripts/*
490 %dir %{_libexecdir}/%{name}
491 %{_libexecdir}/%{name}/prepare-dirs
492 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/spool/%{name}
493 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/spool/%{name}/perfdata
494 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/spool/%{name}/tmp
495 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_datadir}/%{name}/include
496 %{_datadir}/%{name}/include
497
498 %files doc
499 %defattr(-,root,root,-)
500 %{_datadir}/doc/%{name}
501 %docdir %{_datadir}/doc/%{name}
502
503 %files ido-mysql
504 %defattr(-,root,root,-)
505 %doc COPYING COPYING.Exceptions README.md NEWS AUTHORS ChangeLog
506 %{_libdir}/%{name}/libdb_ido_mysql*
507 %{_datadir}/icinga2-ido-mysql
508
509 %files ido-pgsql
510 %defattr(-,root,root,-)
511 %doc COPYING COPYING.Exceptions README.md NEWS AUTHORS ChangeLog
512 %{_libdir}/%{name}/libdb_ido_pgsql*
513 %{_datadir}/icinga2-ido-pgsql
514
515 %files classicui-config
516 %defattr(-,root,root,-)
517 %attr(0751,%{icinga_user},%{icinga_group}) %dir %{icingaclassicconfdir}
518 %config(noreplace) %{icingaclassicconfdir}/cgi.cfg
519 %config(noreplace) %{apacheconfdir}/icinga.conf
520 %config(noreplace) %attr(0640,root,%{apachegroup}) %{icingaclassicconfdir}/passwd
521
522 %changelog