Files
packages/anda/langs/zig/bootstrap/setup.sh
T
Gilver 63bf041bd3 feat(zig-master{,-bootstrap}): Better mirror handling, refactor bootstrapping (#7503) (#7779)
* feat(zig-master{,-bootstrap}): Automatically update mirrors

* ?

* Embarrassing



* feat: Use pre.rhai

* A

* AAAA

* feat: Let's try this

* cleanup: Wh

* Aaaaaa

* dfhsdfhjsdfdjkh

* dfhsdfhjsdfdjkh

* dfhsdfhjsdfdjkh

* ???

* ???

* fdhdfssdfhjkksdfhj

* Man

* Maybe this will fix sed

* dshfhjfsdjhk

* Hmm

* Double backslash??

* Locally this works

* Noooo

* feat: Changelog

* feat: Update script

* fix: A

* fix: Copypaste idiot moment

* cleanup: Actually not sure that is needed

* chore: terra-obsoletes

* cleanup: Weird whitespace

* This is a way better idea

---------


(cherry picked from commit 8f937512cf)

Signed-off-by: Gilver <rockgrub@disroot.org>
Signed-off-by: GildedRoach <GildedRoach@users.noreply.github.com>
2025-11-29 09:37:40 -06:00

37 lines
1010 B
Bash
Executable File

#!/usr/bin/bash
version=0.16.0-dev.1484+d0ba6642b
mirrors=()
for mirror in $(curl -s https://ziglang.org/download/community-mirrors.txt); do
mirrors+=($mirror)
done
# Self explanatory
function randomize_mirrors() {
number=${#mirrors[@]}
index=$(( RANDOM % number ))
mirror=${mirrors[$index]}
}
if [ "$1" == "fetch" ]; then
until curl -If ${mirror}/zig-${version}.tar.xz &>/dev/null && curl -If ${mirror}/zig-${version}.tar.xz.minisig &>/dev/null; do
randomize_mirrors
done
echo -e "\033[0;32mNote:\033[0m Selected mirror $mirror"
curl -A "rpmdev-spectool" -H "Accept-Encoding: identity" -O ${mirror}/zig-${version}.tar.xz
curl -A "rpmdev-spectool" -H "Accept-Encoding: identity" -O ${mirror}/zig-${version}.tar.xz.minisig
elif [ "$1" == "version" ]; then
echo $version
# Grab a random mirror. For debugging purposes.
elif [ "$1" == "mirror" ]; then
randomize_mirrors
echo "Your random mirror is $mirror"
elif [ "$1" == "mirrors" ]; then
echo "$mirrors"
fi
exit 0