forked from elastic/beats
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure install scripts only install if needed (elastic#20349)
* Ensure install scripts only install once * Add unmet dep str
- Loading branch information
Showing
4 changed files
with
85 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env bash | ||
set -exuo pipefail | ||
|
||
MSG="environment variable missing." | ||
DEFAULT_HOME="/usr/local" | ||
KIND_VERSION=${KIND_VERSION:?$MSG} | ||
HOME=${HOME:?$DEFAULT_HOME} | ||
KIND_CMD="${HOME}/bin/kind" | ||
|
||
if command -v kind | ||
then | ||
echo "Found Kind. Checking version.." | ||
FOUND_KIND_VERSION=$(kind --version 2>&1 >/dev/null | awk '{print $3}') | ||
if [ $FOUND_KIND_VERSION == $KIND_VERSION ] | ||
then | ||
echo "Versions match. No need to install Kind. Exiting." | ||
exit 0 | ||
fi | ||
fi | ||
|
||
echo "UNMET DEP: Installing Kind" | ||
|
||
mkdir -p "${HOME}/bin" | ||
|
||
curl -sSLo "${KIND_CMD}" "https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-linux-amd64" | ||
chmod +x "${KIND_CMD}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -exuo pipefail | ||
|
||
MSG="environment variable missing." | ||
TERRAFORM_VERSION=${TERRAFORM_VERSION:?$MSG} | ||
HOME=${HOME:?$MSG} | ||
TERRAFORM_CMD="${HOME}/bin/terraform" | ||
|
||
OS=$(uname -s | tr '[:upper:]' '[:lower:]') | ||
|
||
if command -v terraform | ||
then | ||
echo "Found Terraform. Checking version.." | ||
FOUND_TERRAFORM_VERSION=$(terraform --version | awk '{print $2}' | sed s/v//) | ||
if [ $FOUND_TERRAFORM_VERSION == $TERRAFORM_VERSION ] | ||
then | ||
echo "Versions match. No need to install Terraform. Exiting." | ||
exit 0 | ||
fi | ||
fi | ||
|
||
echo "UNMET DEP: Installing Terraform" | ||
|
||
mkdir -p "${HOME}/bin" | ||
|
||
curl -sSLo - "https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_${OS}_amd64.zip" > ${TERRAFORM_CMD}.zip | ||
unzip -o ${TERRAFORM_CMD}.zip -d $(dirname ${TERRAFORM_CMD}) | ||
rm ${TERRAFORM_CMD}.zip | ||
|
||
chmod +x "${TERRAFORM_CMD}" |