23 lines
468 B
Bash
23 lines
468 B
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
if [ "$#" -lt 1 ]; then
|
|
echo "usage: scripts/host_tool.sh TOOL [ARG...]" >&2
|
|
exit 64
|
|
fi
|
|
|
|
TOOL=$1
|
|
shift
|
|
|
|
if command -v "$TOOL" >/dev/null 2>&1; then
|
|
exec "$TOOL" "$@"
|
|
fi
|
|
|
|
if [ -f /.flatpak-info ] && command -v flatpak-spawn >/dev/null 2>&1; then
|
|
exec flatpak-spawn --host "$TOOL" "$@"
|
|
fi
|
|
|
|
echo "required tool not found: $TOOL" >&2
|
|
echo "Install it on the host, or run from a terminal where $TOOL is on PATH." >&2
|
|
exit 127
|