From a8b2f14af98978932c74d1fbace56f3046c1a69c27c9c3d52ac5a760209246fa Mon Sep 17 00:00:00 2001 From: Martin Pluskal Date: Tue, 8 Mar 2022 11:48:13 +0000 Subject: [PATCH] Accepting request 960052 from home:mwilck:modprobe.d - use /lib/modprobe.d in 15.3, too - Add code for safe modprobe.d migration (https://en.opensuse.org/openSUSE:Packaging_UsrEtc) OBS-URL: https://build.opensuse.org/request/show/960052 OBS-URL: https://build.opensuse.org/package/show/network:time/pcfclock?expand=0&rev=17 --- pcfclock.changes | 7 +++++++ pcfclock.spec | 23 ++++++++++++++++++++--- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/pcfclock.changes b/pcfclock.changes index 02ce75e..677ef98 100644 --- a/pcfclock.changes +++ b/pcfclock.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Mon Mar 7 20:05:06 UTC 2022 - Martin Wilck + +- use /lib/modprobe.d in 15.3, too +- Add code for safe modprobe.d migration + (https://en.opensuse.org/openSUSE:Packaging_UsrEtc) + ------------------------------------------------------------------- Fri Aug 20 20:11:49 UTC 2021 - Callum Farmer diff --git a/pcfclock.spec b/pcfclock.spec index 53f416c..c8b2956 100644 --- a/pcfclock.spec +++ b/pcfclock.spec @@ -1,7 +1,7 @@ # # spec file for package pcfclock # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -15,10 +15,13 @@ # Please submit bugfixes or comments via https://bugs.opensuse.org/ # -%if 0%{?suse_version} < 1550 && 0%{?sle_version} < 150300 -# systemd-rpm-macros(or kmod) is wrong in 15.2 + +%if 0%{?suse_version} < 1550 && 0%{?sle_version} <= 150300 +# systemd-rpm-macros is wrong in 15.3 and below %define _modprobedir /lib/modprobe.d %endif +%global modprobe_d_files 50-pcfclock.conf + Name: pcfclock Version: 0.44 Release: 0 @@ -111,10 +114,24 @@ mkdir -p %{buildroot}%{_tmpfilesdir} install -m 0644 %{SOURCE3} %{buildroot}%{_tmpfilesdir} %endif +%pre +# 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 # Create devices nodes at installation time systemd-tmpfiles --create %{_tmpfilesdir}/pcfclock.conf +%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 + %files %defattr(-,root,root) %doc README