summaryrefslogtreecommitdiff
path: root/lib/common-functions
diff options
context:
space:
mode:
Diffstat (limited to 'lib/common-functions')
-rwxr-xr-xlib/common-functions41
1 files changed, 23 insertions, 18 deletions
diff --git a/lib/common-functions b/lib/common-functions
index 0585917..984f76c 100755
--- a/lib/common-functions
+++ b/lib/common-functions
@@ -175,25 +175,30 @@ remove_old_package_versions() {
expand_version 3 | \
sort -k3V,3 -k2r,2 | \
shrink_version 3 | \
- sed -n '
- /^'"${bpir_id}"' /q
- s/^\([0-9]\+ \)\(\S\+ \)\{2\}/\1/
- h
- /^[0-9]\+ 0 / {
- s/^\(\S\+ \)\{2\}//
- s/ \S\+$//
- w'"${tmp_dir}"'/repo-removes
- g
- }
- s/^\(\S\+ \)\{5\}//
- w'"${tmp_dir}"'/sftp-removes
- s/$/.sig/
- w'"${tmp_dir}"'/sftp-removes
- g
- s/ .*$//
- w'"${tmp_dir}"'/db-removes
+ sed '
+ s/^/'"${bpir_id}"' /
+ $ a
'
- done
+ done | \
+ sed -n '
+ /^\([0-9]\+\) \1 /,/^$/ d
+ /^$/ d
+ s/^[0-9]\+ \([0-9]\+ \)\(\S\+ \)\{2\}/\1/
+ h
+ /^[0-9]\+ 0 / {
+ s/^\(\S\+ \)\{2\}//
+ s/ \S\+$//
+ w'"${tmp_dir}"'/repo-removes
+ g
+ }
+ s/^\(\S\+ \)\{5\}//
+ w'"${tmp_dir}"'/sftp-removes
+ s/$/.sig/
+ w'"${tmp_dir}"'/sftp-removes
+ g
+ s/ .*$//
+ w'"${tmp_dir}"'/db-removes
+ '
for file in 'repo-removes' 'sftp-remove' 'db-removes'; do
if [ -s "${tmp_dir}/${file}" ]; then