%define with_rhel5 0
%endif
+%if 0%{?fedora} >= 18 || 0%{?rhel} >= 7
+%define with_systemd_macros 1
+%else
+%define with_systemd_macros 0
+%endif
+
+
Summary: Library providing a simple virtualization API
Name: libvirt
Version: @VERSION@
%endif
%if %{with_systemd}
+%if %{with_systemd_macros}
+%systemd_post libvirtd.service
+%else
if [ $1 -eq 1 ] ; then
# Initial installation
/bin/systemctl enable libvirtd.service >/dev/null 2>&1 || :
fi
+%endif
%else
%if %{with_cgconfig}
# Starting with Fedora 16/RHEL-7, systemd automounts all cgroups,
%preun daemon
%if %{with_systemd}
+%if %{with_systemd_macros}
+%systemd_preun libvirtd.service
+%else
if [ $1 -eq 0 ] ; then
# Package removal, not upgrade
/bin/systemctl --no-reload disable libvirtd.service > /dev/null 2>&1 || :
/bin/systemctl stop libvirtd.service > /dev/null 2>&1 || :
fi
+%endif
%else
if [ $1 = 0 ]; then
/sbin/service libvirtd stop 1>/dev/null 2>&1
%postun daemon
%if %{with_systemd}
+%if %{with_systemd_macros}
+%systemd_postun_with_restart libvirtd.service
+%else
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
if [ $1 -ge 1 ] ; then
# Package upgrade, not uninstall
/bin/systemctl try-restart libvirtd.service >/dev/null 2>&1 || :
fi
%endif
+%endif
%if %{with_network}
%post daemon-config-network
%preun client
%if %{with_systemd}
+%if %{with_systemd_macros}
+%systemd_preun libvirt-guests.service
+%endif
%else
if [ $1 = 0 ]; then
/sbin/chkconfig --del libvirt-guests
/sbin/ldconfig
%if %{with_systemd}
+%if %{with_systemd_macros}
+%systemd_post libvirt-guests.service
+%endif
%else
/sbin/chkconfig --add libvirt-guests
%endif
%postun client -p /sbin/ldconfig
%if %{with_systemd}
+%if %{with_systemd_macros}
+%systemd_postun_with_restart libvirt-guests.service
+%endif
%triggerun client -- libvirt < 0.9.4
%{_bindir}/systemd-sysv-convert --save libvirt-guests >/dev/null 2>&1 ||: