From e76ede06d13bb8369ab57168ea5da2fd0054d42d Mon Sep 17 00:00:00 2001 From: merakor Date: Mon, 11 Jan 2021 17:34:15 +0000 Subject: cpt-export: simplify tar usage FossilOrigin-Name: a983ef58192f4474e7e6718bd3372eb0c7f2027195eda17f22dbb58f7c519a55 --- contrib/cpt-export | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'contrib/cpt-export') diff --git a/contrib/cpt-export b/contrib/cpt-export index 87ba2da..5429c08 100755 --- a/contrib/cpt-export +++ b/contrib/cpt-export @@ -17,6 +17,7 @@ read -r ver rel 2>/dev/null < \ # Reset the argument list. pkg=$1 +tarball="$PWD/$1#$ver-$rel.tar.${CPT_COMPRESS:=gz}" set -- # Construct the argument list using each file. @@ -25,15 +26,12 @@ while read -r file; do done < "$CPT_ROOT/var/db/cpt/installed/$pkg/manifest" # Turn the list of files back into a package. -(cd "$CPT_ROOT/" - tar cf - -- "$@" || exit 1) | - -case "$CPT_COMPRESS" in + tar cf - -- "$@" | case "$CPT_COMPRESS" in bz2) bzip2 -z ;; gz) gzip -6 ;; xz) xz -zT 0 ;; zst) zstd -3 ;; *) gzip -6 ;; # Fallback to gzip -esac > "$pkg#$ver-$rel.tar.$CPT_COMPRESS" +esac > "$tarball" -printf 'tarball created in %s\n' "$PWD/$pkg#$ver-$rel.tar.$CPT_COMPRESS" +printf 'tarball created in %s\n' "$tarball" -- cgit v1.2.3