From d6866e0544581840cc021e4be68c1c450fcb7963 Mon Sep 17 00:00:00 2001 From: Levente Polyak Date: Wed, 4 Dec 2019 12:39:34 +0100 Subject: lib: support arbitrary compressed package files 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 --- lib/common.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/common.sh b/lib/common.sh index eaa16a4..fce52f6 100644 --- a/lib/common.sh +++ b/lib/common.sh @@ -142,7 +142,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 @@ -152,7 +152,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"} -- cgit v1.2.3-70-g09d2