Skip to content

Commit

Permalink
Merge pull request #13 from Bandwidth/SWI-4080
Browse files Browse the repository at this point in the history
SWI-4080: Error checking
  • Loading branch information
rdinardi-bw authored Oct 7, 2024
2 parents 8eee525 + 783aef0 commit fc228fa
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion vault-shim-installer.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
#!/bin/sh
version=$1

if [ -z "$version" ]; then
echo "Usage: $0 <version>"
exit 1
fi

# check if the version starts without a 'v', if so, add it
if [ "${version:0:1}" != "v" ]; then
version="v$version"
fi

# turn to all lowercase and then capitalize the first letter of the OS name
os="$(uname -s | tr '[:upper:]' '[:lower:]' | awk '{ print toupper(substr($0, 1, 1)) substr($0, 2) }')"
arch="$(uname -m | tr '[:upper:]' '[:lower:]')"
Expand All @@ -14,5 +24,5 @@ echo "Installing vault-shim version $version"
echo "os: $os"
echo "arch: $arch"

curl -L "https://github.com/Bandwidth/vault-shim/releases/download/v${version}/vault-shim_${os}_${arch}.tar.gz" --output "/usr/local/bin/vault-shim_${os}_${arch}.tar.gz"
curl -L "https://github.com/Bandwidth/vault-shim/releases/download/${version}/vault-shim_${os}_${arch}.tar.gz" --output "/usr/local/bin/vault-shim_${os}_${arch}.tar.gz"
tar xzf "/usr/local/bin/vault-shim_${os}_${arch}.tar.gz" -C "/usr/local/bin"

0 comments on commit fc228fa

Please sign in to comment.