From ceb14b7b7e26cb4d727e3d4ab991ebd8b00a97bfdc363328379f26b5cd406a39 Mon Sep 17 00:00:00 2001 From: Callum Farmer Date: Wed, 9 Mar 2022 09:11:22 +0000 Subject: [PATCH] Accepting request 960050 from home:mwilck:modprobe.d - Add code for safe modprobe.d migration (https://en.opensuse.org/openSUSE:Packaging_UsrEtc) - Always own %_modprobedir (bsc#1196275, jsc#SLE-20639) OBS-URL: https://build.opensuse.org/request/show/960050 OBS-URL: https://build.opensuse.org/package/show/security:netfilter/firewalld?expand=0&rev=121 --- firewalld.changes | 11 +++++++++++ firewalld.spec | 16 ++++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/firewalld.changes b/firewalld.changes index 048805d..5b16305 100644 --- a/firewalld.changes +++ b/firewalld.changes @@ -1,3 +1,14 @@ +------------------------------------------------------------------- +Mon Mar 7 16:45:58 UTC 2022 - Martin Wilck + +- Add code for safe modprobe.d migration + (https://en.opensuse.org/openSUSE:Packaging_UsrEtc) + +------------------------------------------------------------------- +Fri Mar 4 20:30:02 UTC 2022 - Martin Wilck + +- Always own %_modprobedir (bsc#1196275, jsc#SLE-20639) + ------------------------------------------------------------------- Thu Mar 3 14:26:57 UTC 2022 - Thorsten Kukuk diff --git a/firewalld.spec b/firewalld.spec index c08652c..772389f 100644 --- a/firewalld.spec +++ b/firewalld.spec @@ -24,6 +24,8 @@ # systemd-rpm-macros(or kmod) is wrong in 15.2 and 15.3 %define _modprobedir /lib/modprobe.d %endif +%global modprobe_d_files firewalld-sysctls.conf + Name: firewalld Version: 1.1.0 Release: 0 @@ -197,6 +199,11 @@ mv %{buildroot}%{_sysconfdir}/xdg/autostart/* %{buildroot}%{_distconfdir}/xdg/au %pre %service_add_pre firewalld.service +# Avoid restoring outdated stuff in posttrans +for _f in %{?modprobe_d_files}; do + [ ! -f "/etc/modprobe.d/${_f}.rpmsave" ] || \ + mv -f "/etc/modprobe.d/${_f}.rpmsave" "/etc/modprobe.d/${_f}.rpmsave.old" || : +done %post %service_add_post firewalld.service @@ -212,6 +219,13 @@ mv %{buildroot}%{_sysconfdir}/xdg/autostart/* %{buildroot}%{_distconfdir}/xdg/au # Let the user restart it whenever he feels like it. %service_del_postun_without_restart firewalld.service +%posttrans +# Migration of modprobe.conf files to _modprobedir +for _f in %{?modprobe_d_files}; do + [ ! -f "/etc/modprobe.d/${_f}.rpmsave" ] || \ + mv -fv "/etc/modprobe.d/${_f}.rpmsave" "/etc/modprobe.d/${_f}" || : +done + %post -n firewall-applet /bin/touch --no-create %{_datadir}/icons/hicolor &>/dev/null || : @@ -263,9 +277,7 @@ fi %{_datadir}/polkit-1 %dir %{_datadir}/dbus-1 %dir %{_datadir}/dbus-1/system.d -%if 0%{?suse_version} < 1550 && 0%{?sle_version} < 150300 %dir %{_modprobedir} -%endif %{_modprobedir}/firewalld-sysctls.conf %config(noreplace) %{_sysconfdir}/firewalld/firewalld.conf %config(noreplace) %{_sysconfdir}/firewalld/lockdown-whitelist.xml