28 lines
1.4 KiB
Bash
Executable File
28 lines
1.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
||
# Installs (or updates) simply-tv on the TV over the network with adb.
|
||
#
|
||
# scripts/install-tv.sh 192.168.1.50 # newest dist/simply-tv-*.apk
|
||
# scripts/install-tv.sh 192.168.1.50 file.apk
|
||
#
|
||
# On the TV first: Settings → System → About → press "Build" 7 times (developer mode),
|
||
# then Settings → System → Developer options → "Network debugging" (or "USB debugging") on.
|
||
# On the first connection the TV asks to allow this computer – choose "Always allow".
|
||
# adb runs in the builder container when it is not installed on the host.
|
||
set -euo pipefail
|
||
cd "$(dirname "$0")/.."
|
||
TV="${1:?usage: $0 <tv-address> [apk]}"
|
||
APK="${2:-$(ls -t dist/simply-tv-*.apk 2>/dev/null | head -1)}"
|
||
[ -f "$APK" ] || { echo "no APK – run scripts/build-apk.sh first" >&2; exit 1; }
|
||
case "$TV" in *:*) ;; *) TV="$TV:5555" ;; esac
|
||
|
||
STEPS="adb connect $TV && sleep 2 && adb -s $TV install -r '$APK' && adb -s $TV shell am start -n io.simplydvb.tv/.ui.MainActivity"
|
||
echo ">> connecting to $TV (confirm on the TV if asked) and installing $APK"
|
||
if command -v adb >/dev/null 2>&1; then
|
||
bash -c "$STEPS"
|
||
else
|
||
# one container for all steps (the adb server lives as long as the container)
|
||
docker run --rm --network host -v "$PWD":/src -v simply-tv-adb:/root/.android \
|
||
"${BUILDER_IMAGE:-simply-tv-builder:1}" bash -c "$STEPS"
|
||
fi
|
||
echo ">> done – simply-tv is open on the TV"
|