mirror of https://gitee.com/openkylin/libvirt.git
spec: Avoid RPM verification errors on nwfilter XMLs
/etc/libvirt/nwfilter/*.xml files are installed with no UUID, which means libvirtd will automatically alter all of them once it starts. Thus RPM verification will always fail on them. Let's use a trick similar to the default network XML and store nwfilter XMLs in /usr/share. They will be copied into /etc in %post. Additionally the /etc files are marked as %ghost so that they are uninstalled if the RPM package is removed. Note that the %post script overwrites existing files with new ones on upgrade, which is what has always been happening. https://bugzilla.redhat.com/show_bug.cgi?id=1431581 https://bugzilla.redhat.com/show_bug.cgi?id=1378774 Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
parent
bd13b26da2
commit
1d3963dba5
|
@ -1360,6 +1360,13 @@ cp $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/qemu/networks/default.xml \
|
||||||
$RPM_BUILD_ROOT%{_datadir}/libvirt/networks/default.xml
|
$RPM_BUILD_ROOT%{_datadir}/libvirt/networks/default.xml
|
||||||
rm -f $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/qemu/networks/default.xml
|
rm -f $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/qemu/networks/default.xml
|
||||||
rm -f $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/qemu/networks/autostart/default.xml
|
rm -f $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/qemu/networks/autostart/default.xml
|
||||||
|
|
||||||
|
# nwfilter files are installed in /usr/share/libvirt and copied to /etc in %post
|
||||||
|
# to avoid verification errors on changed files in /etc
|
||||||
|
install -d -m 0755 $RPM_BUILD_ROOT%{_datadir}/libvirt/nwfilter/
|
||||||
|
cp -a $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/nwfilter/*.xml \
|
||||||
|
$RPM_BUILD_ROOT%{_datadir}/libvirt/nwfilter/
|
||||||
|
|
||||||
# Strip auto-generated UUID - we need it generated per-install
|
# Strip auto-generated UUID - we need it generated per-install
|
||||||
sed -i -e "/<uuid>/d" $RPM_BUILD_ROOT%{_datadir}/libvirt/networks/default.xml
|
sed -i -e "/<uuid>/d" $RPM_BUILD_ROOT%{_datadir}/libvirt/networks/default.xml
|
||||||
%if ! %{with_qemu}
|
%if ! %{with_qemu}
|
||||||
|
@ -1586,6 +1593,17 @@ if test $1 -eq 1 && test ! -f %{_sysconfdir}/libvirt/qemu/networks/default.xml ;
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
%post daemon-config-nwfilter
|
||||||
|
cp %{_datadir}/libvirt/nwfilter/*.xml %{_sysconfdir}/libvirt/nwfilter/
|
||||||
|
# Make sure libvirt picks up the new nwfilter defininitons
|
||||||
|
%if %{with_systemd}
|
||||||
|
/bin/systemctl try-restart libvirtd.service >/dev/null 2>&1 ||:
|
||||||
|
%else
|
||||||
|
/sbin/service libvirtd condrestart > /dev/null 2>&1 || :
|
||||||
|
%endif
|
||||||
|
|
||||||
|
|
||||||
%if %{with_systemd}
|
%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 ||:
|
||||||
|
@ -1767,7 +1785,9 @@ exit 0
|
||||||
%{_datadir}/libvirt/networks/default.xml
|
%{_datadir}/libvirt/networks/default.xml
|
||||||
|
|
||||||
%files daemon-config-nwfilter
|
%files daemon-config-nwfilter
|
||||||
%{_sysconfdir}/libvirt/nwfilter/*.xml
|
%dir %{_datadir}/libvirt/nwfilter/
|
||||||
|
%{_datadir}/libvirt/nwfilter/*.xml
|
||||||
|
%ghost %{_sysconfdir}/libvirt/nwfilter/*.xml
|
||||||
|
|
||||||
%files daemon-driver-interface
|
%files daemon-driver-interface
|
||||||
%{_libdir}/%{name}/connection-driver/libvirt_driver_interface.so
|
%{_libdir}/%{name}/connection-driver/libvirt_driver_interface.so
|
||||||
|
|
Loading…
Reference in New Issue