1
0
mirror of https://codeberg.org/kiss-community/kiss synced 2024-12-25 16:40:07 -07:00

kiss cleanup

This commit is contained in:
Dylan Araps 2019-09-10 11:20:05 +03:00
parent 301373d18b
commit b3de35dfcf

14
kiss
View File

@ -149,33 +149,27 @@ pkg_extract() {
# any local repository files. # any local repository files.
log "[$1] Extracting sources" log "[$1] Extracting sources"
# Store each downloaded source in named after the package it
# belongs to. This avoid conflicts between two packages having a
# source of the same name.
mkdir -p "$mak_dir/$1" && cd "$mak_dir/$1"
repo_dir=$(pkg_find "$1") repo_dir=$(pkg_find "$1")
while read -r src dest; do while read -r src dest; do
mkdir -p "./$dest" mkdir -p "$mak_dir/$1/$dest" && cd "$mak_dir/$1/$dest"
case $src in case $src in
# Only 'tar' archives are currently supported for extraction. # Only 'tar' archives are currently supported for extraction.
# Any other file-types are simply copied to '$mak_dir' which # Any other file-types are simply copied to '$mak_dir' which
# allows you to extract them manually. # allows you to extract them manually.
*://*.tar*|*://*.tgz) *://*.tar*|*://*.tgz)
tar xf "$src_dir/$1/${src##*/}" -C "./$dest" \ tar xf "$src_dir/$1/${src##*/}" --strip-components 1 \
--strip-components 1 \
|| die "[$1] Couldn't extract ${src##*/}" || die "[$1] Couldn't extract ${src##*/}"
;; ;;
# Local files (Any non-remote source is assumed to be local). # Local files (Any non-remote source is assumed to be local).
*) *)
if [ -f "$repo_dir/$src" ]; then if [ -f "$repo_dir/$src" ]; then
cp -f "$repo_dir/$src" "./$dest" cp -f "$repo_dir/$src" .
elif [ -f "$src_dir/$1/${src##*/}" ]; then elif [ -f "$src_dir/$1/${src##*/}" ]; then
cp -f "$src_dir/$1/${src##*/}" "./$dest" cp -f "$src_dir/$1/${src##*/}" .
else else
die "[$1] Local file $src not found" die "[$1] Local file $src not found"