Advertisement
tyler569

zig update script

Apr 12th, 2019
421
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.53 KB | None | 0 0
  1. #!/usr/bin/sh
  2.  
  3. NOW=$(date -Iseconds)
  4. VERSIONS="/tmp/zig-versions-$NOW"
  5. DOWNLOAD="/tmp/zig-download-$NOW"
  6.  
  7. curl -s https://ziglang.org/download/index.json > $VERSIONS
  8.  
  9. VERSION=$(jq '.master."x86_64-linux".tarball' $VERSIONS | sed 's/.*\(zig.*\)\.tar.xz.*/\1/g')
  10.  
  11. echo "installing $VERSION"
  12.  
  13. LINUX_BIN=$(jq '.master."x86_64-linux".tarball' $VERSIONS | tr -d "\"")
  14.  
  15. curl -s $LINUX_BIN > $DOWNLOAD
  16.  
  17. cd /tmp
  18. tar xf $DOWNLOAD
  19. cd $OLDPWD
  20.  
  21. cp "/tmp/$VERSION/zig" "$HOME/bin"
  22. cp -r "/tmp/$VERSION/lib/zig" "$HOME/lib"
  23.  
  24. echo done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement