2020-04-27 10:16:16 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
|
2020-05-01 03:24:55 +02:00
|
|
|
version=0.5.0-dev.4
|
2020-04-27 10:16:16 +02:00
|
|
|
tarball=semgrep-v$version-ubuntu-16.04.tgz
|
2020-05-01 03:24:55 +02:00
|
|
|
sha256=0696104dd08f507e6f7de0f7dadc50b532e75bd082729243e1220a87d27c5a2d
|
2020-04-27 10:16:16 +02:00
|
|
|
tarball_url=https://github.com/returntocorp/semgrep/releases/download/v$version/$tarball
|
|
|
|
|
|
|
|
check_version () {
|
|
|
|
out="$(semgrep --version 2>/dev/null)" && [ "$out" = "$version" ]
|
|
|
|
}
|
|
|
|
|
|
|
|
if ! check_version; then
|
|
|
|
tmpdir="$(mktemp -d)"
|
|
|
|
trap 'rm -r "$tmpdir"' EXIT
|
|
|
|
cd "$tmpdir"
|
|
|
|
wget -nv "$tarball_url"
|
|
|
|
sha256sum -c <<< "$sha256 $tarball"
|
2020-05-01 03:24:55 +02:00
|
|
|
tar -xzf "$tarball" -C /usr/local/lib/ semgrep-files/
|
2020-04-27 10:16:16 +02:00
|
|
|
ln -sf /usr/local/lib/semgrep-files/semgrep /usr/local/bin/semgrep
|
|
|
|
ln -sf /usr/local/lib/semgrep-files/semgrep-core /usr/local/bin/semgrep-core
|
2020-05-01 03:24:55 +02:00
|
|
|
|
|
|
|
# Clean old files from sgrep 0.4.9b5.
|
|
|
|
rm -rf /usr/local/lib/sgrep-lint-files /usr/local/bin/sgrep-lint /usr/local/bin/sgrep
|
|
|
|
|
|
|
|
check_version
|
2020-04-27 10:16:16 +02:00
|
|
|
fi
|