]> granicus.if.org Git - icinga2/blob - icinga2.spec
Merge pull request #5283 from Icinga/fix/remove-logstash
[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 %if "%{_vendor}" == "suse" && 0%{?suse_version} < 1210
343 # from package gcc48-c++
344 export CC=gcc-4.8
345 export CXX=g++-4.8
346 %endif
347
348 %{?scl_enable} cmake $CMAKE_OPTS -DCMAKE_C_FLAGS:STRING="%{optflags} %{?march_flag}" -DCMAKE_CXX_FLAGS:STRING="%{optflags} %{?march_flag}" .
349
350 make %{?_smp_mflags}
351
352 %if "%{_vendor}" == "redhat" && !(0%{?el5} || 0%{?rhel} == 5 || "%{?dist}" == ".el5" || 0%{?el6} || 0%{?rhel} == 6 || "%{?dist}" == ".el6")
353 cd tools/selinux
354 for selinuxvariant in %{selinux_variants}
355 do
356   make NAME=${selinuxvariant} -f /usr/share/selinux/devel/Makefile
357   mv %{modulename}.pp %{modulename}.pp.${selinuxvariant}
358   make NAME=${selinuxvariant} -f /usr/share/selinux/devel/Makefile clean
359 done
360 cd -
361 %endif
362
363 %install
364 make install \
365         DESTDIR="%{buildroot}"
366
367 # install classicui config
368 install -D -m 0644 etc/icinga/icinga-classic.htpasswd %{buildroot}%{icingaclassicconfdir}/passwd
369 install -D -m 0644 etc/icinga/cgi.cfg %{buildroot}%{icingaclassicconfdir}/cgi.cfg
370 install -D -m 0644 etc/icinga/icinga-classic-apache.conf %{buildroot}%{apacheconfdir}/icinga.conf
371
372 # remove features-enabled symlinks
373 rm -f %{buildroot}/%{_sysconfdir}/%{name}/features-enabled/*.conf
374
375 # enable suse rc links
376 %if "%{_vendor}" == "suse"
377 %if 0%{?use_systemd}
378   ln -sf /usr/sbin/service %{buildroot}%{_sbindir}/rc%{name}
379 %else
380   ln -sf ../../%{_initrddir}/%{name} "%{buildroot}%{_sbindir}/rc%{name}"
381 %endif
382 mkdir -p "%{buildroot}%{_localstatedir}/adm/fillup-templates/"
383 mv "%{buildroot}%{_sysconfdir}/sysconfig/%{name}" "%{buildroot}%{_localstatedir}/adm/fillup-templates/sysconfig.%{name}"
384 %endif
385
386 %if "%{_vendor}" == "redhat" && !(0%{?el5} || 0%{?rhel} == 5 || "%{?dist}" == ".el5" || 0%{?el6} || 0%{?rhel} == 6 || "%{?dist}" == ".el6")
387 cd tools/selinux
388 for selinuxvariant in %{selinux_variants}
389 do
390   install -d %{buildroot}%{_datadir}/selinux/${selinuxvariant}
391   install -p -m 644 %{modulename}.pp.${selinuxvariant} \
392     %{buildroot}%{_datadir}/selinux/${selinuxvariant}/%{modulename}.pp
393 done
394 cd -
395
396 /usr/sbin/hardlink -cv %{buildroot}%{_datadir}/selinux
397 %endif
398
399 %if 0%{?fedora}
400 mkdir -p "%{buildroot}%{_datadir}/icinga2-studio"
401 install -p -m 644 icinga-studio/icinga.ico %{buildroot}%{_datadir}/icinga2-studio
402
403 mkdir -p "%{buildroot}%{_datadir}/applications"
404 echo "[Desktop Entry]
405 Name=Icinga 2 Studio
406 Comment=API viewer for Icinga 2
407 TryExec=icinga-studio
408 Exec=icinga-studio
409 Icon=/usr/share/icinga2-studio/icinga.ico
410 StartupNotify=true
411 Terminal=false
412 Type=Application
413 Categories=GTK;Utility;
414 Keywords=Monitoring;" > %{buildroot}%{_datadir}/applications/icinga2-studio.desktop
415 %endif
416
417 %if "%{_vendor}" == "suse"
418 %if 0%{?suse_version} >= 1310
419 install -D -m 0644 tools/syntax/vim/syntax/%{name}.vim %{buildroot}%{_datadir}/vim/vim74/syntax/%{name}.vim
420 install -D -m 0644 tools/syntax/vim/ftdetect/%{name}.vim %{buildroot}%{_datadir}/vim/vim74/ftdetect/%{name}.vim
421 %else
422 install -D -m 0644 tools/syntax/vim/syntax/%{name}.vim %{buildroot}%{_datadir}/vim/vim72/syntax/%{name}.vim
423 install -D -m 0644 tools/syntax/vim/ftdetect/%{name}.vim %{buildroot}%{_datadir}/vim/vim72/ftdetect/%{name}.vim
424 %endif
425 %else
426 install -D -m 0644 tools/syntax/vim/syntax/%{name}.vim %{buildroot}%{_datadir}/vim/vimfiles/syntax/%{name}.vim
427 install -D -m 0644 tools/syntax/vim/ftdetect/%{name}.vim %{buildroot}%{_datadir}/vim/vimfiles/ftdetect/%{name}.vim
428 %endif
429
430 install -D -m 0644 tools/syntax/nano/%{name}.nanorc %{buildroot}%{_datadir}/nano/%{name}.nanorc
431
432 %clean
433 [ "%{buildroot}" != "/" ] && [ -d "%{buildroot}" ] && rm -rf %{buildroot}
434
435 %pre common
436 getent group %{icinga_group} >/dev/null || %{_sbindir}/groupadd -r %{icinga_group}
437 getent group %{icingacmd_group} >/dev/null || %{_sbindir}/groupadd -r %{icingacmd_group}
438 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}
439
440 %if "%{_vendor}" == "suse"
441 %if 0%{?use_systemd}
442   %service_add_pre %{name}.service
443 %endif
444 %endif
445
446 %if "%{_vendor}" == "suse"
447 %verifyscript bin
448 %verify_permissions -e %{_rundir}/%{name}/cmd
449 %endif
450
451 %post bin
452
453 # suse
454 %if "%{_vendor}" == "suse"
455
456 %if 0%{?suse_version} >= 1310
457 %set_permissions %{_rundir}/%{name}/cmd
458 %endif
459
460 %endif #suse/rhel
461
462 %post common
463 # suse
464 %if "%{_vendor}" == "suse"
465 %if 0%{?use_systemd}
466 %fillup_only  %{name}
467 %service_add_post %{name}.service
468 %else
469 %fillup_and_insserv %{name}
470 %endif
471
472 if [ ${1:-0} -eq 1 ]
473 then
474         # initial installation, enable default features
475         for feature in checker notification mainlog; do
476                 ln -sf ../features-available/${feature}.conf %{_sysconfdir}/%{name}/features-enabled/${feature}.conf
477         done
478 fi
479
480 exit 0
481
482 %else
483 # rhel
484
485 %if 0%{?use_systemd}
486 %systemd_post %{name}.service
487 %else
488 /sbin/chkconfig --add %{name}
489 %endif
490
491 if [ ${1:-0} -eq 1 ]
492 then
493         # initial installation, enable default features
494         for feature in checker notification mainlog; do
495                 ln -sf ../features-available/${feature}.conf %{_sysconfdir}/%{name}/features-enabled/${feature}.conf
496         done
497 fi
498
499 exit 0
500
501 %endif
502 # suse/rhel
503
504 %postun common
505 # suse
506 %if "%{_vendor}" == "suse"
507 %if 0%{?using_systemd}
508   %service_del_postun %{name}.service
509 %else
510   %restart_on_update %{name}
511   %insserv_cleanup
512 %endif
513
514 %else
515 # rhel
516
517 %if 0%{?use_systemd}
518 %systemd_postun_with_restart %{name}.service
519 %else
520 if [ "$1" -ge  "1" ]; then
521         /sbin/service %{name} condrestart >/dev/null 2>&1 || :
522 fi
523 %endif
524
525 %endif
526 # suse / rhel
527
528 if [ "$1" = "0" ]; then
529         # deinstallation of the package - remove enabled features
530         rm -rf %{_sysconfdir}/%{name}/features-enabled
531 fi
532
533 exit 0
534
535 %preun common
536 # suse
537 %if "%{_vendor}" == "suse"
538
539 %if 0%{?use_systemd}
540   %service_del_preun %{name}.service
541 %else
542   %stop_on_removal %{name}
543 %endif
544
545 exit 0
546
547 %else
548 # rhel
549
550 %if 0%{?use_systemd}
551 %systemd_preun %{name}.service
552 %else
553 if [ "$1" = "0" ]; then
554         /sbin/service %{name} stop > /dev/null 2>&1 || :
555         /sbin/chkconfig --del %{name} || :
556 fi
557 %endif
558
559 exit 0
560
561 %endif
562 # suse / rhel
563
564 %post ido-mysql
565 if [ ${1:-0} -eq 1 ]
566 then
567         # initial installation, enable ido-mysql feature
568         ln -sf ../features-available/ido-mysql.conf %{_sysconfdir}/%{name}/features-enabled/ido-mysql.conf
569 fi
570
571 exit 0
572
573 %postun ido-mysql
574 if [ "$1" = "0" ]; then
575         # deinstallation of the package - remove feature
576         rm -f %{_sysconfdir}/%{name}/features-enabled/ido-mysql.conf
577 fi
578
579 exit 0
580
581 %post ido-pgsql
582 if [ ${1:-0} -eq 1 ]
583 then
584         # initial installation, enable ido-pgsql feature
585         ln -sf ../features-available/ido-pgsql.conf %{_sysconfdir}/%{name}/features-enabled/ido-pgsql.conf
586 fi
587
588 exit 0
589
590 %postun ido-pgsql
591 if [ "$1" = "0" ]; then
592         # deinstallation of the package - remove feature
593         rm -f %{_sysconfdir}/%{name}/features-enabled/ido-pgsql.conf
594 fi
595
596 exit 0
597
598 %post classicui-config
599 if [ ${1:-0} -eq 1 ]
600 then
601         # initial installation, enable features
602         for feature in statusdata compatlog command; do
603                 ln -sf ../features-available/${feature}.conf %{_sysconfdir}/%{name}/features-enabled/${feature}.conf
604         done
605 fi
606
607 exit 0
608
609 %postun classicui-config
610 if [ "$1" = "0" ]; then
611         # deinstallation of the package - remove feature
612         for feature in statusdata compatlog command; do
613                 rm -f %{_sysconfdir}/%{name}/features-enabled/${feature}.conf
614         done
615 fi
616
617 exit 0
618
619 %if "%{_vendor}" == "redhat" && !(0%{?el5} || 0%{?rhel} == 5 || "%{?dist}" == ".el5" || 0%{?el6} || 0%{?rhel} == 6 || "%{?dist}" == ".el6")
620 %post selinux
621 for selinuxvariant in %{selinux_variants}
622 do
623   /usr/sbin/semodule -s ${selinuxvariant} -i \
624     %{_datadir}/selinux/${selinuxvariant}/%{modulename}.pp &> /dev/null || :
625 done
626 /sbin/fixfiles -R icinga2-bin restore &> /dev/null || :
627 /sbin/fixfiles -R icinga2-common restore &> /dev/null || :
628 /sbin/semanage port -a -t icinga2_port_t -p tcp 5665 &> /dev/null || :
629
630 %postun selinux
631 if [ $1 -eq 0 ] ; then
632   /sbin/semanage port -d -t icinga2_port_t -p tcp 5665 &> /dev/null || :
633   for selinuxvariant in %{selinux_variants}
634   do
635      /usr/sbin/semodule -s ${selinuxvariant} -r %{modulename} &> /dev/null || :
636   done
637   /sbin/fixfiles -R icinga2-bin restore &> /dev/null || :
638   /sbin/fixfiles -R icinga2-common restore &> /dev/null || :
639 fi
640 %endif
641
642
643 %files
644 %defattr(-,root,root,-)
645 %doc COPYING
646
647 %files bin
648 %defattr(-,root,root,-)
649 %doc COPYING COPYING.Exceptions README.md NEWS AUTHORS ChangeLog
650 %{_sbindir}/%{name}
651 %dir %{_libdir}/%{name}/sbin
652 %{_libdir}/%{name}/sbin/%{name}
653 %{_datadir}/%{name}
654 %exclude %{_datadir}/%{name}/include
655 %{_mandir}/man8/%{name}.8.gz
656
657 %attr(0750,%{icinga_user},%{icingacmd_group}) %{_localstatedir}/cache/%{name}
658 %attr(0750,%{icinga_user},%{icingacmd_group}) %dir %{_localstatedir}/log/%{name}
659 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/log/%{name}/crash
660 %attr(0750,%{icinga_user},%{icingacmd_group}) %dir %{_localstatedir}/log/%{name}/compat
661 %attr(0750,%{icinga_user},%{icingacmd_group}) %dir %{_localstatedir}/log/%{name}/compat/archives
662 %attr(0750,%{icinga_user},%{icinga_group}) %{_localstatedir}/lib/%{name}
663
664 %attr(0750,%{icinga_user},%{icingacmd_group}) %ghost %{_rundir}/%{name}
665 %attr(2750,%{icinga_user},%{icingacmd_group}) %ghost %{_rundir}/%{name}/cmd
666
667 %files libs
668 %defattr(-,root,root,-)
669 %doc COPYING COPYING.Exceptions README.md NEWS AUTHORS ChangeLog
670 %exclude %{_libdir}/%{name}/libdb_ido_mysql*
671 %exclude %{_libdir}/%{name}/libdb_ido_pgsql*
672 %dir %{_libdir}/%{name}
673 %{_libdir}/%{name}/*.so*
674
675 %files common
676 %defattr(-,root,root,-)
677 %doc COPYING COPYING.Exceptions README.md NEWS AUTHORS ChangeLog tools/syntax
678 %attr(0750,%{icinga_user},%{icingacmd_group}) %dir %{_localstatedir}/log/%{name}
679 %config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
680 %{_sysconfdir}/bash_completion.d/%{name}
681 %if 0%{?use_systemd}
682 %attr(644,root,root) %{_unitdir}/%{name}.service
683 %else
684 %attr(755,root,root) %{_sysconfdir}/init.d/%{name}
685 %endif
686 %if "%{_vendor}" == "suse"
687 %{_sbindir}/rc%{name}
688 %{_localstatedir}/adm/fillup-templates/sysconfig.%{name}
689 %else
690 %config(noreplace) %{_sysconfdir}/sysconfig/%{name}
691 %endif
692 %attr(0750,root,%{icinga_group}) %dir %{_sysconfdir}/%{name}
693 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/conf.d
694 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/features-available
695 %exclude %{_sysconfdir}/%{name}/features-available/ido-*.conf
696 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/features-enabled
697 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/repository.d
698 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/scripts
699 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/repository.d
700 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/zones.d
701 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/%{name}.conf
702 %config(noreplace) %attr(0640,root,%{icinga_group}) %{_sysconfdir}/%{name}/init.conf
703 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/constants.conf
704 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/zones.conf
705 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/conf.d/*.conf
706 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/features-available/*.conf
707 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/repository.d/*
708 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/zones.d/*
709 %config(noreplace) %{_sysconfdir}/%{name}/scripts/*
710 %dir %{_libexecdir}/%{name}
711 %{_libexecdir}/%{name}/prepare-dirs
712 %{_libexecdir}/%{name}/safe-reload
713 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/spool/%{name}
714 %attr(0770,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/spool/%{name}/perfdata
715 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/spool/%{name}/tmp
716 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_datadir}/%{name}/include
717 %{_datadir}/%{name}/include
718
719 %files doc
720 %defattr(-,root,root,-)
721 %{_datadir}/doc/%{name}
722 %docdir %{_datadir}/doc/%{name}
723
724 %files ido-mysql
725 %defattr(-,root,root,-)
726 %doc COPYING COPYING.Exceptions README.md NEWS AUTHORS ChangeLog
727 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/features-available/ido-mysql.conf
728 %{_libdir}/%{name}/libdb_ido_mysql*
729 %{_datadir}/icinga2-ido-mysql
730
731 %files ido-pgsql
732 %defattr(-,root,root,-)
733 %doc COPYING COPYING.Exceptions README.md NEWS AUTHORS ChangeLog
734 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/features-available/ido-pgsql.conf
735 %{_libdir}/%{name}/libdb_ido_pgsql*
736 %{_datadir}/icinga2-ido-pgsql
737
738 %files classicui-config
739 %defattr(-,root,root,-)
740 %attr(0751,%{icinga_user},%{icinga_group}) %dir %{icingaclassicconfdir}
741 %config(noreplace) %{icingaclassicconfdir}/cgi.cfg
742 %config(noreplace) %{apacheconfdir}/icinga.conf
743 %config(noreplace) %attr(0640,root,%{apachegroup}) %{icingaclassicconfdir}/passwd
744
745 %if "%{_vendor}" == "redhat" && !(0%{?el5} || 0%{?rhel} == 5 || "%{?dist}" == ".el5" || 0%{?el6} || 0%{?rhel} == 6 || "%{?dist}" == ".el6")
746 %files selinux
747 %defattr(-,root,root,0755)
748 %doc tools/selinux/*
749 %{_datadir}/selinux/*/%{modulename}.pp
750 %endif
751
752 %if 0%{?fedora}
753 %files studio
754 %defattr(-,root,root,-)
755 %{_bindir}/icinga-studio
756 %{_datadir}/icinga2-studio
757 %{_datadir}/applications/icinga2-studio.desktop
758 %endif
759
760 %files -n vim-icinga2
761 %defattr(-,root,root,-)
762 %if "%{_vendor}" == "suse"
763 %if 0%{?suse_version} >= 1310
764 %{_datadir}/vim/vim74/syntax/%{name}.vim
765 %{_datadir}/vim/vim74/ftdetect/%{name}.vim
766 %else
767 %{_datadir}/vim/vim72/syntax/%{name}.vim
768 %{_datadir}/vim/vim72/ftdetect/%{name}.vim
769 %endif
770 %else
771 %{_datadir}/vim/vimfiles/syntax/%{name}.vim
772 %{_datadir}/vim/vimfiles/ftdetect/%{name}.vim
773 %endif
774
775 %files -n nano-icinga2
776 %defattr(-,root,root,-)
777 %{_datadir}/nano/%{name}.nanorc
778
779 %changelog