Skip to content

Commit

Permalink
fix links and ci
Browse files Browse the repository at this point in the history
  • Loading branch information
jiacai2050 committed Sep 17, 2024
1 parent 8ed3437 commit 1f4151c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 3 additions & 4 deletions bin/install
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}
Expand Down

0 comments on commit 1f4151c

Please sign in to comment.