]> git.sven.stormbind.net Git - sven/scripts.git/commitdiff
fix terraform downloader script location header parsing
authorSven Höxter <sven.hoexter@rewe-digital.com>
Mon, 2 Mar 2020 12:42:50 +0000 (13:42 +0100)
committerSven Höxter <sven.hoexter@rewe-digital.com>
Mon, 2 Mar 2020 12:42:50 +0000 (13:42 +0100)
Seems github implemented http2 somewhere and now the location header
is lower case.

artifactory/terraform-dl.sh

index 19e5e3465aa5a8c79ad072a90bb2947e6700d8a4..f62be23d0eba5416b392d1e3f06c8766465678f4 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 LATEST_LINK="https://github.com/hashicorp/terraform/releases/latest"
-VERSION="$(curl -si ${LATEST_LINK} | grep Location | grep -Po '[0-9]\.[0-9]{1,2}\.[0-9]+')"
+VERSION="$(curl -sI ${LATEST_LINK} | grep -i '^Location' | grep -Po '[0-9]\.[0-9]{1,2}\.[0-9]+')"
 BASE_DOWNLOAD="https://releases.hashicorp.com/terraform/${VERSION}/"
 ARCH="amd64"
 OS="linux"