From b78fe36465129bb36748e9e14a1851876086e860 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Fri, 6 Nov 2020 08:23:25 +0200 Subject: [PATCH] kiss: Store downloaded sources using dest if set. https://github.com/kisslinux/kiss/commit/5bbe89573164607e91d411bc6b0b3a676471c8dd --- kiss | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/kiss b/kiss index 6d25135..acad211 100755 --- a/kiss +++ b/kiss @@ -200,15 +200,16 @@ pkg_sources() { : # Remote source (cached). - elif [ -f "${src##*/}" ]; then + elif [ -f "./${dest:-.}/${src##*/}" ]; then log "$1" "Found cached source '${src##*/}'" # Remote source. elif [ -z "${src##*://*}" ]; then log "$1" "Downloading $src" + mkdir -p "$PWD/$dest" - curl "$src" -fLo "${src##*/}" || { - rm -f "${src##*/}" + curl "$src" -fLo "./${dest:-.}/${src##*/}" || { + rm -f "./${dest:-.}/${src##*/}" die "$1" "Failed to download $src" } @@ -331,8 +332,8 @@ pkg_extract() { cp -f "/$src" . # Remote file. - elif [ -f "$src_dir/$1/${src##*/}" ]; then - cp -f "$src_dir/$1/${src##*/}" . + elif [ -f "$src_dir/$1/${dest:-.}/${src##*/}" ]; then + cp -f "$src_dir/$1/${dest:-.}/${src##*/}" . else die "$1" "Local file $src not found" @@ -705,14 +706,14 @@ pkg_checksums() { # Support packages without sources. Simply do nothing. [ -f "$repo_dir/sources" ] || return 0 - while read -r src _ || [ "$src" ]; do + while read -r src dest || [ "$src" ]; do # Skip comments, blank lines and git sources. if [ -z "${src##\#*}" ] || [ -z "${src##git+*}" ]; then : # Remote source. elif [ -z "${src##*://*}" ]; then - sh256 "$src_dir/$1/${src##*/}" + sh256 "$src_dir/$1/${dest:-.}/${src##*/}" # Skip directories. elif [ -d "$repo_dir/$src" ] || [ -d "/$src" ]; then