spec: don't touch existing nwfilters on update

Nwfilter can be edited by the user and we don't want to overwrite the editings.
Also the filters in %{datadir} does not have UUIDs and these are generated on
libvirtd start. Thus this patch also fixes regeneration of UUIDs on libvirtd
update.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
This commit is contained in:
Nikolay Shirokovskiy 2020-12-07 10:49:12 +03:00
parent 641fd93de1
commit 95b95e63eb

View File

@ -1439,9 +1439,13 @@ fi
rm -rf %{_localstatedir}/lib/rpm-state/libvirt || :
%post daemon-config-nwfilter
cp %{_datadir}/libvirt/nwfilter/*.xml %{_sysconfdir}/libvirt/nwfilter/
# libvirt saves these files with mode 600
chmod 600 %{_sysconfdir}/libvirt/nwfilter/*.xml
for datadir_file in %{_datadir}/libvirt/nwfilter/*.xml; do
sysconfdir_file=%{_sysconfdir}/libvirt/nwfilter/$(basename "$datadir_file")
if [ ! -f "$sysconfdir_file" ]; then
# libvirt saves these files with mode 600
install -m 0600 "$datadir_file" "$sysconfdir_file"
fi
done
# Make sure libvirt picks up the new nwfilter defininitons
mkdir -p %{_localstatedir}/lib/rpm-state/libvirt || :
touch %{_localstatedir}/lib/rpm-state/libvirt/restart || :