]> granicus.if.org Git - icinga2/blob - icinga2.spec
Docs: Add SELinux chapter
[icinga2] / icinga2.spec
1 #/******************************************************************************
2 # * Icinga 2                                                                   *
3 # * Copyright (C) 2012-2016 Icinga Development Team (https://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.4.10
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: https://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: libedit-devel
94 BuildRequires: ncurses-devel
95 %if "%{_vendor}" == "suse" && 0%{?suse_version} < 1210
96 BuildRequires: gcc48-c++
97 BuildRequires: libstdc++47-devel
98 BuildRequires: libopenssl1-devel
99 %else
100 BuildRequires: gcc-c++
101 BuildRequires: libstdc++-devel
102 BuildRequires: openssl-devel
103 %endif
104 BuildRequires: cmake
105 BuildRequires: flex >= 2.5.35
106 BuildRequires: bison
107 BuildRequires: make
108 %if 0%{?fedora}
109 BuildRequires: wxGTK3-devel
110 BuildRequires: firewalld-filesystem
111 Requires: firewalld-filesystem
112 Requires(post): firewalld-filesystem
113 %endif
114 %if 0%{?rhel} == 7
115 Requires: firewalld
116 Requires(post): firewalld
117 %endif
118
119 %if 0%{?build_icinga_org} && "%{_vendor}" == "redhat" && (0%{?el5} || 0%{?rhel} == 5 || "%{?dist}" == ".el5" || 0%{?el6} || 0%{?rhel} == 6 || "%{?dist}" == ".el6")
120 # el5 and el6 require packages.icinga.org
121 BuildRequires: boost153-devel
122 %else
123 %if 0%{?build_icinga_org} && "%{_vendor}" == "suse" && 0%{?suse_version} < 1310
124 # sles 11 sp3 requires packages.icinga.org
125 BuildRequires: boost153-devel
126 %else
127 BuildRequires: boost-devel >= 1.41
128 %endif
129 %endif
130
131 %if 0%{?use_systemd}
132 BuildRequires: systemd
133 Requires: systemd
134 %endif
135
136 Requires: %{name}-libs = %{version}-%{release}
137
138 %description bin
139 Icinga 2 is a general-purpose network monitoring application.
140 Provides binaries for Icinga 2 Core.
141
142 %package common
143 Summary:      Common Icinga 2 configuration
144 Group:        Applications/System
145 %if "%{_vendor}" == "redhat"
146 Requires(pre): shadow-utils
147 Requires(post): shadow-utils
148 %endif
149 %if "%{_vendor}" == "suse"
150 Recommends:   logrotate
151 %endif
152
153 %description common
154 Provides common directories, uid and gid among Icinga 2 related
155 packages.
156
157
158 %package doc
159 Summary:      Documentation for Icinga 2
160 Group:        Applications/System
161 Requires:     %{name} = %{version}-%{release}
162
163 %description doc
164 Provides documentation for Icinga 2.
165
166
167 %package libs
168 Summary:      Libraries for Icinga 2
169 Group:        Applications/System
170 Requires:     %{name}-common = %{version}-%{release}
171
172 %description libs
173 Provides internal libraries for the daemon or studio.
174
175
176 %package ido-mysql
177 Summary:      IDO MySQL database backend for Icinga 2
178 Group:        Applications/System
179 %if "%{_vendor}" == "suse"
180 BuildRequires: libmysqlclient-devel
181 %if 0%{?suse_version} >= 1310
182 BuildRequires: mysql-devel
183 %endif
184
185 %else
186 BuildRequires: mysql-devel
187 %endif #suse
188
189 Requires: %{name} = %{version}-%{release}
190
191 %description ido-mysql
192 Icinga 2 IDO mysql database backend. Compatible with Icinga 1.x
193 IDOUtils schema >= 1.12
194
195
196 %package ido-pgsql
197 Summary:      IDO PostgreSQL database backend for Icinga 2
198 Group:        Applications/System
199 BuildRequires: postgresql-devel
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.12
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 %if "%{_vendor}" == "suse"
214 Recommends:   icinga-www
215 %endif
216 Provides:     icinga-classicui-config
217 Conflicts:    icinga-gui-config
218
219 %description classicui-config
220 Icinga 1.x Classic UI Standalone configuration with locations
221 for Icinga 2.
222
223 %if "%{_vendor}" == "redhat" && !(0%{?el5} || 0%{?rhel} == 5 || "%{?dist}" == ".el5" || 0%{?el6} || 0%{?rhel} == 6 || "%{?dist}" == ".el6")
224 %global selinux_variants mls targeted
225 %{!?_selinux_policy_version: %global _selinux_policy_version %(sed -e 's,.*selinux-policy-\\([^/]*\\)/.*,\\1,' /usr/share/selinux/devel/policyhelp 2>/dev/null)}
226 %global modulename %{name}
227
228 %package selinux
229 Summary:        SELinux policy module supporting icinga2
230 Group:          System Environment/Base
231 BuildRequires:  checkpolicy, selinux-policy-devel, /usr/share/selinux/devel/policyhelp, hardlink
232 %if "%{_selinux_policy_version}" != ""
233 Requires:       selinux-policy >= %{_selinux_policy_version}
234 %endif
235 Requires:       %{name} = %{version}-%{release}
236 Requires(post):   /usr/sbin/semodule, /sbin/restorecon
237 Requires(postun): /usr/sbin/semodule, /sbin/restorecon
238
239 %description selinux
240 SELinux policy module supporting icinga2
241 %endif
242
243
244 %if 0%{?fedora}
245 %package studio
246 Summary:      Studio for Icinga 2
247 Group:        Applications/System
248 Requires:     %{name}-libs = %{version}-%{release}
249 Requires:     wxGTK3
250
251 %description studio
252 Provides a GUI for the Icinga 2 API.
253 %endif
254
255
256 %package -n vim-icinga2
257 Summary:      Vim syntax highlighting for icinga2
258 Group:        Applications/System
259 %if "%{_vendor}" == "suse"
260 Requires:     vim-data
261 %else
262 Requires:     vim-filesystem
263 %endif
264
265 %description -n vim-icinga2
266 Vim syntax highlighting for icinga2
267
268
269 %package -n nano-icinga2
270 Summary:      Nano syntax highlighting for icinga2
271 Group:        Applications/System
272 Requires:     nano
273
274 %description -n nano-icinga2
275 Nano syntax highlighting for icinga2
276
277 %prep
278 %setup -q -n %{name}-%{version}
279
280 %build
281 CMAKE_OPTS="-DCMAKE_INSTALL_PREFIX=/usr \
282          -DCMAKE_INSTALL_SYSCONFDIR=/etc \
283          -DCMAKE_INSTALL_LOCALSTATEDIR=/var \
284          -DCMAKE_BUILD_TYPE=RelWithDebInfo \
285          -DCMAKE_VERBOSE_MAKEFILE=ON \
286          -DBoost_NO_BOOST_CMAKE=ON \
287          -DICINGA2_RUNDIR=%{_rundir} \
288          -DICINGA2_USER=%{icinga_user} \
289          -DICINGA2_GROUP=%{icinga_group} \
290          -DICINGA2_COMMAND_GROUP=%{icingacmd_group}"
291 %if 0%{?fedora}
292 CMAKE_OPTS="$CMAKE_OPTS -DICINGA2_WITH_STUDIO=true"
293 %endif
294 %if "%{_vendor}" == "redhat"
295 %if 0%{?el5} || 0%{?rhel} == 5 || "%{?dist}" == ".el5" || 0%{?el6} || 0%{?rhel} == 6 || "%{?dist}" == ".el6"
296 # Boost_VERSION 1.41.0 vs 101400 - disable build tests
297 # details in https://dev.icinga.org/issues/5033
298 CMAKE_OPTS="$CMAKE_OPTS -DBOOST_LIBRARYDIR=/usr/lib/boost153 \
299  -DBOOST_INCLUDEDIR=/usr/include/boost153 \
300  -DBoost_ADDITIONAL_VERSIONS='1.53;1.53.0' \
301  -DBoost_NO_SYSTEM_PATHS=TRUE \
302  -DBUILD_TESTING=FALSE \
303  -DBoost_NO_BOOST_CMAKE=TRUE"
304 %endif
305 %if 0%{?el6} || 0%{?rhel} == 6 || "%{?dist}" == ".el6"
306 CMAKE_OPTS="$CMAKE_OPTS -DBUILD_TESTING=FALSE"
307 %endif
308 %endif
309
310 %if "%{_vendor}" != "suse"
311 CMAKE_OPTS="$CMAKE_OPTS -DICINGA2_PLUGINDIR=%{_libdir}/nagios/plugins"
312 %else
313 %if 0%{?suse_version} < 1310
314 CMAKE_OPTS="$CMAKE_OPTS -DBOOST_LIBRARYDIR=/usr/lib/boost153 \
315  -DBOOST_INCLUDEDIR=/usr/include/boost153 \
316  -DBoost_ADDITIONAL_VERSIONS='1.53;1.53.0' \
317  -DBoost_NO_SYSTEM_PATHS=TRUE \
318  -DBUILD_TESTING=FALSE \
319  -DBoost_NO_BOOST_CMAKE=TRUE"
320 %endif
321 CMAKE_OPTS="$CMAKE_OPTS -DICINGA2_PLUGINDIR=%{_prefix}/lib/nagios/plugins"
322 %endif
323
324 %if 0%{?use_systemd}
325 CMAKE_OPTS="$CMAKE_OPTS -DUSE_SYSTEMD=ON"
326 %endif
327
328 cmake $CMAKE_OPTS -DCMAKE_C_FLAGS:STRING="%{optflags} %{?march_flag}" -DCMAKE_CXX_FLAGS:STRING="%{optflags} %{?march_flag}" .
329
330 make %{?_smp_mflags}
331
332 %if "%{_vendor}" == "redhat" && !(0%{?el5} || 0%{?rhel} == 5 || "%{?dist}" == ".el5" || 0%{?el6} || 0%{?rhel} == 6 || "%{?dist}" == ".el6")
333 cd tools/selinux
334 for selinuxvariant in %{selinux_variants}
335 do
336   make NAME=${selinuxvariant} -f /usr/share/selinux/devel/Makefile
337   mv %{modulename}.pp %{modulename}.pp.${selinuxvariant}
338   make NAME=${selinuxvariant} -f /usr/share/selinux/devel/Makefile clean
339 done
340 cd -
341 %endif
342
343 %install
344 make install \
345         DESTDIR="%{buildroot}"
346
347 # install classicui config
348 install -D -m 0644 etc/icinga/icinga-classic.htpasswd %{buildroot}%{icingaclassicconfdir}/passwd
349 install -D -m 0644 etc/icinga/cgi.cfg %{buildroot}%{icingaclassicconfdir}/cgi.cfg
350 install -D -m 0644 etc/icinga/icinga-classic-apache.conf %{buildroot}%{apacheconfdir}/icinga.conf
351
352 # remove features-enabled symlinks
353 rm -f %{buildroot}/%{_sysconfdir}/%{name}/features-enabled/*.conf
354
355 # enable suse rc links
356 %if "%{_vendor}" == "suse"
357 %if 0%{?use_systemd}
358   ln -sf /usr/sbin/service %{buildroot}%{_sbindir}/rc%{name}
359 %else
360   ln -sf ../../%{_initrddir}/%{name} "%{buildroot}%{_sbindir}/rc%{name}"
361 %endif
362 mkdir -p "%{buildroot}%{_localstatedir}/adm/fillup-templates/"
363 mv "%{buildroot}%{_sysconfdir}/sysconfig/%{name}" "%{buildroot}%{_localstatedir}/adm/fillup-templates/sysconfig.%{name}"
364 %endif
365
366 %if "%{_vendor}" == "redhat" && !(0%{?el5} || 0%{?rhel} == 5 || "%{?dist}" == ".el5" || 0%{?el6} || 0%{?rhel} == 6 || "%{?dist}" == ".el6")
367 cd tools/selinux
368 for selinuxvariant in %{selinux_variants}
369 do
370   install -d %{buildroot}%{_datadir}/selinux/${selinuxvariant}
371   install -p -m 644 %{modulename}.pp.${selinuxvariant} \
372     %{buildroot}%{_datadir}/selinux/${selinuxvariant}/%{modulename}.pp
373 done
374 cd -
375
376 /usr/sbin/hardlink -cv %{buildroot}%{_datadir}/selinux
377 %endif
378
379 %if 0%{?fedora}
380 mkdir -p "%{buildroot}%{_datadir}/icinga2-studio"
381 install -p -m 644 icinga-studio/icinga.ico %{buildroot}%{_datadir}/icinga2-studio
382
383 mkdir -p "%{buildroot}%{_datadir}/applications"
384 echo "[Desktop Entry]
385 Name=Icinga 2 Studio
386 Comment=API viewer for Icinga 2
387 TryExec=icinga-studio
388 Exec=icinga-studio
389 Icon=/usr/share/icinga2-studio/icinga.ico
390 StartupNotify=true
391 Terminal=false
392 Type=Application
393 Categories=GTK;Utility;
394 Keywords=Monitoring;" > %{buildroot}%{_datadir}/applications/icinga2-studio.desktop
395 %endif
396
397 %if 0%{?fedora} || 0%{?rhel} == 7
398 mkdir -p %{buildroot}%{_prefix}/lib/firewalld/services
399 install -p -m 644 tools/firewalld/%{name}.xml %{buildroot}%{_prefix}/lib/firewalld/services
400 %endif
401
402 %if "%{_vendor}" == "suse"
403 %if 0%{?suse_version} >= 1310
404 install -D -m 0644 tools/syntax/vim/syntax/%{name}.vim %{buildroot}%{_datadir}/vim/vim74/syntax/%{name}.vim
405 install -D -m 0644 tools/syntax/vim/ftdetect/%{name}.vim %{buildroot}%{_datadir}/vim/vim74/ftdetect/%{name}.vim
406 %else
407 install -D -m 0644 tools/syntax/vim/syntax/%{name}.vim %{buildroot}%{_datadir}/vim/vim72/syntax/%{name}.vim
408 install -D -m 0644 tools/syntax/vim/ftdetect/%{name}.vim %{buildroot}%{_datadir}/vim/vim72/ftdetect/%{name}.vim
409 %endif
410 %else
411 install -D -m 0644 tools/syntax/vim/syntax/%{name}.vim %{buildroot}%{_datadir}/vim/vimfiles/syntax/%{name}.vim
412 install -D -m 0644 tools/syntax/vim/ftdetect/%{name}.vim %{buildroot}%{_datadir}/vim/vimfiles/ftdetect/%{name}.vim
413 %endif
414
415 install -D -m 0644 tools/syntax/nano/%{name}.nanorc %{buildroot}%{_datadir}/nano/%{name}.nanorc
416
417 %clean
418 [ "%{buildroot}" != "/" ] && [ -d "%{buildroot}" ] && rm -rf %{buildroot}
419
420 %pre common
421 getent group %{icinga_group} >/dev/null || %{_sbindir}/groupadd -r %{icinga_group}
422 getent group %{icingacmd_group} >/dev/null || %{_sbindir}/groupadd -r %{icingacmd_group}
423 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}
424
425 %if "%{_vendor}" == "suse"
426 %if 0%{?use_systemd}
427   %service_add_pre %{name}.service
428 %endif
429 %endif
430
431 %if "%{_vendor}" == "suse"
432 %verifyscript bin
433 %verify_permissions -e %{_rundir}/%{name}/cmd
434 %endif
435
436 %post bin
437
438 # suse
439 %if "%{_vendor}" == "suse"
440
441 %if 0%{?suse_version} >= 1310
442 %set_permissions %{_rundir}/%{name}/cmd
443 %endif
444
445 %endif #suse/rhel
446
447 %if 0%{?fedora}
448 %firewalld_reload
449 %endif
450 %if 0%{?rhel} == 7
451 test -f /usr/bin/firewall-cmd && firewall-cmd --reload --quiet || :
452 %endif
453
454
455 %post common
456 # suse
457 %if "%{_vendor}" == "suse"
458 %if 0%{?use_systemd}
459 %fillup_only  %{name}
460 %service_add_post %{name}.service
461 %else
462 %fillup_and_insserv %{name}
463 %endif
464
465 # initial installation, enable default features
466 for feature in checker notification mainlog; do
467         ln -sf ../features-available/${feature}.conf %{_sysconfdir}/%{name}/features-enabled/${feature}.conf
468 done
469
470 exit 0
471
472 %else
473 # rhel
474
475 %if 0%{?use_systemd}
476 %systemd_post %{name}.service
477 %else
478 /sbin/chkconfig --add %{name}
479 %endif
480
481 if [ ${1:-0} -eq 1 ]
482 then
483         # initial installation, enable default features
484         for feature in checker notification mainlog; do
485                 ln -sf ../features-available/${feature}.conf %{_sysconfdir}/%{name}/features-enabled/${feature}.conf
486         done
487 fi
488
489 exit 0
490
491 %endif
492 # suse/rhel
493
494 %postun common
495 # suse
496 %if "%{_vendor}" == "suse"
497 %if 0%{?using_systemd}
498   %service_del_postun %{name}.service
499 %else
500   %restart_on_update %{name}
501   %insserv_cleanup
502 %endif
503
504 %else
505 # rhel
506
507 %if 0%{?use_systemd}
508 %systemd_postun_with_restart %{name}.service
509 %else
510 if [ "$1" -ge  "1" ]; then
511         /sbin/service %{name} condrestart >/dev/null 2>&1 || :
512 fi
513 %endif
514
515 %endif
516 # suse / rhel
517
518 if [ "$1" = "0" ]; then
519         # deinstallation of the package - remove enabled features
520         rm -rf %{_sysconfdir}/%{name}/features-enabled
521 fi
522
523 exit 0
524
525 %preun common
526 # suse
527 %if "%{_vendor}" == "suse"
528
529 %if 0%{?use_systemd}
530   %service_del_preun %{name}.service
531 %else
532   %stop_on_removal %{name}
533 %endif
534
535 exit 0
536
537 %else
538 # rhel
539
540 %if 0%{?use_systemd}
541 %systemd_preun %{name}.service
542 %else
543 if [ "$1" = "0" ]; then
544         /sbin/service %{name} stop > /dev/null 2>&1 || :
545         /sbin/chkconfig --del %{name} || :
546 fi
547 %endif
548
549 exit 0
550
551 %endif
552 # suse / rhel
553
554 %post ido-mysql
555 if [ ${1:-0} -eq 1 ]
556 then
557         # initial installation, enable ido-mysql feature
558         ln -sf ../features-available/ido-mysql.conf %{_sysconfdir}/%{name}/features-enabled/ido-mysql.conf
559 fi
560
561 exit 0
562
563 %postun ido-mysql
564 if [ "$1" = "0" ]; then
565         # deinstallation of the package - remove feature
566         rm -f %{_sysconfdir}/%{name}/features-enabled/ido-mysql.conf
567 fi
568
569 exit 0
570
571 %post ido-pgsql
572 if [ ${1:-0} -eq 1 ]
573 then
574         # initial installation, enable ido-pgsql feature
575         ln -sf ../features-available/ido-pgsql.conf %{_sysconfdir}/%{name}/features-enabled/ido-pgsql.conf
576 fi
577
578 exit 0
579
580 %postun ido-pgsql
581 if [ "$1" = "0" ]; then
582         # deinstallation of the package - remove feature
583         rm -f %{_sysconfdir}/%{name}/features-enabled/ido-pgsql.conf
584 fi
585
586 exit 0
587
588 %post classicui-config
589 if [ ${1:-0} -eq 1 ]
590 then
591         # initial installation, enable features
592         for feature in statusdata compatlog command; do
593                 ln -sf ../features-available/${feature}.conf %{_sysconfdir}/%{name}/features-enabled/${feature}.conf
594         done
595 fi
596
597 exit 0
598
599 %postun classicui-config
600 if [ "$1" = "0" ]; then
601         # deinstallation of the package - remove feature
602         for feature in statusdata compatlog command; do
603                 rm -f %{_sysconfdir}/%{name}/features-enabled/${feature}.conf
604         done
605 fi
606
607 exit 0
608
609 %if "%{_vendor}" == "redhat" && !(0%{?el5} || 0%{?rhel} == 5 || "%{?dist}" == ".el5" || 0%{?el6} || 0%{?rhel} == 6 || "%{?dist}" == ".el6")
610 %post selinux
611 for selinuxvariant in %{selinux_variants}
612 do
613   /usr/sbin/semodule -s ${selinuxvariant} -i \
614     %{_datadir}/selinux/${selinuxvariant}/%{modulename}.pp &> /dev/null || :
615 done
616 /sbin/fixfiles -R icinga2-bin restore &> /dev/null || :
617 /sbin/fixfiles -R icinga2-common restore &> /dev/null || :
618 /sbin/semanage port -a -t icinga2_port_t -p tcp 5665 &> /dev/null || :
619
620 %postun selinux
621 if [ $1 -eq 0 ] ; then
622   /sbin/semanage port -d -t icinga2_port_t -p tcp 5665 &> /dev/null || :
623   for selinuxvariant in %{selinux_variants}
624   do
625      /usr/sbin/semodule -s ${selinuxvariant} -r %{modulename} &> /dev/null || :
626   done
627   /sbin/fixfiles -R icinga2-bin restore &> /dev/null || :
628   /sbin/fixfiles -R icinga2-common restore &> /dev/null || :
629 fi
630 %endif
631
632
633 %files
634 %defattr(-,root,root,-)
635 %doc COPYING
636
637 %files bin
638 %defattr(-,root,root,-)
639 %doc COPYING COPYING.Exceptions README.md NEWS AUTHORS ChangeLog
640 %{_sbindir}/%{name}
641 %dir %{_libdir}/%{name}/sbin
642 %{_libdir}/%{name}/sbin/%{name}
643 %{_datadir}/%{name}
644 %exclude %{_datadir}/%{name}/include
645 %{_mandir}/man8/%{name}.8.gz
646
647 %attr(0750,%{icinga_user},%{icingacmd_group}) %{_localstatedir}/cache/%{name}
648 %attr(0750,%{icinga_user},%{icingacmd_group}) %dir %{_localstatedir}/log/%{name}
649 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/log/%{name}/crash
650 %attr(0750,%{icinga_user},%{icingacmd_group}) %dir %{_localstatedir}/log/%{name}/compat
651 %attr(0750,%{icinga_user},%{icingacmd_group}) %dir %{_localstatedir}/log/%{name}/compat/archives
652 %attr(0750,%{icinga_user},%{icinga_group}) %{_localstatedir}/lib/%{name}
653
654 %attr(0750,%{icinga_user},%{icingacmd_group}) %ghost %{_rundir}/%{name}
655 %attr(2750,%{icinga_user},%{icingacmd_group}) %ghost %{_rundir}/%{name}/cmd
656
657 %if 0%{?fedora} || 0%{?rhel} == 7
658 %{_prefix}/lib/firewalld/services/%{name}.xml
659 %endif
660
661 %files libs
662 %defattr(-,root,root,-)
663 %doc COPYING COPYING.Exceptions README.md NEWS AUTHORS ChangeLog
664 %exclude %{_libdir}/%{name}/libdb_ido_mysql*
665 %exclude %{_libdir}/%{name}/libdb_ido_pgsql*
666 %dir %{_libdir}/%{name}
667 %{_libdir}/%{name}/*.so*
668
669 %files common
670 %defattr(-,root,root,-)
671 %doc COPYING COPYING.Exceptions README.md NEWS AUTHORS ChangeLog tools/syntax
672 %attr(0750,%{icinga_user},%{icingacmd_group}) %dir %{_localstatedir}/log/%{name}
673 %config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
674 %{_sysconfdir}/bash_completion.d/%{name}
675 %if 0%{?use_systemd}
676 %attr(644,root,root) %{_unitdir}/%{name}.service
677 %else
678 %attr(755,root,root) %{_sysconfdir}/init.d/%{name}
679 %endif
680 %if "%{_vendor}" == "suse"
681 %{_sbindir}/rc%{name}
682 %{_localstatedir}/adm/fillup-templates/sysconfig.%{name}
683 %else
684 %config(noreplace) %{_sysconfdir}/sysconfig/%{name}
685 %endif
686 %attr(0750,root,%{icinga_group}) %dir %{_sysconfdir}/%{name}
687 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/conf.d
688 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/features-available
689 %exclude %{_sysconfdir}/%{name}/features-available/ido-*.conf
690 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/features-enabled
691 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/repository.d
692 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/scripts
693 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/repository.d
694 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/zones.d
695 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/%{name}.conf
696 %config(noreplace) %attr(0640,root,%{icinga_group}) %{_sysconfdir}/%{name}/init.conf
697 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/constants.conf
698 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/zones.conf
699 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/conf.d/*.conf
700 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/features-available/*.conf
701 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/repository.d/*
702 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/zones.d/*
703 %config(noreplace) %{_sysconfdir}/%{name}/scripts/*
704 %dir %{_libexecdir}/%{name}
705 %{_libexecdir}/%{name}/prepare-dirs
706 %{_libexecdir}/%{name}/safe-reload
707 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/spool/%{name}
708 %attr(0770,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/spool/%{name}/perfdata
709 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/spool/%{name}/tmp
710 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_datadir}/%{name}/include
711 %{_datadir}/%{name}/include
712
713 %files doc
714 %defattr(-,root,root,-)
715 %{_datadir}/doc/%{name}
716 %docdir %{_datadir}/doc/%{name}
717
718 %files ido-mysql
719 %defattr(-,root,root,-)
720 %doc COPYING COPYING.Exceptions README.md NEWS AUTHORS ChangeLog
721 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/features-available/ido-mysql.conf
722 %{_libdir}/%{name}/libdb_ido_mysql*
723 %{_datadir}/icinga2-ido-mysql
724
725 %files ido-pgsql
726 %defattr(-,root,root,-)
727 %doc COPYING COPYING.Exceptions README.md NEWS AUTHORS ChangeLog
728 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/features-available/ido-pgsql.conf
729 %{_libdir}/%{name}/libdb_ido_pgsql*
730 %{_datadir}/icinga2-ido-pgsql
731
732 %files classicui-config
733 %defattr(-,root,root,-)
734 %attr(0751,%{icinga_user},%{icinga_group}) %dir %{icingaclassicconfdir}
735 %config(noreplace) %{icingaclassicconfdir}/cgi.cfg
736 %config(noreplace) %{apacheconfdir}/icinga.conf
737 %config(noreplace) %attr(0640,root,%{apachegroup}) %{icingaclassicconfdir}/passwd
738
739 %if "%{_vendor}" == "redhat" && !(0%{?el5} || 0%{?rhel} == 5 || "%{?dist}" == ".el5" || 0%{?el6} || 0%{?rhel} == 6 || "%{?dist}" == ".el6")
740 %files selinux
741 %defattr(-,root,root,0755)
742 %doc tools/selinux/*
743 %{_datadir}/selinux/*/%{modulename}.pp
744 %endif
745
746 %if 0%{?fedora}
747 %files studio
748 %defattr(-,root,root,-)
749 %{_bindir}/icinga-studio
750 %{_datadir}/icinga2-studio
751 %{_datadir}/applications/icinga2-studio.desktop
752 %endif
753
754 %files -n vim-icinga2
755 %defattr(-,root,root,-)
756 %if "%{_vendor}" == "suse"
757 %if 0%{?suse_version} >= 1310
758 %{_datadir}/vim/vim74/syntax/%{name}.vim
759 %{_datadir}/vim/vim74/ftdetect/%{name}.vim
760 %else
761 %{_datadir}/vim/vim72/syntax/%{name}.vim
762 %{_datadir}/vim/vim72/ftdetect/%{name}.vim
763 %endif
764 %else
765 %{_datadir}/vim/vimfiles/syntax/%{name}.vim
766 %{_datadir}/vim/vimfiles/ftdetect/%{name}.vim
767 %endif
768
769 %files -n nano-icinga2
770 %defattr(-,root,root,-)
771 %{_datadir}/nano/%{name}.nanorc
772
773 %changelog