Skip to content

Commit

Permalink
Error checking and README fix
Browse files Browse the repository at this point in the history
  • Loading branch information
rdinardi-bw committed Oct 7, 2024
1 parent d69a254 commit a9f9459
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 a9f9459

Please sign in to comment.