rpm: remove conditionals for systemd
All our supported RHEL and Fedora versions include systemd, so we can assume it is always present in the spec. Reviewed-by: Andrea Bolognani <abologna@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
0f5c19b4b6
commit
f508a65a21
160
libvirt.spec.in
160
libvirt.spec.in
@ -74,14 +74,12 @@
|
|||||||
# A few optional bits off by default, we enable later
|
# A few optional bits off by default, we enable later
|
||||||
%define with_fuse 0%{!?_without_fuse:0}
|
%define with_fuse 0%{!?_without_fuse:0}
|
||||||
%define with_sanlock 0%{!?_without_sanlock:0}
|
%define with_sanlock 0%{!?_without_sanlock:0}
|
||||||
%define with_systemd 0%{!?_without_systemd:0}
|
|
||||||
%define with_numad 0%{!?_without_numad:0}
|
%define with_numad 0%{!?_without_numad:0}
|
||||||
%define with_firewalld 0%{!?_without_firewalld:0}
|
%define with_firewalld 0%{!?_without_firewalld:0}
|
||||||
%define with_libssh2 0%{!?_without_libssh2:0}
|
%define with_libssh2 0%{!?_without_libssh2:0}
|
||||||
%define with_wireshark 0%{!?_without_wireshark:0}
|
%define with_wireshark 0%{!?_without_wireshark:0}
|
||||||
%define with_libssh 0%{!?_without_libssh:0}
|
%define with_libssh 0%{!?_without_libssh:0}
|
||||||
%define with_bash_completion 0%{!?_without_bash_completion:0}
|
%define with_bash_completion 0%{!?_without_bash_completion:0}
|
||||||
%define with_pm_utils 1
|
|
||||||
|
|
||||||
# Finally set the OS / architecture specific special cases
|
# Finally set the OS / architecture specific special cases
|
||||||
|
|
||||||
@ -139,8 +137,6 @@
|
|||||||
%endif
|
%endif
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%define with_systemd 1
|
|
||||||
%define with_pm_utils 0
|
|
||||||
%define with_firewalld 1
|
%define with_firewalld 1
|
||||||
|
|
||||||
# fuse is used to provide virtualized /proc for LXC
|
# fuse is used to provide virtualized /proc for LXC
|
||||||
@ -202,9 +198,6 @@
|
|||||||
%define qemu_group qemu
|
%define qemu_group qemu
|
||||||
|
|
||||||
|
|
||||||
%define with_systemd_macros 1
|
|
||||||
|
|
||||||
|
|
||||||
# RHEL releases provide stable tool chains and so it is safe to turn
|
# RHEL releases provide stable tool chains and so it is safe to turn
|
||||||
# compiler warning into errors without being worried about frequent
|
# compiler warning into errors without being worried about frequent
|
||||||
# changes in reported warnings
|
# changes in reported warnings
|
||||||
@ -278,9 +271,7 @@ BuildRequires: perl-interpreter
|
|||||||
BuildRequires: perl
|
BuildRequires: perl
|
||||||
%endif
|
%endif
|
||||||
BuildRequires: %{python}
|
BuildRequires: %{python}
|
||||||
%if %{with_systemd}
|
|
||||||
BuildRequires: systemd-units
|
BuildRequires: systemd-units
|
||||||
%endif
|
|
||||||
%if %{with_libxl}
|
%if %{with_libxl}
|
||||||
BuildRequires: xen-devel
|
BuildRequires: xen-devel
|
||||||
%endif
|
%endif
|
||||||
@ -443,12 +434,10 @@ Requires: polkit >= 0.112
|
|||||||
Requires: dmidecode
|
Requires: dmidecode
|
||||||
%endif
|
%endif
|
||||||
# For service management
|
# For service management
|
||||||
%if %{with_systemd}
|
|
||||||
Requires(post): systemd-units
|
Requires(post): systemd-units
|
||||||
Requires(post): systemd-sysv
|
Requires(post): systemd-sysv
|
||||||
Requires(preun): systemd-units
|
Requires(preun): systemd-units
|
||||||
Requires(postun): systemd-units
|
Requires(postun): systemd-units
|
||||||
%endif
|
|
||||||
%if %{with_numad}
|
%if %{with_numad}
|
||||||
Requires: numad
|
Requires: numad
|
||||||
%endif
|
%endif
|
||||||
@ -909,10 +898,6 @@ Requires: ncurses
|
|||||||
Requires: gettext
|
Requires: gettext
|
||||||
# Needed by virt-pki-validate script.
|
# Needed by virt-pki-validate script.
|
||||||
Requires: gnutls-utils
|
Requires: gnutls-utils
|
||||||
%if %{with_pm_utils}
|
|
||||||
# Needed for probing the power management features of the host.
|
|
||||||
Requires: pm-utils
|
|
||||||
%endif
|
|
||||||
%if %{with_bash_completion}
|
%if %{with_bash_completion}
|
||||||
Requires: %{name}-bash-completion = %{version}-%{release}
|
Requires: %{name}-bash-completion = %{version}-%{release}
|
||||||
%endif
|
%endif
|
||||||
@ -1172,24 +1157,12 @@ exit 1
|
|||||||
%define arg_wireshark --without-wireshark-dissector
|
%define arg_wireshark --without-wireshark-dissector
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%if %{with_pm_utils}
|
|
||||||
%define arg_pm_utils --with-pm-utils
|
|
||||||
%else
|
|
||||||
%define arg_pm_utils --without-pm-utils
|
|
||||||
%endif
|
|
||||||
|
|
||||||
%define when %(date +"%%F-%%T")
|
%define when %(date +"%%F-%%T")
|
||||||
%define where %(hostname)
|
%define where %(hostname)
|
||||||
%define who %{?packager}%{!?packager:Unknown}
|
%define who %{?packager}%{!?packager:Unknown}
|
||||||
%define arg_packager --with-packager="%{who}, %{when}, %{where}"
|
%define arg_packager --with-packager="%{who}, %{when}, %{where}"
|
||||||
%define arg_packager_version --with-packager-version="%{release}"
|
%define arg_packager_version --with-packager-version="%{release}"
|
||||||
|
|
||||||
%if %{with_systemd}
|
|
||||||
%define arg_init_script --with-init-script=systemd
|
|
||||||
%else
|
|
||||||
%define arg_init_script --with-init-script=redhat
|
|
||||||
%endif
|
|
||||||
|
|
||||||
%define arg_selinux_mount --with-selinux-mount="/sys/fs/selinux"
|
%define arg_selinux_mount --with-selinux-mount="/sys/fs/selinux"
|
||||||
|
|
||||||
%if 0%{?fedora}
|
%if 0%{?fedora}
|
||||||
@ -1262,7 +1235,7 @@ rm -f po/stamp-po
|
|||||||
--with-driver-modules \
|
--with-driver-modules \
|
||||||
%{?arg_firewalld} \
|
%{?arg_firewalld} \
|
||||||
%{?arg_wireshark} \
|
%{?arg_wireshark} \
|
||||||
%{?arg_pm_utils} \
|
--without-pm-utils \
|
||||||
--with-nss-plugin \
|
--with-nss-plugin \
|
||||||
%{arg_packager} \
|
%{arg_packager} \
|
||||||
%{arg_packager_version} \
|
%{arg_packager_version} \
|
||||||
@ -1272,7 +1245,7 @@ rm -f po/stamp-po
|
|||||||
%{?arg_loader_nvram} \
|
%{?arg_loader_nvram} \
|
||||||
%{?enable_werror} \
|
%{?enable_werror} \
|
||||||
--enable-expensive-tests \
|
--enable-expensive-tests \
|
||||||
%{arg_init_script} \
|
--with-init-script=systemd \
|
||||||
%{?arg_login_shell}
|
%{?arg_login_shell}
|
||||||
make %{?_smp_mflags} V=1
|
make %{?_smp_mflags} V=1
|
||||||
gzip -9 ChangeLog
|
gzip -9 ChangeLog
|
||||||
@ -1396,83 +1369,25 @@ exit 0
|
|||||||
|
|
||||||
%post daemon
|
%post daemon
|
||||||
|
|
||||||
%if %{with_systemd}
|
%systemd_post virtlockd.socket virtlockd-admin.socket
|
||||||
%if %{with_systemd_macros}
|
%systemd_post virtlogd.socket virtlogd-admin.socket
|
||||||
%systemd_post virtlockd.socket virtlockd-admin.socket
|
%systemd_post libvirtd.service
|
||||||
%systemd_post virtlogd.socket virtlogd-admin.socket
|
|
||||||
%systemd_post libvirtd.service
|
|
||||||
%else
|
|
||||||
if [ $1 -eq 1 ] ; then
|
|
||||||
# Initial installation
|
|
||||||
/bin/systemctl enable \
|
|
||||||
virtlockd.socket \
|
|
||||||
virtlockd-admin.socket \
|
|
||||||
virtlogd.socket \
|
|
||||||
virtlogd-admin.socket \
|
|
||||||
libvirtd.service >/dev/null 2>&1 || :
|
|
||||||
fi
|
|
||||||
%endif
|
|
||||||
%else
|
|
||||||
/sbin/chkconfig --add libvirtd
|
|
||||||
/sbin/chkconfig --add virtlogd
|
|
||||||
/sbin/chkconfig --add virtlockd
|
|
||||||
%endif
|
|
||||||
|
|
||||||
# request daemon restart in posttrans
|
# request daemon restart in posttrans
|
||||||
mkdir -p %{_localstatedir}/lib/rpm-state/libvirt || :
|
mkdir -p %{_localstatedir}/lib/rpm-state/libvirt || :
|
||||||
touch %{_localstatedir}/lib/rpm-state/libvirt/restart || :
|
touch %{_localstatedir}/lib/rpm-state/libvirt/restart || :
|
||||||
|
|
||||||
%preun daemon
|
%preun daemon
|
||||||
%if %{with_systemd}
|
%systemd_preun libvirtd.service
|
||||||
%if %{with_systemd_macros}
|
%systemd_preun virtlogd.socket virtlogd-admin.socket virtlogd.service
|
||||||
%systemd_preun libvirtd.service
|
%systemd_preun virtlockd.socket virtlockd-admin.socket virtlockd.service
|
||||||
%systemd_preun virtlogd.socket virtlogd-admin.socket virtlogd.service
|
|
||||||
%systemd_preun virtlockd.socket virtlockd-admin.socket virtlockd.service
|
|
||||||
%else
|
|
||||||
if [ $1 -eq 0 ] ; then
|
|
||||||
# Package removal, not upgrade
|
|
||||||
/bin/systemctl --no-reload disable \
|
|
||||||
libvirtd.service \
|
|
||||||
virtlogd.socket \
|
|
||||||
virtlogd-admin.socket \
|
|
||||||
virtlogd.service \
|
|
||||||
virtlockd.socket \
|
|
||||||
virtlockd-admin.socket \
|
|
||||||
virtlockd.service > /dev/null 2>&1 || :
|
|
||||||
/bin/systemctl stop \
|
|
||||||
libvirtd.service \
|
|
||||||
virtlogd.socket \
|
|
||||||
virtlogd-admin.socket \
|
|
||||||
virtlogd.service \
|
|
||||||
virtlockd.socket \
|
|
||||||
virtlockd-admin.socket \
|
|
||||||
virtlockd.service > /dev/null 2>&1 || :
|
|
||||||
fi
|
|
||||||
%endif
|
|
||||||
%else
|
|
||||||
if [ $1 = 0 ]; then
|
|
||||||
/sbin/service libvirtd stop 1>/dev/null 2>&1
|
|
||||||
/sbin/chkconfig --del libvirtd
|
|
||||||
/sbin/service virtlogd stop 1>/dev/null 2>&1
|
|
||||||
/sbin/chkconfig --del virtlogd
|
|
||||||
/sbin/service virtlockd stop 1>/dev/null 2>&1
|
|
||||||
/sbin/chkconfig --del virtlockd
|
|
||||||
fi
|
|
||||||
%endif
|
|
||||||
|
|
||||||
%postun daemon
|
%postun daemon
|
||||||
%if %{with_systemd}
|
|
||||||
/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
|
||||||
/bin/systemctl reload-or-try-restart virtlockd.service >/dev/null 2>&1 || :
|
/bin/systemctl reload-or-try-restart virtlockd.service >/dev/null 2>&1 || :
|
||||||
/bin/systemctl reload-or-try-restart virtlogd.service >/dev/null 2>&1 || :
|
/bin/systemctl reload-or-try-restart virtlogd.service >/dev/null 2>&1 || :
|
||||||
fi
|
fi
|
||||||
%else
|
|
||||||
if [ $1 -ge 1 ]; then
|
|
||||||
/sbin/service virtlockd reload > /dev/null 2>&1 || :
|
|
||||||
/sbin/service virtlogd reload > /dev/null 2>&1 || :
|
|
||||||
fi
|
|
||||||
%endif
|
|
||||||
|
|
||||||
# In upgrade scenario we must explicitly enable virtlockd/virtlogd
|
# In upgrade scenario we must explicitly enable virtlockd/virtlogd
|
||||||
# sockets, if libvirtd is already enabled and start them if
|
# sockets, if libvirtd is already enabled and start them if
|
||||||
@ -1480,28 +1395,15 @@ fi
|
|||||||
# guests
|
# guests
|
||||||
%triggerpostun daemon -- libvirt-daemon < 1.3.0
|
%triggerpostun daemon -- libvirt-daemon < 1.3.0
|
||||||
if [ $1 -ge 1 ] ; then
|
if [ $1 -ge 1 ] ; then
|
||||||
%if %{with_systemd}
|
|
||||||
/bin/systemctl is-enabled libvirtd.service 1>/dev/null 2>&1 &&
|
/bin/systemctl is-enabled libvirtd.service 1>/dev/null 2>&1 &&
|
||||||
/bin/systemctl enable virtlogd.socket virtlogd-admin.socket || :
|
/bin/systemctl enable virtlogd.socket virtlogd-admin.socket || :
|
||||||
/bin/systemctl is-active libvirtd.service 1>/dev/null 2>&1 &&
|
/bin/systemctl is-active libvirtd.service 1>/dev/null 2>&1 &&
|
||||||
/bin/systemctl start virtlogd.socket virtlogd-admin.socket || :
|
/bin/systemctl start virtlogd.socket virtlogd-admin.socket || :
|
||||||
%else
|
|
||||||
/sbin/chkconfig libvirtd 1>/dev/null 2>&1 &&
|
|
||||||
/sbin/chkconfig virtlogd on || :
|
|
||||||
/sbin/service libvirtd status 1>/dev/null 2>&1 &&
|
|
||||||
/sbin/service virtlogd start || :
|
|
||||||
/sbin/service virtlockd reload > /dev/null 2>&1 || :
|
|
||||||
/sbin/service virtlogd reload > /dev/null 2>&1 || :
|
|
||||||
%endif
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
%posttrans daemon
|
%posttrans daemon
|
||||||
if [ -f %{_localstatedir}/lib/rpm-state/libvirt/restart ]; then
|
if [ -f %{_localstatedir}/lib/rpm-state/libvirt/restart ]; then
|
||||||
%if %{with_systemd}
|
|
||||||
/bin/systemctl try-restart libvirtd.service >/dev/null 2>&1 || :
|
/bin/systemctl try-restart libvirtd.service >/dev/null 2>&1 || :
|
||||||
%else
|
|
||||||
/sbin/service libvirtd condrestart > /dev/null 2>&1 || :
|
|
||||||
%endif
|
|
||||||
fi
|
fi
|
||||||
rm -rf %{_localstatedir}/lib/rpm-state/libvirt || :
|
rm -rf %{_localstatedir}/lib/rpm-state/libvirt || :
|
||||||
|
|
||||||
@ -1549,11 +1451,7 @@ fi
|
|||||||
|
|
||||||
%posttrans daemon-config-network
|
%posttrans daemon-config-network
|
||||||
if [ -f %{_localstatedir}/lib/rpm-state/libvirt/restart ]; then
|
if [ -f %{_localstatedir}/lib/rpm-state/libvirt/restart ]; then
|
||||||
%if %{with_systemd}
|
|
||||||
/bin/systemctl try-restart libvirtd.service >/dev/null 2>&1 || :
|
/bin/systemctl try-restart libvirtd.service >/dev/null 2>&1 || :
|
||||||
%else
|
|
||||||
/sbin/service libvirtd condrestart > /dev/null 2>&1 || :
|
|
||||||
%endif
|
|
||||||
fi
|
fi
|
||||||
rm -rf %{_localstatedir}/lib/rpm-state/libvirt || :
|
rm -rf %{_localstatedir}/lib/rpm-state/libvirt || :
|
||||||
|
|
||||||
@ -1565,16 +1463,11 @@ touch %{_localstatedir}/lib/rpm-state/libvirt/restart || :
|
|||||||
|
|
||||||
%posttrans daemon-config-nwfilter
|
%posttrans daemon-config-nwfilter
|
||||||
if [ -f %{_localstatedir}/lib/rpm-state/libvirt/restart ]; then
|
if [ -f %{_localstatedir}/lib/rpm-state/libvirt/restart ]; then
|
||||||
%if %{with_systemd}
|
|
||||||
/bin/systemctl try-restart libvirtd.service >/dev/null 2>&1 || :
|
/bin/systemctl try-restart libvirtd.service >/dev/null 2>&1 || :
|
||||||
%else
|
|
||||||
/sbin/service libvirtd condrestart > /dev/null 2>&1 || :
|
|
||||||
%endif
|
|
||||||
fi
|
fi
|
||||||
rm -rf %{_localstatedir}/lib/rpm-state/libvirt || :
|
rm -rf %{_localstatedir}/lib/rpm-state/libvirt || :
|
||||||
|
|
||||||
|
|
||||||
%if %{with_systemd}
|
|
||||||
%triggerun -- libvirt < 0.9.4
|
%triggerun -- libvirt < 0.9.4
|
||||||
%{_bindir}/systemd-sysv-convert --save libvirtd >/dev/null 2>&1 ||:
|
%{_bindir}/systemd-sysv-convert --save libvirtd >/dev/null 2>&1 ||:
|
||||||
|
|
||||||
@ -1584,7 +1477,6 @@ rm -rf %{_localstatedir}/lib/rpm-state/libvirt || :
|
|||||||
# Run these because the SysV package being removed won't do them
|
# Run these because the SysV package being removed won't do them
|
||||||
/sbin/chkconfig --del libvirtd >/dev/null 2>&1 || :
|
/sbin/chkconfig --del libvirtd >/dev/null 2>&1 || :
|
||||||
/bin/systemctl try-restart libvirtd.service >/dev/null 2>&1 || :
|
/bin/systemctl try-restart libvirtd.service >/dev/null 2>&1 || :
|
||||||
%endif
|
|
||||||
|
|
||||||
%if %{with_qemu}
|
%if %{with_qemu}
|
||||||
%pre daemon-driver-qemu
|
%pre daemon-driver-qemu
|
||||||
@ -1605,35 +1497,18 @@ exit 0
|
|||||||
|
|
||||||
%preun client
|
%preun client
|
||||||
|
|
||||||
%if %{with_systemd}
|
%systemd_preun libvirt-guests.service
|
||||||
%if %{with_systemd_macros}
|
|
||||||
%systemd_preun libvirt-guests.service
|
|
||||||
%endif
|
|
||||||
%else
|
|
||||||
if [ $1 = 0 ]; then
|
|
||||||
/sbin/chkconfig --del libvirt-guests
|
|
||||||
rm -f /var/lib/libvirt/libvirt-guests
|
|
||||||
fi
|
|
||||||
%endif
|
|
||||||
|
|
||||||
%post client
|
%post client
|
||||||
|
|
||||||
/sbin/ldconfig
|
/sbin/ldconfig
|
||||||
%if %{with_systemd}
|
%systemd_post libvirt-guests.service
|
||||||
%if %{with_systemd_macros}
|
|
||||||
%systemd_post libvirt-guests.service
|
|
||||||
%endif
|
|
||||||
%else
|
|
||||||
/sbin/chkconfig --add libvirt-guests
|
|
||||||
%endif
|
|
||||||
|
|
||||||
%postun client
|
%postun client
|
||||||
|
|
||||||
/sbin/ldconfig
|
/sbin/ldconfig
|
||||||
%if %{with_systemd}
|
%systemd_postun libvirt-guests.service
|
||||||
%if %{with_systemd_macros}
|
|
||||||
%systemd_postun 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 ||:
|
||||||
|
|
||||||
@ -1642,7 +1517,6 @@ fi
|
|||||||
|
|
||||||
# Run this because the SysV package being removed won't do them
|
# Run this because the SysV package being removed won't do them
|
||||||
/sbin/chkconfig --del libvirt-guests >/dev/null 2>&1 || :
|
/sbin/chkconfig --del libvirt-guests >/dev/null 2>&1 || :
|
||||||
%endif
|
|
||||||
|
|
||||||
%if %{with_sanlock}
|
%if %{with_sanlock}
|
||||||
%post lock-sanlock
|
%post lock-sanlock
|
||||||
@ -1686,7 +1560,6 @@ exit 0
|
|||||||
|
|
||||||
%dir %attr(0700, root, root) %{_sysconfdir}/libvirt/
|
%dir %attr(0700, root, root) %{_sysconfdir}/libvirt/
|
||||||
|
|
||||||
%if %{with_systemd}
|
|
||||||
%{_unitdir}/libvirtd.service
|
%{_unitdir}/libvirtd.service
|
||||||
%{_unitdir}/virt-guest-shutdown.target
|
%{_unitdir}/virt-guest-shutdown.target
|
||||||
%{_unitdir}/virtlogd.service
|
%{_unitdir}/virtlogd.service
|
||||||
@ -1695,11 +1568,6 @@ exit 0
|
|||||||
%{_unitdir}/virtlockd.service
|
%{_unitdir}/virtlockd.service
|
||||||
%{_unitdir}/virtlockd.socket
|
%{_unitdir}/virtlockd.socket
|
||||||
%{_unitdir}/virtlockd-admin.socket
|
%{_unitdir}/virtlockd-admin.socket
|
||||||
%else
|
|
||||||
%{_sysconfdir}/rc.d/init.d/libvirtd
|
|
||||||
%{_sysconfdir}/rc.d/init.d/virtlogd
|
|
||||||
%{_sysconfdir}/rc.d/init.d/virtlockd
|
|
||||||
%endif
|
|
||||||
%config(noreplace) %{_sysconfdir}/sysconfig/libvirtd
|
%config(noreplace) %{_sysconfdir}/sysconfig/libvirtd
|
||||||
%config(noreplace) %{_sysconfdir}/sysconfig/virtlogd
|
%config(noreplace) %{_sysconfdir}/sysconfig/virtlogd
|
||||||
%config(noreplace) %{_sysconfdir}/sysconfig/virtlockd
|
%config(noreplace) %{_sysconfdir}/sysconfig/virtlockd
|
||||||
@ -1951,11 +1819,7 @@ exit 0
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
|
|
||||||
%if %{with_systemd}
|
|
||||||
%{_unitdir}/libvirt-guests.service
|
%{_unitdir}/libvirt-guests.service
|
||||||
%else
|
|
||||||
%{_sysconfdir}/rc.d/init.d/libvirt-guests
|
|
||||||
%endif
|
|
||||||
%config(noreplace) %{_sysconfdir}/sysconfig/libvirt-guests
|
%config(noreplace) %{_sysconfdir}/sysconfig/libvirt-guests
|
||||||
%attr(0755, root, root) %{_libexecdir}/libvirt-guests.sh
|
%attr(0755, root, root) %{_libexecdir}/libvirt-guests.sh
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user