generated from exteraGramPlugins/pluginBase
27 lines
634 B
Bash
27 lines
634 B
Bash
# Shared helpers for scripts/*.sh. Source, do not execute:
|
|
# source "$(dirname "${BASH_SOURCE[0]}")/lib.sh"
|
|
|
|
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
PKG=com.exteragram.messenger
|
|
DEV_PORT=42690
|
|
DEBUG_PORT=5678
|
|
PY="${PYTHON:-python3}"
|
|
ADB="${ADB:-adb}"
|
|
|
|
PLUGIN_ID="$("$PY" -c "import json,sys; print(json.load(open(sys.argv[1]))['id'])" "$REPO_ROOT/plugin.json")"
|
|
|
|
die() {
|
|
echo "error: $*" >&2
|
|
exit 1
|
|
}
|
|
|
|
need_cmd() {
|
|
for cmd in "$@"; do
|
|
command -v "$cmd" >/dev/null 2>&1 || die "required command not found on PATH: $cmd"
|
|
done
|
|
}
|
|
|
|
app_pid() {
|
|
"$ADB" shell pidof -s "$PKG" | tr -d '\r'
|
|
}
|