]> granicus.if.org Git - icinga2/blob - icinga2.spec
icinga2.spec: Add selecting g++ compiler on older SUSE releases
[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 # initial installation, enable default features
473 for feature in checker notification mainlog; do
474         ln -sf ../features-available/${feature}.conf %{_sysconfdir}/%{name}/features-enabled/${feature}.conf
475 done
476
477 exit 0
478
479 %else
480 # rhel
481
482 %if 0%{?use_systemd}
483 %systemd_post %{name}.service
484 %else
485 /sbin/chkconfig --add %{name}
486 %endif
487
488 if [ ${1:-0} -eq 1 ]
489 then
490         # initial installation, enable default features
491         for feature in checker notification mainlog; do
492                 ln -sf ../features-available/${feature}.conf %{_sysconfdir}/%{name}/features-enabled/${feature}.conf
493         done
494 fi
495
496 exit 0
497
498 %endif
499 # suse/rhel
500
501 %postun common
502 # suse
503 %if "%{_vendor}" == "suse"
504 %if 0%{?using_systemd}
505   %service_del_postun %{name}.service
506 %else
507   %restart_on_update %{name}
508   %insserv_cleanup
509 %endif
510
511 %else
512 # rhel
513
514 %if 0%{?use_systemd}
515 %systemd_postun_with_restart %{name}.service
516 %else
517 if [ "$1" -ge  "1" ]; then
518         /sbin/service %{name} condrestart >/dev/null 2>&1 || :
519 fi
520 %endif
521
522 %endif
523 # suse / rhel
524
525 if [ "$1" = "0" ]; then
526         # deinstallation of the package - remove enabled features
527         rm -rf %{_sysconfdir}/%{name}/features-enabled
528 fi
529
530 exit 0
531
532 %preun common
533 # suse
534 %if "%{_vendor}" == "suse"
535
536 %if 0%{?use_systemd}
537   %service_del_preun %{name}.service
538 %else
539   %stop_on_removal %{name}
540 %endif
541
542 exit 0
543
544 %else
545 # rhel
546
547 %if 0%{?use_systemd}
548 %systemd_preun %{name}.service
549 %else
550 if [ "$1" = "0" ]; then
551         /sbin/service %{name} stop > /dev/null 2>&1 || :
552         /sbin/chkconfig --del %{name} || :
553 fi
554 %endif
555
556 exit 0
557
558 %endif
559 # suse / rhel
560
561 %post ido-mysql
562 if [ ${1:-0} -eq 1 ]
563 then
564         # initial installation, enable ido-mysql feature
565         ln -sf ../features-available/ido-mysql.conf %{_sysconfdir}/%{name}/features-enabled/ido-mysql.conf
566 fi
567
568 exit 0
569
570 %postun ido-mysql
571 if [ "$1" = "0" ]; then
572         # deinstallation of the package - remove feature
573         rm -f %{_sysconfdir}/%{name}/features-enabled/ido-mysql.conf
574 fi
575
576 exit 0
577
578 %post ido-pgsql
579 if [ ${1:-0} -eq 1 ]
580 then
581         # initial installation, enable ido-pgsql feature
582         ln -sf ../features-available/ido-pgsql.conf %{_sysconfdir}/%{name}/features-enabled/ido-pgsql.conf
583 fi
584
585 exit 0
586
587 %postun ido-pgsql
588 if [ "$1" = "0" ]; then
589         # deinstallation of the package - remove feature
590         rm -f %{_sysconfdir}/%{name}/features-enabled/ido-pgsql.conf
591 fi
592
593 exit 0
594
595 %post classicui-config
596 if [ ${1:-0} -eq 1 ]
597 then
598         # initial installation, enable features
599         for feature in statusdata compatlog command; do
600                 ln -sf ../features-available/${feature}.conf %{_sysconfdir}/%{name}/features-enabled/${feature}.conf
601         done
602 fi
603
604 exit 0
605
606 %postun classicui-config
607 if [ "$1" = "0" ]; then
608         # deinstallation of the package - remove feature
609         for feature in statusdata compatlog command; do
610                 rm -f %{_sysconfdir}/%{name}/features-enabled/${feature}.conf
611         done
612 fi
613
614 exit 0
615
616 %if "%{_vendor}" == "redhat" && !(0%{?el5} || 0%{?rhel} == 5 || "%{?dist}" == ".el5" || 0%{?el6} || 0%{?rhel} == 6 || "%{?dist}" == ".el6")
617 %post selinux
618 for selinuxvariant in %{selinux_variants}
619 do
620   /usr/sbin/semodule -s ${selinuxvariant} -i \
621     %{_datadir}/selinux/${selinuxvariant}/%{modulename}.pp &> /dev/null || :
622 done
623 /sbin/fixfiles -R icinga2-bin restore &> /dev/null || :
624 /sbin/fixfiles -R icinga2-common restore &> /dev/null || :
625 /sbin/semanage port -a -t icinga2_port_t -p tcp 5665 &> /dev/null || :
626
627 %postun selinux
628 if [ $1 -eq 0 ] ; then
629   /sbin/semanage port -d -t icinga2_port_t -p tcp 5665 &> /dev/null || :
630   for selinuxvariant in %{selinux_variants}
631   do
632      /usr/sbin/semodule -s ${selinuxvariant} -r %{modulename} &> /dev/null || :
633   done
634   /sbin/fixfiles -R icinga2-bin restore &> /dev/null || :
635   /sbin/fixfiles -R icinga2-common restore &> /dev/null || :
636 fi
637 %endif
638
639
640 %files
641 %defattr(-,root,root,-)
642 %doc COPYING
643
644 %files bin
645 %defattr(-,root,root,-)
646 %doc COPYING COPYING.Exceptions README.md NEWS AUTHORS ChangeLog
647 %{_sbindir}/%{name}
648 %dir %{_libdir}/%{name}/sbin
649 %{_libdir}/%{name}/sbin/%{name}
650 %{_datadir}/%{name}
651 %exclude %{_datadir}/%{name}/include
652 %{_mandir}/man8/%{name}.8.gz
653
654 %attr(0750,%{icinga_user},%{icingacmd_group}) %{_localstatedir}/cache/%{name}
655 %attr(0750,%{icinga_user},%{icingacmd_group}) %dir %{_localstatedir}/log/%{name}
656 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/log/%{name}/crash
657 %attr(0750,%{icinga_user},%{icingacmd_group}) %dir %{_localstatedir}/log/%{name}/compat
658 %attr(0750,%{icinga_user},%{icingacmd_group}) %dir %{_localstatedir}/log/%{name}/compat/archives
659 %attr(0750,%{icinga_user},%{icinga_group}) %{_localstatedir}/lib/%{name}
660
661 %attr(0750,%{icinga_user},%{icingacmd_group}) %ghost %{_rundir}/%{name}
662 %attr(2750,%{icinga_user},%{icingacmd_group}) %ghost %{_rundir}/%{name}/cmd
663
664 %files libs
665 %defattr(-,root,root,-)
666 %doc COPYING COPYING.Exceptions README.md NEWS AUTHORS ChangeLog
667 %exclude %{_libdir}/%{name}/libdb_ido_mysql*
668 %exclude %{_libdir}/%{name}/libdb_ido_pgsql*
669 %dir %{_libdir}/%{name}
670 %{_libdir}/%{name}/*.so*
671
672 %files common
673 %defattr(-,root,root,-)
674 %doc COPYING COPYING.Exceptions README.md NEWS AUTHORS ChangeLog tools/syntax
675 %attr(0750,%{icinga_user},%{icingacmd_group}) %dir %{_localstatedir}/log/%{name}
676 %config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
677 %{_sysconfdir}/bash_completion.d/%{name}
678 %if 0%{?use_systemd}
679 %attr(644,root,root) %{_unitdir}/%{name}.service
680 %else
681 %attr(755,root,root) %{_sysconfdir}/init.d/%{name}
682 %endif
683 %if "%{_vendor}" == "suse"
684 %{_sbindir}/rc%{name}
685 %{_localstatedir}/adm/fillup-templates/sysconfig.%{name}
686 %else
687 %config(noreplace) %{_sysconfdir}/sysconfig/%{name}
688 %endif
689 %attr(0750,root,%{icinga_group}) %dir %{_sysconfdir}/%{name}
690 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/conf.d
691 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/features-available
692 %exclude %{_sysconfdir}/%{name}/features-available/ido-*.conf
693 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/features-enabled
694 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/repository.d
695 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/scripts
696 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/repository.d
697 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/zones.d
698 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/%{name}.conf
699 %config(noreplace) %attr(0640,root,%{icinga_group}) %{_sysconfdir}/%{name}/init.conf
700 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/constants.conf
701 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/zones.conf
702 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/conf.d/*.conf
703 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/features-available/*.conf
704 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/repository.d/*
705 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/zones.d/*
706 %config(noreplace) %{_sysconfdir}/%{name}/scripts/*
707 %dir %{_libexecdir}/%{name}
708 %{_libexecdir}/%{name}/prepare-dirs
709 %{_libexecdir}/%{name}/safe-reload
710 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/spool/%{name}
711 %attr(0770,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/spool/%{name}/perfdata
712 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_localstatedir}/spool/%{name}/tmp
713 %attr(0750,%{icinga_user},%{icinga_group}) %dir %{_datadir}/%{name}/include
714 %{_datadir}/%{name}/include
715
716 %files doc
717 %defattr(-,root,root,-)
718 %{_datadir}/doc/%{name}
719 %docdir %{_datadir}/doc/%{name}
720
721 %files ido-mysql
722 %defattr(-,root,root,-)
723 %doc COPYING COPYING.Exceptions README.md NEWS AUTHORS ChangeLog
724 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/features-available/ido-mysql.conf
725 %{_libdir}/%{name}/libdb_ido_mysql*
726 %{_datadir}/icinga2-ido-mysql
727
728 %files ido-pgsql
729 %defattr(-,root,root,-)
730 %doc COPYING COPYING.Exceptions README.md NEWS AUTHORS ChangeLog
731 %config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/features-available/ido-pgsql.conf
732 %{_libdir}/%{name}/libdb_ido_pgsql*
733 %{_datadir}/icinga2-ido-pgsql
734
735 %files classicui-config
736 %defattr(-,root,root,-)
737 %attr(0751,%{icinga_user},%{icinga_group}) %dir %{icingaclassicconfdir}
738 %config(noreplace) %{icingaclassicconfdir}/cgi.cfg
739 %config(noreplace) %{apacheconfdir}/icinga.conf
740 %config(noreplace) %attr(0640,root,%{apachegroup}) %{icingaclassicconfdir}/passwd
741
742 %if "%{_vendor}" == "redhat" && !(0%{?el5} || 0%{?rhel} == 5 || "%{?dist}" == ".el5" || 0%{?el6} || 0%{?rhel} == 6 || "%{?dist}" == ".el6")
743 %files selinux
744 %defattr(-,root,root,0755)
745 %doc tools/selinux/*
746 %{_datadir}/selinux/*/%{modulename}.pp
747 %endif
748
749 %if 0%{?fedora}
750 %files studio
751 %defattr(-,root,root,-)
752 %{_bindir}/icinga-studio
753 %{_datadir}/icinga2-studio
754 %{_datadir}/applications/icinga2-studio.desktop
755 %endif
756
757 %files -n vim-icinga2
758 %defattr(-,root,root,-)
759 %if "%{_vendor}" == "suse"
760 %if 0%{?suse_version} >= 1310
761 %{_datadir}/vim/vim74/syntax/%{name}.vim
762 %{_datadir}/vim/vim74/ftdetect/%{name}.vim
763 %else
764 %{_datadir}/vim/vim72/syntax/%{name}.vim
765 %{_datadir}/vim/vim72/ftdetect/%{name}.vim
766 %endif
767 %else
768 %{_datadir}/vim/vimfiles/syntax/%{name}.vim
769 %{_datadir}/vim/vimfiles/ftdetect/%{name}.vim
770 %endif
771
772 %files -n nano-icinga2
773 %defattr(-,root,root,-)
774 %{_datadir}/nano/%{name}.nanorc
775
776 %changelog