Make omitted version just reference to corresponding version

This commit is contained in:
Taiki Endo
2022-12-27 01:18:59 +09:00
parent 2be5cc5346
commit 12505bef68
21 changed files with 272 additions and 2631 deletions

15
main.sh
View File

@@ -138,6 +138,16 @@ read_manifest() {
manifest_data=$(<"${manifest_dir}/${tool}.json")
local manifest
manifest=$(jq <<<"${manifest_data}" -r ".\"${version}\"")
case "${manifest}" in
null) bail "version '${version}' for ${tool} is not supported" ;;
esac
local exact_version
exact_version=$(jq <<<"${manifest}" -r '.version')
if [[ "${exact_version}" == "null" ]]; then
exact_version="${version}"
else
manifest=$(jq <<<"${manifest_data}" -r ".\"${exact_version}\"")
fi
local download_info
local host_platform
case "${host_os}" in
@@ -191,11 +201,6 @@ read_manifest() {
if [[ "${url}" == "null" ]]; then
local template
template=$(jq <<<"${manifest_data}" -r ".template.${host_platform}")
local exact_version
exact_version=$(jq <<<"${manifest}" -r '.version')
if [[ "${exact_version}" == "null" ]]; then
exact_version="${version}"
fi
url=$(jq <<<"${template}" -r '.url')
url="${url//\$\{version\}/${exact_version}}"
bin_dir=$(jq <<<"${template}" -r '.bin_dir')