aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoruser <user@clank>2026-07-11 21:09:45 +0200
committeruser <user@clank>2026-07-11 21:09:45 +0200
commit4e68fbb9e052d874704162254a07a854e9dcc82e (patch)
tree2e5573401d002f303910eb7d87b6b8c4065dcd57
parentdrive: make `dis` drive the live UI too (generalize _show_decomp -> _show_view) (diff)
downloadida-tui-4e68fbb9e052d874704162254a07a854e9dcc82e.tar.gz
ida-tui-4e68fbb9e052d874704162254a07a854e9dcc82e.tar.xz
ida-tui-4e68fbb9e052d874704162254a07a854e9dcc82e.zip
spawn.sh: run location-independent + env-configurable host/port/target
-rwxr-xr-xspawn.sh18
1 files changed, 15 insertions, 3 deletions
diff --git a/spawn.sh b/spawn.sh
index 9db8310..a8763ae 100755
--- a/spawn.sh
+++ b/spawn.sh
@@ -1,12 +1,24 @@
#!/bin/sh
# Start the ida-pro-mcp supervisor. IDA_MCP_MAX_WORKERS raises the ceiling on
# concurrently-open binaries (default 4); idle workers self-exit and free slots.
+#
+# Location-independent: resolves paths relative to this script, not $PWD, so it
+# behaves the same whether run by hand or from the systemd unit (see
+# systemd/idatui-mcp.service).
+set -eu
+
+SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
+
+IDA_MCP_HOST="${IDA_MCP_HOST:-127.0.0.1}"
+IDA_MCP_PORT="${IDA_MCP_PORT:-8745}"
+IDA_MCP_TARGET="${IDA_MCP_TARGET:-$SCRIPT_DIR/bin/ls}"
# Ensure idatui's extra server tools (del_type, needed by the struct editor) are
# present in the installed ida-pro-mcp. Idempotent; patches the api_types.py that
# the /usr/bin/python workers import. See server/patch_server.py.
-/usr/bin/python "$(dirname "$0")/server/patch_server.py" || \
+/usr/bin/python "$SCRIPT_DIR/server/patch_server.py" || \
echo "warn: server patch skipped (del_type may be unavailable)"
-IDA_MCP_MAX_WORKERS="${IDA_MCP_MAX_WORKERS:-8}" \
- uv run idalib-mcp --host 127.0.0.1 --port 8745 $(pwd)/bin/ls
+cd "$SCRIPT_DIR"
+exec env IDA_MCP_MAX_WORKERS="${IDA_MCP_MAX_WORKERS:-8}" \
+ uv run idalib-mcp --host "$IDA_MCP_HOST" --port "$IDA_MCP_PORT" "$IDA_MCP_TARGET"