aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/bash/function
diff options
context:
space:
mode:
authorpmikus <peter.mikus@protonmail.ch>2023-03-21 12:14:18 +0000
committerpmikus <peter.mikus@protonmail.ch>2023-03-21 12:14:18 +0000
commitab57fc1d356fd8eeb3f6bd25a6a7343d19153fec (patch)
treeab49bd73b2f220d88ec3f10be4f91b14a9f910a9 /resources/libraries/bash/function
parent9de00ab38a06ce8add7c46bedadd43eb44b4863c (diff)
fix(core): Arch detection
Signed-off-by: pmikus <peter.mikus@protonmail.ch> Change-Id: Ife3aed308cac696876316e4ad17f17e7993f96d0
Diffstat (limited to 'resources/libraries/bash/function')
-rw-r--r--resources/libraries/bash/function/terraform.sh16
1 files changed, 13 insertions, 3 deletions
diff --git a/resources/libraries/bash/function/terraform.sh b/resources/libraries/bash/function/terraform.sh
index e47f38937c..9d13a55990 100644
--- a/resources/libraries/bash/function/terraform.sh
+++ b/resources/libraries/bash/function/terraform.sh
@@ -101,13 +101,23 @@ function terraform_install () {
# Install terraform.
- terraform_version="1.4.2/terraform_1.4.2_linux_arm64.zip"
+ OS_ARCH=$(uname -m) || die "Failed to get arch."
+ case "${OS_ARCH}" in
+ x86_64) architecture="amd64" ;;
+ aarch64) architecture="arm64" ;;
+ esac
+
+ terraform_version="1.4.2/terraform_1.4.2_linux_${architecture}.zip"
terraform_url="https://releases.hashicorp.com/terraform"
terraform_link="${terraform_url}/${terraform_version}"
wget "${terraform_link}" || die "Failed to install Terraform!"
- unzip "terraform_1.4.2_linux_arm64.zip" || die "Failed to install Terraform!"
+ unzip "terraform_1.4.2_linux_${architecture}.zip" || {
+ die "Failed to install Terraform!"
+ }
mv "terraform" "/usr/local/bin" || die "Failed to install Terraform!"
- rm "terraform_1.4.2_linux_arm64.zip" || die "Failed to install Terraform!"
+ rm "terraform_1.4.2_linux_${architecture}.zip" || {
+ die "Failed to install Terraform!"
+ }
}