2017-09-07 18:49:22 +00:00
|
|
|
#!/usr/bin/env bash
|
2023-04-10 15:36:59 +00:00
|
|
|
# Copyright (c) HashiCorp, Inc.
|
|
|
|
# SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
2017-09-07 18:49:22 +00:00
|
|
|
|
|
|
|
set -o errexit
|
|
|
|
|
2023-03-28 15:21:14 +00:00
|
|
|
# Minimal effort to support amd64 and arm64 installs.
|
|
|
|
ARCH=""
|
|
|
|
case $(arch) in
|
|
|
|
x86_64) ARCH="amd64" ;;
|
|
|
|
aarch64) ARCH="arm64" ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
VERSION=1.13.0
|
|
|
|
DOWNLOAD=https://releases.hashicorp.com/vault/${VERSION}/vault_${VERSION}_linux_${ARCH}.zip
|
2017-09-07 18:49:22 +00:00
|
|
|
|
|
|
|
function install_vault() {
|
|
|
|
if [[ -e /usr/bin/vault ]] ; then
|
|
|
|
if [ "v${VERSION}" = "$(vault version | head -n1 | awk '{print $2}')" ] ; then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2020-03-23 15:47:26 +00:00
|
|
|
curl -sSL --fail -o /tmp/vault.zip ${DOWNLOAD}
|
2017-09-07 18:49:22 +00:00
|
|
|
|
|
|
|
unzip -d /tmp /tmp/vault.zip
|
|
|
|
mv /tmp/vault /usr/bin/vault
|
|
|
|
chmod +x /usr/bin/vault
|
|
|
|
}
|
|
|
|
|
|
|
|
install_vault
|