Skip to content

Commit

Permalink
adjust latest version calc to use wget and simplified awk
Browse files Browse the repository at this point in the history
  • Loading branch information
robertpeteuil committed Apr 11, 2018
1 parent 003fdf8 commit f494b8c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions terraform-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
# sudoInstall=true

scriptname=$(basename "$0")
scriptbuildnum="1.1.2"
scriptbuilddate="2018-02-17"
scriptbuildnum="1.1.3"
scriptbuilddate="2018-04-11"

LATEST=$(wget -q -O- https://releases.hashicorp.com/index.json 2>/dev/null | jq -r '.terraform.versions[].version' | sort --version-sort -r | head -n 1)
LATEST=$(wget -q -O- https://api.github.com/repos/hashicorp/terraform/releases/latest 2> /dev/null | awk '/tag_name/ {print $2}' | cut -d '"' -f 2 | cut -d 'v' -f 2)

displayVer() {
echo -e "${scriptname} ver ${scriptbuildnum} - ${scriptbuilddate}"
Expand All @@ -25,7 +25,7 @@ usage() {
[[ "$1" ]] && echo -e "Download and Install Terraform - Latest Version unless '-i' specified\n"
echo -e "usage: ${scriptname} [-i VERSION] [-h] [-v]"
echo -e " -i VERSION\t: specify version to install in format '$LATEST' (OPTIONAL)"
echo -e " -a\t\t: always use sudo to install to \\usr\\local\\bin\\"
echo -e " -a\t\t: automatically use sudo to install to /usr/local/bin"
echo -e " -h\t\t: help"
echo -e " -v\t\t: display ${scriptname} version"
}
Expand Down

0 comments on commit f494b8c

Please sign in to comment.