Files
messageLogger/scripts/adb-connect.sh
T
exteraGramPlugins 80f1d5e55c Initial commit
2026-10-08 13:55:36 +00:00

32 lines
859 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")/.."
source scripts/lib.sh
need_cmd "$ADB" "$PY"
DEBUG=0
for arg in "$@"; do
case "$arg" in
--debug) DEBUG=1 ;;
*) die "unknown argument: $arg" ;;
esac
done
"$ADB" start-server
timeout 60 "$ADB" wait-for-device || die "timed out waiting for a device (ANDROID_SERIAL=${ANDROID_SERIAL:-<unset>})"
"$ADB" forward --remove "tcp:$DEV_PORT" >/dev/null 2>&1 || true
"$ADB" forward "tcp:$DEV_PORT" "tcp:$DEV_PORT"
if [[ "$DEBUG" -eq 1 ]]; then
"$ADB" forward --remove "tcp:$DEBUG_PORT" >/dev/null 2>&1 || true
"$ADB" forward "tcp:$DEBUG_PORT" "tcp:$DEBUG_PORT"
fi
if "$PY" tools/devclient.py ping >/dev/null 2>&1; then
echo "connected"
else
die "ping failed — is the plugin engine + developer mode enabled in exteraGram Preferences > Plugins?"
fi