Files

48 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
# run.sh — build (if needed) and launch the signer, or pass any arguments
# straight through to the binary.
#
# Usage:
# ./run.sh # interactive mode (GUI on a display, TUI otherwise)
# ./run.sh --tui # force the terminal TUI
# ./run.sh --gui # force the egui GUI
# ./run.sh --listen http:127.0.0.1:11111 # headless HTTP mode
# ./run.sh client <request> # send a JSON-RPC request to a running signer
# ./run.sh bridge # stateless qrexec → unix-socket relay
# ./run.sh list # list running signer abstract sockets
# ./run.sh test # run the test suite
# ./run.sh client-help # signer-client help
set -e
# Resolve the directory this script lives in so it works from anywhere
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
BIN="target/debug/signer"
# Always run cargo build: it is a no-op when up-to-date (and correctly
# rebuilds after feature-flag flips, e.g. a --no-default-features build
# that left a headless binary behind).
if [ ! -x "$BIN" ]; then
echo "[run.sh] Building..."
fi
cargo build > /dev/null
if [ ! -x "$BIN" ]; then
echo "[run.sh] Build failed" >&2
exit 1
fi
# Test passthrough
if [ "${1:-}" = "test" ]; then
shift
exec cargo test "$@"
fi
# Client-help passthrough
if [ "${1:-}" = "client-help" ]; then
exec ./target/debug/signer-client --help
fi
exec "$BIN" "$@"