aboutsummaryrefslogtreecommitdiffstats
path: root/deploy.sh
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-10-22 11:08:09 +0200
committerDanilo M. <danix@danix.xyz>2026-10-22 11:08:09 +0200
commit3605f4e081283b2f32451c7075fe07648e76e99d (patch)
tree71c44ba6c19a77ce470db2200d64c491ed155a27 /deploy.sh
parent765dcec1266fc1b63ccf48863f36425400d43dcf (diff)
downloadmygram-droid-3605f4e081283b2f32451c7075fe07648e76e99d.tar.gz
mygram-droid-3605f4e081283b2f32451c7075fe07648e76e99d.zip
Add Android project skeleton and Docker build
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'deploy.sh')
-rwxr-xr-xdeploy.sh34
1 files changed, 34 insertions, 0 deletions
diff --git a/deploy.sh b/deploy.sh
new file mode 100755
index 0000000..41d546d
--- /dev/null
+++ b/deploy.sh
@@ -0,0 +1,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)}"