%define apacheconfdir %{_sysconfdir}/httpd/conf.d
%define apacheuser apache
%define apachegroup apache
+%if 0%{?el5}%{?el6}
+%define use_systemd 0
+%else
+# fedora and el>=7
+%define use_systemd 1
+%endif
%endif
+
%if "%{_vendor}" == "suse"
# opensuse 13
%if 0%{?suse_version} >= 1310
%define apacheconfdir %{_sysconfdir}/apache2/conf.d
%define apacheuser wwwrun
%define apachegroup www
+%define use_systemd 0
%endif
%define icinga_user icinga
Requires: boost-regex >= 1.41
%endif
%endif
-
-%if 0%{?fedora}%{?el7}
-BuildRequires: systemd
-Requires: systemd
-%endif
#redhat
# suse
%endif
# suse
+%if 0%{?use_systemd}
+BuildRequires: systemd
+Requires: systemd
+%endif
+
Requires: %{name}-common = %{version}
%description bin
-DBoost_NO_SYSTEM_PATHS=TRUE \
-DBUILD_TESTING=FALSE \
-DBoost_NO_BOOST_CMAKE=TRUE"
-
-%if 0%{?fedora}
-CMAKE_OPTS="$CMAKE_OPTS -DUSE_SYSTEMD=ON"
%endif
-
%endif
+
+%if 0%{?use_systemd}
+CMAKE_OPTS="$CMAKE_OPTS -DUSE_SYSTEMD=ON"
%endif
cmake $CMAKE_OPTS .
%else
# rhel
-%if 0%{?el5}{?el6}
-/sbin/chkconfig --add %{name}
-%else
+%if 0%{?use_systemd}
%systemd_post %{name}.service
+%else
+/sbin/chkconfig --add %{name}
%endif
if [ ${1:-0} -eq 1 ]
%else
# rhel
-%if 0%{?el5}{?el6}
+%if 0%{?use_systemd}
+%systemd_postun_with_restart %{name}.service
+%else
if [ "$1" -ge "1" ]; then
/sbin/service %{name} condrestart >/dev/null 2>&1 || :
fi
-%else
-%systemd_postun_with_restart %{name}.service
%endif
if [ "$1" = "0" ]; then
%else
# rhel
-%if 0%{?el5}{?el6}
+%if 0%{?use_systemd}
+%systemd_preun %{name}.service
+%else
if [ "$1" = "0" ]; then
/sbin/service %{name} stop > /dev/null 2>&1 || :
/sbin/chkconfig --del %{name} || :
fi
-%else
-%systemd_preun %{name}.service
%endif
exit 0
%files bin
%defattr(-,root,root,-)
%doc COPYING COPYING.Exceptions README NEWS AUTHORS ChangeLog
-%if 0%{?el5}%{?el6}%{?opensuse_version}
-%attr(755,-,-) %{_sysconfdir}/init.d/%{name}
-%else
+%if 0%{?use_systemd}
%attr(755,-,0) %{_unitdir}/%{name}.service
+%else
+%attr(755,-,-) %{_sysconfdir}/init.d/%{name}
%endif
%attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}
%attr(0750,%{icinga_user},%{icinga_group}) %dir %{_sysconfdir}/%{name}/conf.d
%config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/%{name}.conf
%config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/constants.conf
%config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/zones.conf
+%config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/sysdefines.conf
%config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/conf.d/*.conf
%config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/conf.d/hosts/*.conf
%config(noreplace) %attr(0640,%{icinga_user},%{icinga_group}) %{_sysconfdir}/%{name}/conf.d/hosts/localhost/*.conf
%{_bindir}/%{name}-sign-key
%{_sbindir}/%{name}-enable-feature
%{_sbindir}/%{name}-disable-feature
+%{_sbindir}/%{name}-prepare-dirs
%exclude %{_libdir}/%{name}/libdb_ido_mysql*
%exclude %{_libdir}/%{name}/libdb_ido_pgsql*
%{_libdir}/%{name}