Skip to content

Commit

Permalink
check if jq is installed on install
Browse files Browse the repository at this point in the history
  • Loading branch information
acodeninja committed Jan 13, 2020
1 parent db8dfaf commit 038a355
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions scripts/install.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
GITHUB_REPO="simplecatsoftware/terraform-provider-remotefile"
DESTINATION_DIR="$HOME/.terraform.d/plugins/"
DESTINATION_FILE="terraform-provider-remotefile"

OS=$(uname | tr '[:upper:]' '[:lower:]')

echo "Finding latest release binaries from $REPO for $OS"

[[ $OS == "darwin" ]] && JQ_INSTALL_HELP="brew install jq"
[[ $OS == "linux" ]] && JQ_INSTALL_HELP="brew install jq"

hash jq 2>/dev/null || { echo >&2 "This install script requires jq to work. ($JQ_INSTALL_HELP) Aborting."; exit 1; }

echo "Finding latest release binaries from $GITHUB_REPO for $OS"
ASSETS_URL=$(curl -s "https://api.github.com/repos/$GITHUB_REPO/releases/latest" | grep "assets_url" | cut -d : -f 2,3 | tr -d \" | tr -d \,)

ASSET_URL=$(curl -L -s $ASSETS_URL | jq -r .[].browser_download_url | grep $OS)
Expand Down

0 comments on commit 038a355

Please sign in to comment.