#!/usr/bin/env bash set -euo pipefail version=1.58.0 archive="just-${version}-x86_64-unknown-linux-musl.tar.gz" release="https://github.com/casey/just/releases/download/${version}" manifest_sha256=a2e7355b6882af86f46e86faf1150992d4326c131e697bdf2e7c95aebdff55cb workspace="${1:-$PWD/.just}" mkdir -p "${workspace}" curl --fail --location --silent --show-error "${release}/SHA256SUMS" -o "${workspace}/SHA256SUMS" printf '%s %s\n' "${manifest_sha256}" "${workspace}/SHA256SUMS" | sha256sum --check --status curl --fail --location --silent --show-error "${release}/${archive}" -o "${workspace}/${archive}" ( cd "${workspace}" grep -F " ${archive}" SHA256SUMS | sha256sum --check --status tar -xzf "${archive}" just chmod 755 just )