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

37
kiss
View File

@ -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##*/}"
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##*/}"
;;
# Local file.
elif [ -f "$repo_dir/$src" ]; then
cp -f "$repo_dir/$src" .
*)
# Local file.
if [ -f "$repo_dir/$src" ]; then
cp -f "$repo_dir/$src" .
# Remote file.
elif [ -f "$src_dir/$1/${src##*/}" ]; then
cp -f "$src_dir/$1/${src##*/}" .
# Remote file.
elif [ -f "$src_dir/$1/${src##*/}" ]; then
cp -f "$src_dir/$1/${src##*/}" .
else
die "$1" "Local file $src not found"
fi
else
die "$1" "Local file $src not found"
fi
;;
esac
done < "$repo_dir/sources"
}
@ -1019,7 +1024,7 @@ args() {
;;
v|version|-v|--version)
log kiss 0.53.1
log kiss 0.53.2
;;
h|help|-h|--help|'')