From 95b95e63eb544fe6fb3b003f0d68b328cc3193b6 Mon Sep 17 00:00:00 2001 From: Nikolay Shirokovskiy Date: Mon, 7 Dec 2020 10:49:12 +0300 Subject: [PATCH] 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 Reviewed-by: Michal Privoznik Reviewed-by: Andrea Bolognani --- libvirt.spec.in | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libvirt.spec.in b/libvirt.spec.in index 880051b6f8..f20a1c741b 100644 --- a/libvirt.spec.in +++ b/libvirt.spec.in @@ -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 || : -- 2.47.2