Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
kiss: be more explicit (and less greedy) with tar archives.
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanaraps committed Oct 14, 2019
1 parent 55e6077 commit 66c363a
Showing 1 changed file with 22 additions and 17 deletions.
39 changes: 22 additions & 17 deletions kiss
Original file line number Diff line number Diff line change
Expand Up @@ -173,24 +173,29 @@ pkg_extract() {
while read -r src dest; do
mkdir -p "$mak_dir/$1/$dest" && cd "$mak_dir/$1/$dest"

# Only 'tar' archives are currently supported for extraction.
# Any other file-types are simply copied to '$mak_dir' which
# allows for manual extraction.
if [ -z "${src##*.tar*}" ] || [ -z "${src##*.tgz}" ]; then
tar xf "$src_dir/$1/${src##*/}" --strip-components 1 \
|| die "$1" "Couldn't extract ${src##*/}"

# Local file.
elif [ -f "$repo_dir/$src" ]; then
cp -f "$repo_dir/$src" .
case $src in
# Only 'tar' archives are currently supported for extraction.
# Any other file-types are simply copied to '$mak_dir' which
# allows for manual extraction.
*://*.tar|*://*.tar.??|*://*.tar.???|*://*.tar.????|*://*.tgz)
tar xf "$src_dir/$1/${src##*/}" --strip-components 1 ||
die "$1" "Couldn't extract ${src##*/}"
;;

# Remote file.
elif [ -f "$src_dir/$1/${src##*/}" ]; then
cp -f "$src_dir/$1/${src##*/}" .
*)
# Local file.
if [ -f "$repo_dir/$src" ]; then
cp -f "$repo_dir/$src" .

else
die "$1" "Local file $src not found"
fi
# Remote file.
elif [ -f "$src_dir/$1/${src##*/}" ]; then
cp -f "$src_dir/$1/${src##*/}" .

else
die "$1" "Local file $src not found"
fi
;;
esac
done < "$repo_dir/sources"
}

Expand Down Expand Up @@ -1019,7 +1024,7 @@ args() {
;;

v|version|-v|--version)
log kiss 0.53.1
log kiss 0.53.2
;;

h|help|-h|--help|'')
Expand Down

0 comments on commit 66c363a

Please sign in to comment.