2018-12-18 02:08:53 +01:00
|
|
|
#!/usr/bin/env bash
|
2018-08-03 02:09:42 +02:00
|
|
|
set -eu
|
|
|
|
|
2019-11-11 23:43:52 +01:00
|
|
|
version=0.7.0
|
2020-03-31 21:29:25 +02:00
|
|
|
tarball="shellcheck-v$version.linux.x86_64.tar.xz"
|
|
|
|
sha256=39c501aaca6aae3f3c7fc125b3c3af779ddbe4e67e4ebdc44c2ae5cba76c847f
|
2018-08-03 02:09:42 +02:00
|
|
|
|
2020-04-22 05:09:57 +02:00
|
|
|
check_version () {
|
|
|
|
out="$(shellcheck --version 2>/dev/null)" && [[ "$out" = *"
|
2018-08-03 02:09:42 +02:00
|
|
|
version: $version
|
2020-04-22 05:09:57 +02:00
|
|
|
"* ]]
|
|
|
|
}
|
|
|
|
|
|
|
|
if ! check_version; then
|
2018-08-03 02:09:42 +02:00
|
|
|
tmpdir="$(mktemp -d)"
|
|
|
|
trap 'rm -r "$tmpdir"' EXIT
|
|
|
|
cd "$tmpdir"
|
2020-03-31 21:29:25 +02:00
|
|
|
wget -nv "https://storage.googleapis.com/shellcheck/$tarball"
|
|
|
|
sha256sum -c <<< "$sha256 $tarball"
|
|
|
|
tar -xJf "$tarball" --no-same-owner --strip-components=1 -C /usr/local/bin "shellcheck-v$version/shellcheck"
|
2020-04-22 05:09:57 +02:00
|
|
|
check_version
|
2018-08-03 02:09:42 +02:00
|
|
|
fi
|