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