diff options
author | Johannes Stoelp <johannes.stoelp@gmail.com> | 2024-12-18 22:45:02 +0100 |
---|---|---|
committer | Johannes Stoelp <johannes.stoelp@gmail.com> | 2025-02-07 21:54:55 +0100 |
commit | 139acf27d71e54f57f69659c9423f31e5b848c21 (patch) | |
tree | 29748cb96c76a01933616f4319d5260e906aff87 /setup.fish | |
parent | 9225c3bf291061a25dadbdfc5ec6eab72e86bb5e (diff) | |
download | zig-playground-139acf27d71e54f57f69659c9423f31e5b848c21.tar.gz zig-playground-139acf27d71e54f57f69659c9423f31e5b848c21.zip |
setup: allow passing locating to already downloaded zig version
Diffstat (limited to 'setup.fish')
-rw-r--r-- | setup.fish | 31 |
1 files changed, 19 insertions, 12 deletions
@@ -1,19 +1,26 @@ -curl -s https://ziglang.org/download/index.json -o index.json -or exit 1 +if test -z $argv[1] + curl -s https://ziglang.org/download/index.json -o index.json + or exit 1 -set DLLINK (cat index.json | jq -r '.master ."x86_64-linux" .tarball') -set SHASUM (cat index.json | jq -r '.master ."x86_64-linux" .shasum') + set DLLINK (cat index.json | jq -r '.master ."x86_64-linux" .tarball') + set SHASUM (cat index.json | jq -r '.master ."x86_64-linux" .shasum') -rm -f index.json + rm -f index.json -set TARBALL (echo $DLLINK | awk -F '/' '{ print $NF }') -set ZIGDIR (echo $TARBALL | sed 's/.tar.xz//') + 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 + 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 +else + set ZIGDIR $argv[1] + + test -d $ZIGDIR + or exit 3 end echo "SETUP $ZIGDIR" |