aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authormerakor <cem@ckyln.com>2021-01-11 17:34:15 +0000
committermerakor <cem@ckyln.com>2021-01-11 17:34:15 +0000
commite76ede06d13bb8369ab57168ea5da2fd0054d42d (patch)
tree8dbb5c35d46813af052613b0482f0bfdcda6ca2a /contrib
parentc3a84adda049e53d9ea94507bf05e695e1575def (diff)
downloadcpt-e76ede06d13bb8369ab57168ea5da2fd0054d42d.tar.gz
cpt-export: simplify tar usage
FossilOrigin-Name: a983ef58192f4474e7e6718bd3372eb0c7f2027195eda17f22dbb58f7c519a55
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/cpt-export10
1 files changed, 4 insertions, 6 deletions
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"