mirror of
https://github.com/kennyp/asdf-golang.git
synced 2024-10-06 04:32:07 +08:00
Exit when download status 404 or 403 (#55)
This commit is contained in:
parent
625e8a23ce
commit
36f12c9393
10
bin/download
10
bin/download
@ -51,9 +51,15 @@ download_golang () {
|
||||
|
||||
platform=$(get_platform)
|
||||
arch=$(get_arch)
|
||||
download_url="https://dl.google.com/go/go${version}.${platform}-${arch}.tar.gz"
|
||||
|
||||
curl "https://dl.google.com/go/go${version}.${platform}-${arch}.tar.gz" -o "${download_path}/archive.tar.gz"
|
||||
curl "https://dl.google.com/go/go${version}.${platform}-${arch}.tar.gz.sha256" -o "${download_path}/archive.tar.gz.sha256"
|
||||
http_code=$(curl -I -w %{http_code} -s -o /dev/null $download_url)
|
||||
if [ $http_code -eq 404 ] || [ $http_code -eq 403 ]; then
|
||||
fail "URL: ${download_url} returned status ${http_code}"
|
||||
fi
|
||||
|
||||
curl $download_url -o "${download_path}/archive.tar.gz"
|
||||
curl "${download_url}.sha256" -o "${download_path}/archive.tar.gz.sha256"
|
||||
|
||||
echo 'verifying checksum'
|
||||
if ! check_shasum "${download_path}/archive.tar.gz" "${download_path}/archive.tar.gz.sha256"; then
|
||||
|
Loading…
Reference in New Issue
Block a user