Skip to content
quarry Artifact [d11b984577]
Login

Artifact [d11b984577]

Artifact d11b9845771e8c71da575c20fbcf969be161b91a20a12d645621ba397e441315:


#!/bin/sh
# runner-check.sh DIR [BUILD_SCRIPT]
#
# Is DIR a complete set of quarry-runner downloads — every platform
# BUILD_SCRIPT (default: build-linux.sh beside this script) builds, each
# listed in SHA256SUMS, and the sums verify? Exit 0 if so; otherwise
# exit 1 with the reason on stdout. deploy.sh publishes a runner set only
# when this says yes: a cross-build that failed for one platform stops
# build-linux.sh part-way, leaving some binaries and no SHA256SUMS, and
# publishing that dropped four downloads from the forge.
set -eu
dir=${1:?usage: runner-check.sh DIR [BUILD_SCRIPT]}
build=${2:-$(dirname "$0")/build-linux.sh}
targets=$(sed -n 's/^RUNNER_TARGETS="\(.*\)"$/\1/p' "$build")
[ -n "$targets" ] || { echo "no RUNNER_TARGETS line in $build"; exit 1; }
[ -f "$dir/SHA256SUMS" ] || { echo "no SHA256SUMS in $dir"; exit 1; }
missing=
for t in $targets; do
  os=${t%/*}; arch=${t#*/}; ext=; [ "$os" = windows ] && ext=.exe
  f=quarry-runner-$os-$arch$ext
  if [ ! -s "$dir/$f" ]; then
    missing="$missing $f"
  elif ! grep -q "  $f\$" "$dir/SHA256SUMS"; then
    missing="$missing $f(not in SHA256SUMS)"
  fi
done
[ -z "$missing" ] || { echo "missing:$missing"; exit 1; }
( cd "$dir" && sha256sum -c --quiet SHA256SUMS ) >/dev/null 2>&1 || { echo "SHA256SUMS does not verify"; exit 1; }