aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormerakor <cem@ckyln.com>2021-07-04 12:01:16 +0000
committermerakor <cem@ckyln.com>2021-07-04 12:01:16 +0000
commit1dd4d6ff907682cd1ae941224d4b3bc02443f51e (patch)
tree05feb0cf2d46034db6bfee684ce912e8d82056e2
parentf12f0203579a57348b7509f77d9f06c27d84490e (diff)
downloadcpt-1dd4d6ff907682cd1ae941224d4b3bc02443f51e.tar.gz
cpt-export: export manifest as is and make optimisations for pax
FossilOrigin-Name: 1775aea1245c96453da6dfb0116b8864c935882a3811a8375289cf647635ad7f
-rwxr-xr-xcontrib/cpt-export16
1 files changed, 6 insertions, 10 deletions
diff --git a/contrib/cpt-export b/contrib/cpt-export
index 0e6ce6f..68d628d 100755
--- a/contrib/cpt-export
+++ b/contrib/cpt-export
@@ -20,11 +20,12 @@ case "$1" in
'') set -- "${PWD##*/}"
esac
-cpt-list "${1:-null}" >/dev/null
+cpt-list "$1" >/dev/null
+db=$CPT_ROOT/var/db/cpt/installed
# Grab the package's version..
-read -r ver rel 2>/dev/null < \
- "$CPT_ROOT/var/db/cpt/installed/$1/version"
+read -r ver rel 2>/dev/null < "$db/$1/version"
+
### Environment variables:
### The compression method can be changed while creating a tarball, using the
@@ -35,17 +36,12 @@ read -r ver rel 2>/dev/null < \
case "$CPT_COMPRESS" in bz2|gz|xz|zst|lz) ;; *) CPT_COMPRESS=gz; esac
# Reset the argument list.
-pkg=$1
tarball="$PWD/$1#$ver-$rel.tar.$CPT_COMPRESS"
-set --
-
-# Construct the argument list using each file.
-eval set -- "$(sed '/\/$/d;s|^|".|;s|$|"|' \
- "$CPT_ROOT/var/db/cpt/installed/$pkg/manifest" | tr '\n' ' ')"
# Turn the list of files back into a package.
cd "$CPT_ROOT/"
-pax -w -- "$@" |
+sed 's/^/./' "$db/$1/manifest" |
+pax -wd |
case "$CPT_COMPRESS" in
bz2) bzip2 -z ;;