#!/bin/sh
# Run Standin from this kit: sh tools/standin/run <command>
# The program is not in the kit. If it is missing, see INSTALL.md in this folder.
set -eu
base=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
os=$(uname -s)
arch=$(uname -m)
case "$arch" in aarch64) arch=arm64 ;; amd64) arch=x86_64 ;; esac
platform="${os}_${arch}"
bin="$base/bin/$platform/standin"
if [ ! -f "$bin" ]; then
  echo "No Standin program for $platform yet. Follow $base/INSTALL.md (it downloads and checks one, after the person says yes)." >&2
  exit 3
fi
chmod u+x "$bin" 2>/dev/null || true
exec "$bin" "$@"
