mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 05:35:25 +00:00
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>
(cherry picked from commit 1d3963dba5
)
This commit is contained in:
parent
b23980eb3d
commit
99ea70b49a
@ -1238,6 +1238,13 @@ cp $RPM_BUILD_ROOT%{_sysconfdir}/libvirt/qemu/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/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
|
||||
sed -i -e "/<uuid>/d" $RPM_BUILD_ROOT%{_datadir}/libvirt/networks/default.xml
|
||||
%if ! %{with_qemu}
|
||||
@ -1465,6 +1472,17 @@ if test $1 -eq 1 && test ! -f %{_sysconfdir}/libvirt/qemu/networks/default.xml ;
|
||||
|
||||
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}
|
||||
%triggerun -- libvirt < 0.9.4
|
||||
%{_bindir}/systemd-sysv-convert --save libvirtd >/dev/null 2>&1 ||:
|
||||
@ -1645,7 +1663,9 @@ exit 0
|
||||
%{_datadir}/libvirt/networks/default.xml
|
||||
|
||||
%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
|
||||
%{_libdir}/%{name}/connection-driver/libvirt_driver_interface.so
|
||||
|
Loading…
Reference in New Issue
Block a user