kiss: be more explicit (and less greedy) with tar archives.

This commit is contained in:
Dylan Araps 2019-10-14 23:40:52 +03:00
parent 55e607720d
commit 66c363a3b8
No known key found for this signature in database
GPG Key ID: 46D62DD9F1DE636E
1 changed files with 21 additions and 16 deletions

37
kiss
View File

@ -173,24 +173,29 @@ pkg_extract() {
while read -r src dest; do while read -r src dest; do
mkdir -p "$mak_dir/$1/$dest" && cd "$mak_dir/$1/$dest" mkdir -p "$mak_dir/$1/$dest" && cd "$mak_dir/$1/$dest"
# Only 'tar' archives are currently supported for extraction. case $src in
# Any other file-types are simply copied to '$mak_dir' which # Only 'tar' archives are currently supported for extraction.
# allows for manual extraction. # Any other file-types are simply copied to '$mak_dir' which
if [ -z "${src##*.tar*}" ] || [ -z "${src##*.tgz}" ]; then # allows for manual extraction.
tar xf "$src_dir/$1/${src##*/}" --strip-components 1 \ *://*.tar|*://*.tar.??|*://*.tar.???|*://*.tar.????|*://*.tgz)
|| die "$1" "Couldn't extract ${src##*/}" tar xf "$src_dir/$1/${src##*/}" --strip-components 1 ||
die "$1" "Couldn't extract ${src##*/}"
;;
# Local file. *)
elif [ -f "$repo_dir/$src" ]; then # Local file.
cp -f "$repo_dir/$src" . if [ -f "$repo_dir/$src" ]; then
cp -f "$repo_dir/$src" .
# Remote file. # Remote file.
elif [ -f "$src_dir/$1/${src##*/}" ]; then elif [ -f "$src_dir/$1/${src##*/}" ]; then
cp -f "$src_dir/$1/${src##*/}" . cp -f "$src_dir/$1/${src##*/}" .
else else
die "$1" "Local file $src not found" die "$1" "Local file $src not found"
fi fi
;;
esac
done < "$repo_dir/sources" done < "$repo_dir/sources"
} }
@ -1019,7 +1024,7 @@ args() {
;; ;;
v|version|-v|--version) v|version|-v|--version)
log kiss 0.53.1 log kiss 0.53.2
;; ;;
h|help|-h|--help|'') h|help|-h|--help|'')