Skip to content
This repository has been archived by the owner on Jan 25, 2023. It is now read-only.

feat(install-vault): add multiarch support #254

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion modules/install-vault/install-vault
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,30 @@ function fetch_binary {
local -r version="$1"
local download_url="$2"

local cpu_arch
cpu_arch="$(uname -m)"
local binary_arch=""
case "$cpu_arch" in
x86_64)
binary_arch="amd64"
;;
x86)
binary_arch="386"
;;
arm64|aarch64)
binary_arch="arm64"
;;
arm*)
binary_arch="arm"
;;
*)
log_error "CPU architecture $cpu_arch is not a supported by Vault."
exit 1
;;
esac

if [[ -z "$download_url" && -n "$version" ]]; then
download_url="https://releases.hashicorp.com/vault/${version}/vault_${version}_linux_amd64.zip"
download_url="https://releases.hashicorp.com/vault/${version}/vault_${version}_linux_${binary_arch}.zip"
fi

retry \
Expand Down