Skip to content

Instantly share code, notes, and snippets.

@deingithub
Created November 17, 2019 10:48
Show Gist options
  • Save deingithub/5b1efdd8d97d945934296c2ea2275d11 to your computer and use it in GitHub Desktop.
Save deingithub/5b1efdd8d97d945934296c2ea2275d11 to your computer and use it in GitHub Desktop.
Directly update to newest ziglang binary
#!/bin/sh
# requires sh, coreutils, curl, wget, jq, tar
# assumes ~/bin is in PATH
# zig tarball will be placed in ~/bin/zig-master/zig-commithash
# and the zig binary from there symlinked to ~/bin/zig
cd ~/bin
echo "deleting old symlink"
rm zig
echo "deleting old directory"
rm -rf zig-master
echo "downloading..."
mkdir zig-master
wget -O zig.tar.xz $(curl https://ziglang.org/download/index.json | jq -r ".master.\"x86_64-linux\".tarball")
echo "unpacking..."
tar -xvf zig.tar.xz -C zig-master
echo "deleting tarball"
rm zig.tar.xz
echo "creating symlink"
ln -s $(find zig-master/ -maxdepth 2 -name zig) zig
echo "done."⏎
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment