Skip to content

Instantly share code, notes, and snippets.

@aduzsardi
Last active January 3, 2018 14:54
Show Gist options
  • Save aduzsardi/5d7d57cc705213eb6d9553882c2b2998 to your computer and use it in GitHub Desktop.
Save aduzsardi/5d7d57cc705213eb6d9553882c2b2998 to your computer and use it in GitHub Desktop.
get latest hashicorp tools
#!/bin/bash
down_url=$(curl -s https://checkpoint-api.hashicorp.com/v1/check/$1 | jq -r .current_download_url)
product=$(curl -s https://checkpoint-api.hashicorp.com/v1/check/$1 | jq -r .product)
version=$(curl -s https://checkpoint-api.hashicorp.com/v1/check/$1 | jq -r .current_version)
os="linux_amd64"
wget ${down_url}${product}_${version}_${os}.zip
# There are a lot of inconsistencies in the resulting json answer between their products , so this will not work
# It serves just as a note to me , maybe they'll make it consistent between the tools and then you can run something like
# `./download consul` or `./download terraform` to download the latest version of these tools or products.
# In the meantime , it could be fixed with some `if else` and/or `case` statements
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment