mirror of https://github.com/linkerd/linkerd2.git
32 lines
668 B
Bash
Executable File
32 lines
668 B
Bash
Executable File
#!/bin/sh
|
|
|
|
set -eu
|
|
|
|
if [ "$(uname -s)" = Darwin ]; then
|
|
os=osx
|
|
else
|
|
os=linux
|
|
fi
|
|
arch=$(uname -m)
|
|
|
|
bindir=$( cd "${0%/*}" && pwd )
|
|
targetbin=$( cd "$bindir"/.. && pwd )/target/bin
|
|
protocversion=3.6.0
|
|
protocbin=$targetbin/protoc-$protocversion
|
|
protocurl=https://github.com/google/protobuf/releases/download/v$protocversion/protoc-$protocversion-$os-$arch.zip
|
|
|
|
if [ ! -f "$protocbin" ]; then
|
|
tmp=$(mktemp -d -t protoc.XXX)
|
|
mkdir -p "$targetbin"
|
|
(
|
|
cd "$tmp"
|
|
curl -L --silent --fail -o "./protoc.zip" "$protocurl"
|
|
unzip -q "./protoc.zip" bin/protoc
|
|
chmod +x bin/protoc
|
|
)
|
|
mv "$tmp/bin/protoc" "$protocbin"
|
|
rm -rf "$tmp"
|
|
fi
|
|
|
|
"$protocbin" "$@"
|