From fe2fa18317866ed96c0de4badda0ba0e4de20b83 Mon Sep 17 00:00:00 2001 From: "dylan.araps@gmail.com" Date: Mon, 23 Sep 2019 06:30:33 +0000 Subject: kiss: swap to if tests FossilOrigin-Name: c20a964430766db61ff52d8217608dc6ab87998447190fa3ee2c5029303e15c5 --- kiss | 80 +++++++++++++++++++++++++++++++------------------------------------- 1 file changed, 36 insertions(+), 44 deletions(-) diff --git a/kiss b/kiss index 07688af..cfb280f 100755 --- a/kiss +++ b/kiss @@ -132,27 +132,24 @@ pkg_sources() { repo_dir=$(pkg_find "$1") while read -r src _; do - case $src in - # Remote source. - *://*) - [ -f "${src##*/}" ] && { - log "$1" "Found cached source '${src##*/}'" - continue - } - - wget "$src" || { - rm -f "${src##*/}" - die "$1" "Failed to download $src" - } - ;; - - # Local source. - *) - [ -f "$repo_dir/$src" ] || die "$1" "No local file '$src'" - - log "$1" "Found local file '$src'" - ;; - esac + # Remote source (cached). + if [ -f "${src##*/}" ]; then + log "$1" "Found cached source '${src##*/}'" + + # Remote source. + elif [ -z "${src##*://*}" ]; then + wget "$src" || { + rm -f "${src##*/}" + die "$1" "Failed to download $src" + } + + # Local source. + elif [ -f "$repo_dir/$src" ]; then + log "$1" "Found local file '$src'" + + else + die "$1" "No local file '$src'" + fi done < "$repo_dir/sources" } @@ -166,29 +163,24 @@ pkg_extract() { while read -r src dest; do mkdir -p "$mak_dir/$1/$dest" && cd "$mak_dir/$1/$dest" - 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*|*://*.tgz) - tar xf "$src_dir/$1/${src##*/}" --strip-components 1 \ - || die "$1" "Couldn't extract ${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##*/}" . - - else - die "$1" "Local file $src not found" - fi - ;; - esac + # 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*}" ]; 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" . + + # Remote file. + elif [ -f "$src_dir/$1/${src##*/}" ]; then + cp -f "$src_dir/$1/${src##*/}" . + + else + die "$1" "Local file $src not found" + fi done < "$repo_dir/sources" } -- cgit v1.2.3 From eb8a4889f96d75b02fe074917ac5555814c3db02 Mon Sep 17 00:00:00 2001 From: "dylan.araps@gmail.com" Date: Mon, 23 Sep 2019 06:36:05 +0000 Subject: kiss: add back support for tgz archives (y lvm2 y) FossilOrigin-Name: ede9a9180b5d63dfd69b9e76f7da3b83f9f47bf149abf433cf703df31962ab5f --- kiss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kiss b/kiss index cfb280f..a46989b 100755 --- a/kiss +++ b/kiss @@ -166,7 +166,7 @@ pkg_extract() { # 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*}" ]; then + if [ -z "${src##*.tar*}" ] || [ -z "${src##*.tgz}" ]; then tar xf "$src_dir/$1/${src##*/}" --strip-components 1 \ || die "$1" "Couldn't extract ${src##*/}" -- cgit v1.2.3