Update vault-user-token on version mismatch

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2017-07-06 14:18:45 +02:00
parent cfa20468ce
commit 01a2dce686
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E

View file

@ -3,17 +3,20 @@
set -e set -e
set -o pipefail set -o pipefail
function downloadVaultUserToken {
os=$(uname | awk '{print tolower($0)}')
curl -sSLfo ${HOME}/bin/vault-user-token \
https://github.com/Luzifer/vault-user-token/releases/download/${VAULT_USER_TOKEN_VERSION}/vault-user-token_${os}_amd64
chmod 0755 ${HOME}/bin/vault-user-token
}
source ${HOME}/.config/vault-user-token source ${HOME}/.config/vault-user-token
if ! (vault token-lookup 1>/dev/null 2>&1); then if ! (vault token-lookup 1>/dev/null 2>&1); then
echo "Vault is not authenticated, trying to authenticate... " echo "Vault is not authenticated, trying to authenticate... "
if ! [ -f ${HOME}/bin/vault-user-token ]; then [ -f ${HOME}/bin/vault-user-token ] || downloadVaultUserToken
os=$(uname | awk '{print tolower($0)}') ( test "$(${HOME}/bin/vault-user-token --version)" == "vault-user-token ${VAULT_USER_TOKEN_VERSION}" ) || downloadVaultUserToken
curl -sSLfo ${HOME}/bin/vault-user-token \
https://github.com/Luzifer/vault-user-token/releases/download/${VAULT_USER_TOKEN_VERSION}/vault-user-token_${os}_amd64
chmod 0755 ${HOME}/bin/vault-user-token
fi
${HOME}/bin/vault-user-token & ${HOME}/bin/vault-user-token &
VUT=$! VUT=$!