diff --git a/README.md b/README.md index 7368eda..e4032b2 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ Currently there are(same with [setup-zig](https://github.com/mlugg/setup-zig/blo You can also configure where to download `index.json` with `ASDF_ZIG_INDEX_URL` env var, it's https://ziglang.org/download/index.json by default. Availables: -- https://liujiacai.net/zigbuilds/index.json +- https://fs.liujiacai.net/zigbuilds/index.json ## License diff --git a/bin/install b/bin/install index 49888da..889e647 100755 --- a/bin/install +++ b/bin/install @@ -36,6 +36,7 @@ download_and_check() { local output=$2 local expected_shasum=$3 + echo "Download from $download_url" curl --fail --progress-bar --location --create-dirs --output "$output" "$url" local actual_shasum @@ -57,16 +58,14 @@ download_zig() { local start_index=$((RANDOM % mirror_length)) # Loop through the mirrors for i in $(seq 0 $((mirror_length - 1))); do - current_index=$(( (start_index + i) % mirror_length )) + current_index=$(((start_index + i) % mirror_length)) local current_mirror=${mirrors[$current_index]} local current_url="${current_mirror}/${filename}?source=zigcc-asdf-zig" - echo "Download from mirror $current_url" download_and_check "${current_url}" "$source_path" "$expected_shasum" && return 0 done - echo "Download $download_url" - if ! download_and_check "$download_url" "$source_path" "$expected_shasum";then + if ! download_and_check "$download_url" "$source_path" "$expected_shasum"; then fail "Checksum not same, expected: ${expected_shasum}, actual: ${actual_shasum}, file: ${source_path}" fi }