From 1548063b6ac54affecccc19872b1ffeed64f0887 Mon Sep 17 00:00:00 2001 From: Patrick Spek Date: Sun, 22 Mar 2020 13:44:01 +0100 Subject: Work out (most?) issues reported by shellcheck --- lib/actions/fetch.bash | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'lib/actions/fetch.bash') diff --git a/lib/actions/fetch.bash b/lib/actions/fetch.bash index c489608..2b932be 100644 --- a/lib/actions/fetch.bash +++ b/lib/actions/fetch.bash @@ -1,6 +1,6 @@ #!/usr/bin/env bash -RSTAR_DEPS_BIN=( +RSTAR_DEPS_BIN+=( awk curl git @@ -20,22 +20,26 @@ action() { mkdir -p "$BASEDIR/dist/src/modules" # Download all modules available over http - list_modules "http" | while read -r name proto url prefix + list_modules "http" | while read -r name _ url prefix do download_module_http "$name" "$url" "$prefix" done # Download all modules available over git - list_modules "git" | while read -r name proto url ref + list_modules "git" | while read -r name _ url ref do download_module_git "$name" "$url" "$ref" done } download_core() { - local version="$(config_etc_kv "dist_$1.txt" "version")" - local source="$(echo "$(config_etc_kv "dist_$1.txt" "url")" | sed "s/%s/$version/g")" - local destination="$BASEDIR/dist/src/core/$1-$version" + local version + local source + local destination + + version="$(config_etc_kv "dist_$1.txt" "version")" + source="$(config_etc_kv "dist_$1.txt" "url" | sed "s/%s/$version/g")" + destination="$BASEDIR/dist/src/core/$1-$version" if [[ -d $destination ]] then @@ -76,6 +80,8 @@ download_module_http() { local url=$2 local prefix=$3 local destination="$BASEDIR/dist/src/modules/$name" + local tarball + local extracted if [[ -d "$destination" ]] then @@ -83,8 +89,8 @@ download_module_http() { return 0 fi - local tarball="$(fetch "$url")" - local extracted="$(tempdir)" + tarball="$(fetch "$url")" + extracted="$(tmpdir)" notice "Extracting $tarball into $extracted" tar xzf "$tarball" -C "$extracted" -- cgit v1.1