Commit: 8aed3f3e15f3198f628ef4faf7ba32b981e17da2 Parent: 82d203e59f48ae2aa13c1e97a10070f490578ff3 Author: Randy Palamar Date: Fri, 30 Aug 2024 10:22:15 -0600 unpack: add 7z support Diffstat:
M | bin/unpack | | | 17 | +++++++++-------- |
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/bin/unpack b/bin/unpack @@ -13,7 +13,7 @@ run() command -v "$1" >/dev/null 2>&1 || die "unpack: missing program: $1" - "$@" || die "unpack: failed to extract" + "$@" >/dev/null || die "unpack: failed to extract" } case "$#" in @@ -26,13 +26,14 @@ esac mkdir -p "$2" >/dev/null 2>&1 || die "unpack: $2: not a directory" case $(file -ib -- "$1" | cut -d ';' -f 1 | cut -d '/' -f 2) in -bzip2|x-bzip2) run bzip2 -dc "$1" | tar -C "$2" -x ;; -gzip|x-gzip) run gzip -dc "$1" | tar -C "$2" -x ;; -tar|x-tar) run tar -C "$2" -xf "$1" ;; -x-xz) run xz -dc "$1" | tar -C "$2" -x ;; -zip) run unzip -d "$2" "$1" ;; -zstd) run zstd -dcf "$1" | tar -C "$2" -x ;; -*) die "unpack: $1: unsupported archive type" +bzip2|x-bzip2) run bzip2 -dc "$1" | tar -C "$2" -x ;; +gzip|x-gzip) run gzip -dc "$1" | tar -C "$2" -x ;; +tar|x-tar) run tar -C "$2" -xf "$1" ;; +x-7z-compressed) run 7z e -bd -o"$2" "$1" ;; +x-xz) run xz -dc "$1" | tar -C "$2" -x ;; +zip) run unzip -d "$2" "$1" ;; +zstd) run zstd -dcf "$1" | tar -C "$2" -x ;; +*) die "unpack: $1: unsupported archive type" esac printf "unpacked %s into %s\n" "$1" "$2"