summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLevente Polyak <anthraxx@archlinux.org>2019-12-04 12:39:34 +0100
committerAndreas Grapentin <andreas@grapentin.org>2022-01-18 15:17:16 +0100
commit41ddbf3c444c8a5dccc66ea13a032bb7b3251f25 (patch)
tree9c63d2732aa418b17b8cbadb9a7e7f9959115d80
parentdb736c6104d6497d735c4c987768fd136d297661 (diff)
lib: support arbitrary compressed package fileslibretools-20220118
We need to modify the matching of valid package files to support formats like zstd. Let's try to use an eager approach instead of a simple whitelist in order to be functional for arbitrary formats that may be introduced in the future without the need to adjust any code. Allow any single fragment word as compression type but filter out known non-package content like signature files. Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
-rw-r--r--lib/common.sh4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/common.sh b/lib/common.sh
index d5292ca..00485a7 100644
--- a/lib/common.sh
+++ b/lib/common.sh
@@ -182,7 +182,7 @@ find_cached_package() {
for dir in "${searchdirs[@]}"; do
[[ -d $dir ]] || continue
- for pkg in "$dir"/*.pkg.tar?(.?z); do
+ for pkg in "$dir"/*.pkg.tar?(.!(sig|*.*)); do
[[ -f $pkg ]] || continue
# avoid adding duplicates of the same inode
@@ -192,7 +192,7 @@ find_cached_package() {
# split apart package filename into parts
pkgbasename=${pkg##*/}
- pkgbasename=${pkgbasename%.pkg.tar?(.?z)}
+ pkgbasename=${pkgbasename%.pkg.tar*}
arch=${pkgbasename##*-}
pkgbasename=${pkgbasename%-"$arch"}