From 0c32424ab73a5b4bef2c0ee95bf1320188a38b809d0f65e238453f4ca10caa31 Mon Sep 17 00:00:00 2001 From: Adam Majer Date: Mon, 26 Sep 2022 10:29:20 +0000 Subject: [PATCH] Accepting request 1003832 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/1003832 OBS-URL: https://build.opensuse.org/package/show/server:proxy/squid?expand=0&rev=263 --- squid.changes | 6 ++++++ squid.spec | 14 ++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/squid.changes b/squid.changes index 08d10a0..a59b1af 100644 --- a/squid.changes +++ b/squid.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Thu Sep 15 10:41:14 UTC 2022 - Stefan Schubert + +- Migration to /usr/etc: Saving user changed configuration files + in /etc and restoring them while an RPM update. + ------------------------------------------------------------------- Sun Sep 11 08:00:04 UTC 2022 - Dirk Müller diff --git a/squid.spec b/squid.spec index 4f420cf..3a8a109 100644 --- a/squid.spec +++ b/squid.spec @@ -270,6 +270,20 @@ if [ $(%{_bindir}/id -nG %{name} 2>/dev/null | grep -q winbind; echo $?) -ne 0 ] fi %endif %service_add_pre %{name}.service +%if 0%{?suse_version} > 1500 +# Prepare for migration to /usr/etc; save any old .rpmsave +for i in logrotate.d/%{name} ; 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/%{name} ; do + test -f %{_sysconfdir}/${i}.rpmsave && mv -v %{_sysconfdir}/${i}.rpmsave %{_sysconfdir}/${i} ||: +done +%endif # update mode? if [ "$1" -gt "1" ]; then