2021-09-07 10:54:33 +03:00
|
|
|
set -euo pipefail
|
|
|
|
|
2021-06-28 12:52:20 +03:00
|
|
|
export PATH="$(git rev-parse --show-toplevel)/bin:$PATH"
|
|
|
|
|
2021-09-07 10:49:39 +03:00
|
|
|
fetch() {
|
|
|
|
direnv fetchurl "https://github.com/bazelbuild/bazelisk/releases/download/v1.10.1/bazelisk-$1-$2" "$3"
|
|
|
|
}
|
2021-09-06 17:02:17 +03:00
|
|
|
|
2021-09-07 10:49:39 +03:00
|
|
|
case "$(uname | tr A-Z a-z)-$(uname -m)" in
|
|
|
|
linux-x86_64)
|
|
|
|
bzl=$(fetch linux amd64 sha256-TLU0xSzdR6YiPUWW1TDnyceFQ4qzsKSf80fpkcIQss0=);;
|
|
|
|
linux-aarch64)
|
|
|
|
bzl=$(fetch linux arm64 sha256-wd5oYN1PjV4uwnAJe9RtaiEblxoLizhVl4S9BR6pUKE=);;
|
|
|
|
darwin-x86_64)
|
|
|
|
bzl=$(fetch darwin arm64 sha256-wi1IYBRm2dOwQ8zXQFHy9CMPm59FCfCXAXyXMDqojRM=);;
|
|
|
|
darwin-aarch64)
|
|
|
|
bzl=$(fetch darwin arm64 sha256-5IW7+EUy0CpgsOsjxwJhC1QI3zoZkIek8rXgmVu/LVo=);;
|
2021-09-06 17:11:11 +03:00
|
|
|
*)
|
2021-09-07 10:49:39 +03:00
|
|
|
>&2 echo "unsupported architecture tuple $(uname | tr A-Z a-z)-$(uname -m)"
|
2021-09-06 17:11:11 +03:00
|
|
|
exit 1;;
|
2021-09-06 17:02:17 +03:00
|
|
|
esac
|
|
|
|
|
2021-09-07 10:49:39 +03:00
|
|
|
chmod a+x "${bzl}"
|
|
|
|
ln -sf "${bzl}" bin/bazel
|