aboutsummaryrefslogtreecommitdiff
path: root/kiss
diff options
context:
space:
mode:
authormerakor <cem@ckyln.com>2020-05-09 12:13:56 +0000
committermerakor <cem@ckyln.com>2020-05-09 12:13:56 +0000
commit2946e278d0a16a8759eff8364557985eccdc077b (patch)
tree5b5aac0b26c5b1b7149a76b43f3b052b40a9a2ab /kiss
parenta7f87097d5271ce9f1665a0f1a2d0021883b753d (diff)
downloadcpt-2946e278d0a16a8759eff8364557985eccdc077b.tar.gz
kiss: simplify tarball extraction
FossilOrigin-Name: 32ed89978ad12275ddc2c7033dfde81070999f3ea3756e0fdede68e5139eccf5
Diffstat (limited to 'kiss')
-rwxr-xr-xkiss20
1 files changed, 6 insertions, 14 deletions
diff --git a/kiss b/kiss
index 821291d..d2b9bbc 100755
--- a/kiss
+++ b/kiss
@@ -316,21 +316,13 @@ pkg_extract() {
# which allows for manual extraction.
*://*.tar|*://*.tar.??|*://*.tar.???|*://*.tar.????|*://*.tgz)
- # Remove the possible tar extensions so we can decompress it
- # into that location.
- src_tar="${src##*/}" src_tar="${src_tar%.tar*}" src_tar="${src_tar%.tgz}.tar"
-
- # Skip decompression if the source is already a decompressed tarball
- [ "$src_tar" = "${src##*/}" ] || {
- decompress "$src_dir/$1/${src##*/}" > "$src_dir/$1/$src_tar" ||
- die "$1" "Couldn't decompres ${src##*/}"
- }
+ decompress "$src_dir/$1/${src##*/}" > .ktar
- "$tar" xf "$src_dir/$1/$src_tar" || die "$1" "Couldn't extract $src_tar"
+ "$tar" xf .ktar || die "$1" "Couldn't extract ${src##*/}"
# We now list the contents of the tarball so we can do our
# version of 'strip-components'.
- "$tar" tf "$src_dir/$1/$src_tar" |
+ "$tar" tf .ktar |
while read -r file; do printf '%s\n' "${file%%/*}"; done |
# Do not repeat files.
@@ -343,7 +335,7 @@ pkg_extract() {
# Skip if we are not dealing with a directory here.
# This way we don't remove files on the upper directory
# if a tar archive doesn't need directory stripping.
- [ -d "$dir" ] || continue
+ [ -d "${dir#.}" ] || continue
# Change into the directory in a subshell so we don't
# need to cd back to the upper directory.
@@ -369,8 +361,8 @@ pkg_extract() {
! [ -e "${dir}.kissbak" ] || mv "${dir}.kissbak" "$dir"
done
- # Remove the decompressed tarball if it isn't the original source
- [ "$src_tar" = "${src##*/}" ] || rm -f "$src_dir/$1/$src_tar"
+ # Clean up the temporary tarball.
+ rm -f .ktar
;;
*://*.zip)