2020-11-17 15:01:48 +00:00
|
|
|
#!/usr/bin/env bash
|
2023-04-10 15:36:59 +00:00
|
|
|
# Copyright (c) HashiCorp, Inc.
|
|
|
|
# SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
2020-11-17 15:01:48 +00:00
|
|
|
|
|
|
|
set -o errexit
|
|
|
|
|
|
|
|
# Make sure you grab the latest version
|
2021-02-01 01:09:15 +00:00
|
|
|
VERSION=0.36.0
|
2020-11-17 15:01:48 +00:00
|
|
|
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
|