diff options
author | Patrick Spek <p.spek@tyil.nl> | 2020-03-22 13:44:01 +0100 |
---|---|---|
committer | Patrick Spek <p.spek@tyil.nl> | 2020-03-22 13:44:01 +0100 |
commit | 1548063b6ac54affecccc19872b1ffeed64f0887 (patch) | |
tree | 645d7ec3faeff40be96172b134023510334b5b6a /lib/actions/fetch.bash | |
parent | e335ffb41f7d65f369a8e4170affcd8d68a40be2 (diff) |
Work out (most?) issues reported by shellcheck
Diffstat (limited to 'lib/actions/fetch.bash')
-rw-r--r-- | lib/actions/fetch.bash | 22 |
1 files changed, 14 insertions, 8 deletions
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" |