| | @@ -7,11 +7,14 @@ |
| 7 | 7 | # raz can always be built again from source alone. |
| 8 | 8 | # |
| 9 | 9 | # The tarball is taken from build/boot/ if it is there; else from the |
| 10 | | -# GitHub release, by curl, or by gh's REST API where the repository is |
| 11 | | -# private and gh has a token; a machine with no network has it put |
| 12 | | -# there by hand. Its raz goes to build/boot/raz, with this repository's |
| 13 | | -# lib/ beside it, since src/ is built against today's library. Run from |
| 14 | | -# the repository root, by make. |
| 10 | +# website's downloads in this checkout, site/public/download/, where |
| 11 | +# every release is kept; else from the GitHub release, by curl, or by |
| 12 | +# gh's REST API where the repository is private and gh has a token; else |
| 13 | +# from the website, which serves the same bytes. A machine with no |
| 14 | +# network and no site/public has it put there by hand. The sum is |
| 15 | +# checked whichever it came from. Its raz goes to build/boot/raz, with |
| 16 | +# this repository's lib/ beside it, since src/ is built against today's |
| 17 | +# library. Run from the repository root, by make. |
| 15 | 18 | set -e |
| 16 | 19 | read tag sum < BOOT |
| 17 | 20 | v=${tag#v} |
| | @@ -19,11 +22,15 @@ |
| 19 | 22 | d=build/boot |
| 20 | 23 | repo=ldiaz94/raz |
| 21 | 24 | mkdir -p $d |
| 25 | +if [ ! -f $d/$t ] && [ -f site/public/download/$t ]; then |
| 26 | + cp site/public/download/$t $d/$t |
| 27 | +fi |
| 22 | 28 | if [ ! -f $d/$t ]; then |
| 23 | 29 | if ! curl -fsSL -o $d/$t https://github.com/$repo/releases/download/$tag/$t 2>/dev/null; then |
| 24 | 30 | id=$(gh api repos/$repo/releases/tags/$tag --jq ".assets[] | select(.name == \"$t\") | .id" 2>/dev/null) && |
| 25 | 31 | [ -n "$id" ] && |
| 26 | 32 | gh api -H 'Accept: application/octet-stream' repos/$repo/releases/assets/$id >$d/$t 2>/dev/null || |
| 33 | + curl -fsSL -o $d/$t https://raz.lucelad.workers.dev/download/$t 2>/dev/null || |
| 27 | 34 | { rm -f $d/$t; echo "boot: can't fetch $t; put it in $d" >&2; exit 1; } |
| 28 | 35 | fi |
| 29 | 36 | fi |