mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
spec: replace scriptlets with new systemd macros
https://bugzilla.redhat.com/850186 I added %with_systemd_macros so it should now work in F17 with old scriptlets and in F18+/RHEL7+ with systemd macros (see https://fedoraproject.org/wiki/Packaging:ScriptletSnippets#Systemd) I missed libvirt-guests.service because there is no systemctl call for it. So I only added systemd macros calls.
This commit is contained in:
parent
b61eadf3c6
commit
ec02d49dfd
@ -319,6 +319,13 @@
|
|||||||
%define with_rhel5 0
|
%define with_rhel5 0
|
||||||
%endif
|
%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
|
Summary: Library providing a simple virtualization API
|
||||||
Name: libvirt
|
Name: libvirt
|
||||||
Version: @VERSION@
|
Version: @VERSION@
|
||||||
@ -1465,10 +1472,14 @@ done
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
%if %{with_systemd}
|
%if %{with_systemd}
|
||||||
|
%if %{with_systemd_macros}
|
||||||
|
%systemd_post libvirtd.service
|
||||||
|
%else
|
||||||
if [ $1 -eq 1 ] ; then
|
if [ $1 -eq 1 ] ; then
|
||||||
# Initial installation
|
# Initial installation
|
||||||
/bin/systemctl enable libvirtd.service >/dev/null 2>&1 || :
|
/bin/systemctl enable libvirtd.service >/dev/null 2>&1 || :
|
||||||
fi
|
fi
|
||||||
|
%endif
|
||||||
%else
|
%else
|
||||||
%if %{with_cgconfig}
|
%if %{with_cgconfig}
|
||||||
# Starting with Fedora 16/RHEL-7, systemd automounts all cgroups,
|
# Starting with Fedora 16/RHEL-7, systemd automounts all cgroups,
|
||||||
@ -1488,11 +1499,15 @@ fi
|
|||||||
|
|
||||||
%preun daemon
|
%preun daemon
|
||||||
%if %{with_systemd}
|
%if %{with_systemd}
|
||||||
|
%if %{with_systemd_macros}
|
||||||
|
%systemd_preun libvirtd.service
|
||||||
|
%else
|
||||||
if [ $1 -eq 0 ] ; then
|
if [ $1 -eq 0 ] ; then
|
||||||
# Package removal, not upgrade
|
# Package removal, not upgrade
|
||||||
/bin/systemctl --no-reload disable libvirtd.service > /dev/null 2>&1 || :
|
/bin/systemctl --no-reload disable libvirtd.service > /dev/null 2>&1 || :
|
||||||
/bin/systemctl stop libvirtd.service > /dev/null 2>&1 || :
|
/bin/systemctl stop libvirtd.service > /dev/null 2>&1 || :
|
||||||
fi
|
fi
|
||||||
|
%endif
|
||||||
%else
|
%else
|
||||||
if [ $1 = 0 ]; then
|
if [ $1 = 0 ]; then
|
||||||
/sbin/service libvirtd stop 1>/dev/null 2>&1
|
/sbin/service libvirtd stop 1>/dev/null 2>&1
|
||||||
@ -1502,12 +1517,16 @@ fi
|
|||||||
|
|
||||||
%postun daemon
|
%postun daemon
|
||||||
%if %{with_systemd}
|
%if %{with_systemd}
|
||||||
|
%if %{with_systemd_macros}
|
||||||
|
%systemd_postun_with_restart libvirtd.service
|
||||||
|
%else
|
||||||
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
|
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
|
||||||
if [ $1 -ge 1 ] ; then
|
if [ $1 -ge 1 ] ; then
|
||||||
# Package upgrade, not uninstall
|
# Package upgrade, not uninstall
|
||||||
/bin/systemctl try-restart libvirtd.service >/dev/null 2>&1 || :
|
/bin/systemctl try-restart libvirtd.service >/dev/null 2>&1 || :
|
||||||
fi
|
fi
|
||||||
%endif
|
%endif
|
||||||
|
%endif
|
||||||
|
|
||||||
%if %{with_network}
|
%if %{with_network}
|
||||||
%post daemon-config-network
|
%post daemon-config-network
|
||||||
@ -1538,6 +1557,9 @@ fi
|
|||||||
%preun client
|
%preun client
|
||||||
|
|
||||||
%if %{with_systemd}
|
%if %{with_systemd}
|
||||||
|
%if %{with_systemd_macros}
|
||||||
|
%systemd_preun libvirt-guests.service
|
||||||
|
%endif
|
||||||
%else
|
%else
|
||||||
if [ $1 = 0 ]; then
|
if [ $1 = 0 ]; then
|
||||||
/sbin/chkconfig --del libvirt-guests
|
/sbin/chkconfig --del libvirt-guests
|
||||||
@ -1549,6 +1571,9 @@ fi
|
|||||||
|
|
||||||
/sbin/ldconfig
|
/sbin/ldconfig
|
||||||
%if %{with_systemd}
|
%if %{with_systemd}
|
||||||
|
%if %{with_systemd_macros}
|
||||||
|
%systemd_post libvirt-guests.service
|
||||||
|
%endif
|
||||||
%else
|
%else
|
||||||
/sbin/chkconfig --add libvirt-guests
|
/sbin/chkconfig --add libvirt-guests
|
||||||
%endif
|
%endif
|
||||||
@ -1556,6 +1581,9 @@ fi
|
|||||||
%postun client -p /sbin/ldconfig
|
%postun client -p /sbin/ldconfig
|
||||||
|
|
||||||
%if %{with_systemd}
|
%if %{with_systemd}
|
||||||
|
%if %{with_systemd_macros}
|
||||||
|
%systemd_postun_with_restart libvirt-guests.service
|
||||||
|
%endif
|
||||||
%triggerun client -- libvirt < 0.9.4
|
%triggerun client -- libvirt < 0.9.4
|
||||||
%{_bindir}/systemd-sysv-convert --save libvirt-guests >/dev/null 2>&1 ||:
|
%{_bindir}/systemd-sysv-convert --save libvirt-guests >/dev/null 2>&1 ||:
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user