27 lines
479 B
Bash
Executable File
27 lines
479 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -o errexit
|
|
|
|
# Make sure you grab the latest version
|
|
VERSION=0.30.1
|
|
DOWNLOAD=https://github.com/bufbuild/buf/releases/download/v${VERSION}/buf-Linux-x86_64
|
|
|
|
function install() {
|
|
if command -v buf >/dev/null; then
|
|
if [ "${VERSION}" = "$(buf --version)" ] ; then
|
|
return
|
|
fi
|
|
fi
|
|
|
|
# Download
|
|
curl -sSL --fail "$DOWNLOAD" -o /tmp/buf
|
|
|
|
# make executable
|
|
chmod +x /tmp/buf
|
|
|
|
# Move buf to /usr/bin
|
|
mv /tmp/buf /usr/bin/buf
|
|
}
|
|
|
|
install
|