summaryrefslogtreecommitdiff
path: root/setup.fish
diff options
context:
space:
mode:
Diffstat (limited to 'setup.fish')
-rw-r--r--setup.fish23
1 files changed, 16 insertions, 7 deletions
diff --git a/setup.fish b/setup.fish
index e4d125d..9bb4561 100644
--- a/setup.fish
+++ b/setup.fish
@@ -1,11 +1,20 @@
-set -l BASE zig-linux-x86_64-0.14.0-dev.130+cb308ba3a
+curl -s https://ziglang.org/download/index.json -o index.json
+or exit 1
-echo "SETUP $BASE"
+set DLLINK (cat index.json | jq -r '.master ."x86_64-linux" .tarball')
+set SHASUM (cat index.json | jq -r '.master ."x86_64-linux" .shasum')
-if ! test -d $BASE
- wget --no-clobber https://ziglang.org/builds/$BASE.tar.xz
- tar xf $BASE.tar.xz
- rm -f $BASE.tar.xz
+rm -f index.json
+
+set TARBALL (echo $DLLINK | awk -F '/' '{ print $NF }')
+set ZIGDIR (echo $TARBALL | sed 's/.tar.xz//')
+
+if ! test -d $ZIGDIR
+ wget -q --show-progress --no-clobber $DLLINK
+ and shasum -a 256 -c (echo "$SHASUM $TARBALL" | psub)
+ and tar xf $TARBALL
+ or exit 2
end
-fish_add_path --path (pwd)/$BASE
+echo "SETUP $ZIGDIR"
+fish_add_path --path (pwd)/$ZIGDIR