blob: 41d546d39fcd51ef10f400ca7cb4825fc442202c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#!/bin/bash
# deploy.sh: build the APK, install it on the TV over wireless adb and
# launch it. Finds the TV through its _adb-tls-connect mDNS record when no
# device is connected; wireless debugging must be on (it turns off on reboot).
#
# Copyright (C) 2026 Danilo M. <danix@danix.xyz>
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 as published
# by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
set -euo pipefail
cd "$(dirname "$0")"
pkg=mygram.droid
apk=app/build/outputs/apk/debug/mygram-droid-debug.apk
if ! adb get-state >/dev/null 2>&1; then
addr=$(avahi-browse -rtp _adb-tls-connect._tcp 2>/dev/null |
awk -F';' '/^=/ && $3 == "IPv4" {print $8 ":" $9; exit}')
[ -n "$addr" ] || { echo "no device: set ANDROID_SERIAL or enable wireless debugging" >&2; exit 1; }
adb connect "$addr" >/dev/null
export ANDROID_SERIAL=$addr
fi
./build.sh
adb install -r "$apk"
adb shell -n am start -n "$pkg/.MainActivity" >/dev/null
echo "deployed to ${ANDROID_SERIAL:-$(adb get-serialno)}"
|