mirror of https://github.com/zulip/zulip.git
33 lines
779 B
Bash
Executable File
33 lines
779 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -eu
|
|
|
|
version=3.3.0
|
|
arch="$(uname -m)"
|
|
|
|
case $arch in
|
|
"x86_64")
|
|
binary="shfmt_v${version}_linux_amd64"
|
|
sha256=9ad8751cea92e0ffbfd6bb72208434f3a86e7319fd10b56def204c24ee1d9fde
|
|
;;
|
|
|
|
"aarch64")
|
|
binary="shfmt_v${version}_linux_arm64"
|
|
sha256=abf9bbc7027f5f5ba691bc48a55a2fc531c05ea88245ede989d67199687cadb5
|
|
;;
|
|
esac
|
|
|
|
check_version() {
|
|
out="$(shfmt --version 2>/dev/null)" && [ "$out" = "v$version" ]
|
|
}
|
|
|
|
if ! check_version; then
|
|
tmpdir="$(mktemp -d)"
|
|
trap 'rm -r "$tmpdir"' EXIT
|
|
cd "$tmpdir"
|
|
curl -fLO "https://github.com/mvdan/sh/releases/download/v$version/$binary"
|
|
sha256sum -c <<<"$sha256 $binary"
|
|
chmod +x "$binary"
|
|
mv "$binary" /usr/local/bin/shfmt
|
|
check_version
|
|
fi
|