From 2fb4dce3cd813ce03e5db9b8f71004329a3b4af6b7cd307b56990591d98fcdbf Mon Sep 17 00:00:00 2001 From: James Fehlig Date: Fri, 14 Feb 2014 22:19:58 +0000 Subject: [PATCH] - Remove libvirtd, virtlockd, and libvirt-guests init scripts when using systemd bnc#863540 OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=351 --- libvirt.changes | 7 +++++++ libvirt.spec | 40 +++++++++++++++++++++++++++------------- 2 files changed, 34 insertions(+), 13 deletions(-) diff --git a/libvirt.changes b/libvirt.changes index acc5493..da6dc66 100644 --- a/libvirt.changes +++ b/libvirt.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Fri Feb 14 14:37:42 MST 2014 - jfehlig@suse.com + +- Remove libvirtd, virtlockd, and libvirt-guests init scripts when + using systemd + bnc#863540 + ------------------------------------------------------------------- Wed Feb 12 15:58:18 UTC 2014 - cbosdonnat@suse.com diff --git a/libvirt.spec b/libvirt.spec index cb11caf..225d903 100644 --- a/libvirt.spec +++ b/libvirt.spec @@ -519,6 +519,7 @@ of recent versions of Linux. Requires a hypervisor specific sub-RPM for specific drivers. %if %{with_network} + %package daemon-config-network Summary: Default configuration files for the libvirtd daemon Group: Development/Libraries/C and C++ @@ -1258,22 +1259,32 @@ mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/adm/fillup-templates %if %{with_libvirtd} # Currently using our own libvirtd init script rm -f $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/libvirtd +%if ! %{with_systemd} install %SOURCE1 $RPM_BUILD_ROOT%{_sysconfdir}/init.d/libvirtd ln -s /etc/init.d/libvirtd $RPM_BUILD_ROOT%{_sbindir}/rclibvirtd +%endif mv $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/libvirtd $RPM_BUILD_ROOT%{_localstatedir}/adm/fillup-templates/sysconfig.libvirtd rm -f $RPM_BUILD_ROOT/usr/lib/sysctl.d/libvirtd.conf # For other services, use the in-tree scripts +%if %{with_systemd} +rm -f $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/virtlockd +%else mv $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/virtlockd $RPM_BUILD_ROOT%{_sysconfdir}/init.d/virtlockd ln -s /etc/init.d/virtlockd $RPM_BUILD_ROOT%{_sbindir}/rcvirtlockd +%endif mv $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/virtlockd $RPM_BUILD_ROOT%{_localstatedir}/adm/fillup-templates/sysconfig.virtlockd #install firewall definitions format is described here: #/usr/share/SuSEfirewall2/services/TEMPLATE mkdir -p $RPM_BUILD_ROOT/%{_fwdefdir} install -m 644 %{S:2} $RPM_BUILD_ROOT/%{_fwdefdir}/libvirtd-relocation-server %endif +%if %{with_systemd} +rm -f $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/libvirt-guests +%else mv $RPM_BUILD_ROOT%{_sysconfdir}/rc.d/init.d/libvirt-guests $RPM_BUILD_ROOT%{_sysconfdir}/init.d/libvirt-guests mkdir -p $RPM_BUILD_ROOT%{_sbindir} ln -s %{_sysconfdir}/init.d/libvirt-guests $RPM_BUILD_ROOT%{_sbindir}/rclibvirt-guests +%endif mv $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/libvirt-guests $RPM_BUILD_ROOT%{_localstatedir}/adm/fillup-templates/sysconfig.libvirt-guests %fdupes -s $RPM_BUILD_ROOT @@ -1317,32 +1328,31 @@ fi %service_add_post libvirtd.service %service_add_post virtlockd.service virtlockd.socket %endif -%if 0%{?sles_version} -%{fillup_and_insserv -y -n libvirtd libvirtd} -%else # ! sles %{fillup_only -n libvirtd} -%endif %{fillup_only -n virtlockd} %preun daemon %if %{with_systemd} %service_del_preun libvirtd.service %service_del_preun virtlockd.service virtlockd.socket -%endif +%else %stop_on_removal libvirtd %stop_on_removal virtlockd +%endif %postun daemon /sbin/ldconfig %if %{with_systemd} %service_del_postun libvirtd.service %service_del_postun virtlockd.service virtlockd.socket -%endif +%else %restart_on_update libvirtd %restart_on_update virtlockd +%endif %insserv_cleanup %if %{with_network} + %post daemon-config-network # Install the default network if one doesn't exist if test $1 -eq 1 && test ! -f %{_sysconfdir}/libvirt/qemu/networks/default.xml ; then @@ -1364,8 +1374,9 @@ fi %preun client %if %{with_systemd} %service_del_preun libvirt-guests.service -%endif +%else %stop_on_removal libvirt-guests +%endif if [ $1 = 0 ]; then rm -f /var/lib/libvirt/libvirt-guests fi @@ -1390,15 +1401,16 @@ fi %dir %{_libdir}/%{name} %dir %attr(0700, root, root) %{_sysconfdir}/libvirt/ %{_localstatedir}/adm/fillup-templates/sysconfig.libvirtd -%config /etc/init.d/libvirtd -%{_sbindir}/rclibvirtd %{_localstatedir}/adm/fillup-templates/sysconfig.virtlockd -%config /etc/init.d/virtlockd -%{_sbindir}/rcvirtlockd %if %{with_systemd} %{_unitdir}/libvirtd.service %{_unitdir}/virtlockd.service %{_unitdir}/virtlockd.socket +%else +%config /etc/init.d/libvirtd +%{_sbindir}/rclibvirtd +%config /etc/init.d/virtlockd +%{_sbindir}/rcvirtlockd %endif %config(noreplace) %{_sysconfdir}/libvirt/libvirtd.conf %config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd @@ -1492,6 +1504,7 @@ fi %endif # ! %{with_driver_modules} %if %{with_network} + %files daemon-config-network %defattr(-, root, root) %doc %{_docdir}/%{name}/libvirt-daemon-config-network.README @@ -1685,10 +1698,11 @@ fi %{_libdir}/lib*.so.* %attr(0755, root, root) %{_libdir}/%{name}/libvirt-guests.sh %{_localstatedir}/adm/fillup-templates/sysconfig.libvirt-guests -%config /etc/init.d/libvirt-guests -%{_sbindir}/rclibvirt-guests %if %{with_systemd} %{_unitdir}/libvirt-guests.service +%else +%config /etc/init.d/libvirt-guests +%{_sbindir}/rclibvirt-guests %endif %dir %{_datadir}/libvirt/