From 7ea074a84c2b670b3059597a27baab86994510f5f01f3f89e692c580333f06ee Mon Sep 17 00:00:00 2001 From: Peter Wullinger Date: Tue, 19 May 2020 12:51:17 +0000 Subject: [PATCH] Accepting request 807311 from home:pwcau:branches:server:mail - switch pretrans to use lua (fixes bsc#1171877) OBS-URL: https://build.opensuse.org/request/show/807311 OBS-URL: https://build.opensuse.org/package/show/server:mail/exim?expand=0&rev=237 --- exim.changes | 4 +++- exim.spec | 34 +++++++++++++++++++--------------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/exim.changes b/exim.changes index e088da0..1ccd680 100644 --- a/exim.changes +++ b/exim.changes @@ -1,5 +1,7 @@ Tue May 19 13:47:05 CEST 2020 - wullinger@rz.uni-kiel.de -- pre-require bash for pretrans +- switch pretrans to use lua + (fixes bsc#1171877) + ------------------------------------------------------------------- Tue May 12 08:19:17 UTC 2020 - wullinger@rz.uni-kiel.de - bring changes from current in +fixes branch diff --git a/exim.spec b/exim.spec index c51ee0c..4ee09d5 100644 --- a/exim.spec +++ b/exim.spec @@ -71,7 +71,6 @@ Requires(pre): user(mail) Requires(pre): group(mail) %endif Requires(pre): fileutils textutils -Requires(pre): bash %endif Version: 4.93.0.4 Release: 4 @@ -383,20 +382,25 @@ install -m 0755 $RPM_SOURCE_DIR/eximstats-html-update.py $RPM_BUILD_ROOT/%{_sbin # apparmor profile install -D -m 0644 $RPM_SOURCE_DIR/apparmor.usr.sbin.exim $RPM_BUILD_ROOT/usr/share/apparmor/extra-profiles/usr.sbin.exim -%pretrans -if [ -d "%{_docdir}/%{name}/doc/cve-2019-13917" ]; then - moved_suffix="" - moved_index="" - while [ -d "%{_docdir}/%{name}/doc/cve-2019-13917.rpmmoved${moved_suffix}${moved_index}" ]; do - if [ -z "${moved_suffix}" ]; then - moved_suffix="." - moved_index="0" - else - moved_index=$((${moved_index} + 1)) - fi - done - mv "%{_docdir}/%{name}/doc/cve-2019-13917" "%{_docdir}/%{name}/doc/cve-2019-13917.rpmmoved${moved_suffix}${moved_index}" -fi +%pretrans -p +docdir = rpm.expand('%{_docdir}') +pkgname = rpm.expand('%{name}') +path = docdir .. '/' .. pkgname .. '/doc/cve-2019-13917' +st_path = posix.stat(path) +if st_path then + moved_path = path .. '.rpmmoved' + status = os.rename(path, moved_path) + if not status then + moved_index = 0 + moved_path = path .. '.rpmmoved.' .. moved_index + status = os.rename(path, moved_path) + while not status do + moved_index = moved_index + 1 + moved_path = path .. '.rpmmoved.' .. moved_index + status = os.rename(path, moved_path) + end + end +end %pre %if 0%{?suse_version} > 1220