From 074cb150e1fb1fdf7387d57b9dc43d9e3031d722e9964f247075ea2a516bd27f Mon Sep 17 00:00:00 2001 From: Alexander Bergmann Date: Wed, 21 Sep 2022 13:56:32 +0000 Subject: [PATCH] Accepting request 1003790 from home:schubi2:logrotate - Migration to /usr/etc: Saving user changed configuration files in /etc and restoring them while an RPM update. OBS-URL: https://build.opensuse.org/request/show/1003790 OBS-URL: https://build.opensuse.org/package/show/network:utilities/net-snmp?expand=0&rev=50 --- net-snmp.changes | 6 ++++++ net-snmp.spec | 14 ++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/net-snmp.changes b/net-snmp.changes index b7c4ec6..75de764 100644 --- a/net-snmp.changes +++ b/net-snmp.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Thu Sep 1 07:27:27 UTC 2022 - Stefan Schubert + +- Migration to /usr/etc: Saving user changed configuration files + in /etc and restoring them while an RPM update. + ------------------------------------------------------------------- Tue Jul 12 14:18:13 UTC 2022 - Dominique Leuenberger diff --git a/net-snmp.spec b/net-snmp.spec index ceeffd7..ff475a4 100644 --- a/net-snmp.spec +++ b/net-snmp.spec @@ -320,6 +320,20 @@ find %{buildroot} -type f -name "*.la" -delete -print %pre %service_add_pre snmpd.service snmptrapd.service +%if 0%{?suse_version} > 1500 +# Prepare for migration to /usr/etc; save any old .rpmsave +for i in logrotate.d/net-snmp ; do + test -f %{_sysconfdir}/${i}.rpmsave && mv -v %{_sysconfdir}/${i}.rpmsave %{_sysconfdir}/${i}.rpmsave.old ||: +done +%endif + +%if 0%{?suse_version} > 1500 +%posttrans +# Migration to /usr/etc, restore just created .rpmsave +for i in logrotate.d/net-snmp ; do + test -f %{_sysconfdir}/${i}.rpmsave && mv -v %{_sysconfdir}/${i}.rpmsave %{_sysconfdir}/${i} ||: +done +%endif %post %fillup_only -n snmpd