Skip to content

Commit

Permalink
Fix install.sh script if curl is not present (#414)
Browse files Browse the repository at this point in the history
At least with bash 5.0.18, GNU Wget 1.20.3 and GNU Awk 5.1.0 the wget installation methods fails because the awk regex does not match the location header. In these versions, instead of `/^  Location:...` it must be `/^Location:...`. In order to retain compatibility with other versions having a different behavior, I changed it to `/^\s*Location:...`.

Signed-off-by: Bastian Hofmann <bashofmann@gmail.com>
  • Loading branch information
bashofmann authored Nov 26, 2020
1 parent 2d8d60b commit 13470c0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ checkLatestVersion() {
if type "curl" > /dev/null; then
TAG=$(curl -Ls -o /dev/null -w %{url_effective} $latest_release_url | grep -oE "[^/]+$" )
elif type "wget" > /dev/null; then
TAG=$(wget $latest_release_url --server-response -O /dev/null 2>&1 | awk '/^ Location: /{DEST=$2} END{ print DEST}' | grep -oE "[^/]+$")
TAG=$(wget $latest_release_url --server-response -O /dev/null 2>&1 | awk '/^\s*Location: /{DEST=$2} END{ print DEST}' | grep -oE "[^/]+$")
fi
}

Expand Down

0 comments on commit 13470c0

Please sign in to comment.