index : builder | |
Archlinux32 build system | gitolite user |
summaryrefslogtreecommitdiff |
author | Erich Eckner <git@eckner.net> | 2017-06-14 13:12:57 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2017-06-14 13:12:57 +0200 |
commit | 25da9bfd6828868cf0d300bc45cbdff069d751c0 (patch) | |
tree | 315940307f71a9b4c6725ac0a7ec1e3c379f344d /bin/common-functions | |
parent | ef56ac4ec9279867ac17156849bc371802e054d7 (diff) |
-rwxr-xr-x | bin/common-functions | 15 |
diff --git a/bin/common-functions b/bin/common-functions index cd115fd..00da63c 100755 --- a/bin/common-functions +++ b/bin/common-functions @@ -275,3 +275,18 @@ official_or_community() { ;; esac } + +# remove_old_package_versions $package_file +# removes all other versions of $package_file in the current directory + +remove_old_package_versions() { + + local package="$1" + local pkgname="${package%-*-*-*.pkg.tar.xz}" + + ls | \ + grep "^${pkgname//./\\.}\(-[^-]\+\)\{3\}\.pkg\.tar\.xz\(\.sig\)\?\$" | \ + grep -v "^${package//./\\.}\(\.sig\)\?\$" | \ + xargs -rn1 rm + +} |