mirror of https://github.com/zulip/zulip.git
22 lines
544 B
Bash
Executable File
22 lines
544 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -eu
|
|
|
|
version=3.2.1
|
|
binary="shfmt_v${version}_linux_amd64"
|
|
sha256=43439b996942b53dfafa9b6ff084f394555d049c98fb7ec37978f7668b43e1be
|
|
|
|
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"
|
|
wget -nv "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
|