install-tv.sh: dry-run mode, and the playing check now works (it found no app id before)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-09 14:23:01 +00:00
co-authored by Claude Opus 5.5
parent 4c133ff131
commit 9bcbe768d6
2 changed files with 89 additions and 1 deletions
+84
View File
@@ -0,0 +1,84 @@
# 0.123.0 (versionCode 315): verification and proposed install procedure (9 November 2026)
Nothing here has been run on a TV except the dry run in section 2. Installing, and the full-library comparison, each wait
for Paul's separate approval.
## 1. Verification
- **Both TVs run exactly 0.122.1-smooth-row (314):** the installed APK's SHA-256 matches `apks/orbit-tv-0.122.1-smooth-row.apk`
on both TVs (2e46017d…).
- **0.123.0 is built on top of it:** the commit 0.122.1 was built from (classics-modes 7b4e82a) is in 0.123.0's history.
Nothing was deleted, and nothing was reverted.
- **APK contents:** the same 585 files as 0.122.1. Every image, sound, font, resource and asset is byte-identical.
Only the code differs, in one of its three dex files. The manifest is identical apart from the version:
the same activities, services, receivers and permissions.
- **Code:** every class in 0.122.1 is in 0.123.0. The only differences are three compiler-numbered lambdas that were
renumbered. Added: PlayerSwitches, FrameRateMatch, DisplayModeInfo and PlaybackHealth, plus the comparison's new safeguards.
- **Release gate:** `tools/verify.sh` passed. It ran the build, 1,120 unit tests with no failures (including the shared provider
contract suite) and lint with no errors. The install checker's own tests and the live Silo contract test passed too.
- **Signing:** the same certificate as 0.122.1 (SHA-256 042f9637…).
- **What changes for the household:** nothing until a switch is turned on. Frame-rate matching and AVI both start off,
and the comparison only runs when asked from adb.
## 2. Install procedure (downstairs first)
One command does every step, and stops at the first one that fails:
```
tools/install-tv.sh 192.168.0.252:5555 0.123.0-player downstairs
```
1. Refuses if the APK's checksum is wrong, or if Orbit is playing something. Orbit was playing during the dry run, and it
refused correctly once fixed: the first dry run found this check wasn't working, and it's fixed.
2. Pulls the installed APK as a rollback copy and checks it against `apks/`.
3. Takes a before snapshot of the household's data (bookings, history, Taste, profiles, Continue watching, schedules)
and pulls it to `backups/`.
4. Sets the schedules aside on the TV, installs, compiles for speed and reopens Orbit.
5. Checks the version is now 0.123.0 and only one copy of Orbit is running.
6. Takes an after snapshot and compares it: no files missing, nothing the household owns changed, no booking lost and
no planned programme changed. Exit 0 only when all of that holds.
**Dry run, 9 November 14:22** (`DRY_RUN=1`, steps 1 to 3 only, nothing installed): the rollback copy was verified.
The snapshot had 290 files, 2,370 bookings and 12,192 planned programmes, and comparing it with itself gave UNCHANGED.
## 3. After installing
- **Smoke test:** Home, the guide, tuning two channels, Catch Up, the Companion, the Arcade and a profile switch.
- **Switches:** `adb logcat -s OrbitPlayer` must show no switch turned on.
- **Observation:** a normal evening's viewing downstairs. Upstairs follows only after that, by the same command with
`192.168.0.195:5555 0.123.0-player upstairs`.
## 4. If something is wrong
Android 14 won't install an older version over a newer one. So the way back is the restore command
(`tools/restore-tv.sh`, rehearsed on 8 November) with the before snapshot, or a fixed 0.123.x.
## 5. The full-library comparison (separate approval)
This only runs after 0.123.0 is installed downstairs and Paul approves it.
**Start:**
```
adb shell am start -n tv.orbit.classic/.MainActivity --ei orbit_shadow_catalogue 0
```
**Pacing:**
- At least 1.5 s between pages, and 5 s while a programme plays.
- Never faster than the server answers.
**Stops by itself when:**
- a failed page fails again after a 30 s retry;
- Orbit closes;
- playback stalls 3 times;
- memory passes 80%;
- the server takes over 20 s per page 3 times running.
**Stop:**
```
adb shell am start -n tv.orbit.classic/.MainActivity --ez orbit_shadow_catalogue_stop true
```
**Resume:**
```
adb shell am start -n tv.orbit.classic/.MainActivity --el orbit_shadow_from <positionReached> --ei orbit_shadow_catalogue 0
```
**Report:** `shadow-catalogue/report.json` is rewritten every 25 pages.
- It contains `stopped` (the reason it stopped), `error`, `retries`, `positionReached`, the timings and peak memory.
- It never writes the catalogue: `wroteCatalogue` is always false.
- A resumed run keeps the earlier report beside its own.
+5 -1
View File
@@ -7,13 +7,16 @@
# 4. Checks one copy of Orbit is running, takes the after snapshot and compares (tools/compare_snapshots.py).
# 5. Keeps the last three backups for this room. Exit 0 only when everything checked out.
# Restore, if ever needed: tools/restore-tv.sh <device> <backup>/before
# DRY_RUN=1 stops after step 2 and the before snapshot: it installs nothing and changes nothing on the TV.
set -uo pipefail
A=${ADB:-/opt/android-sdk/platform-tools/adb}; D=$1; NEW=$2; ROOM=${3:-downstairs}
OT=${ORBIT_HOME:-/home/pauljd/Documents/OrbitTV}; APKS=$OT/apks; TOOLS="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
PFX=$([ "$ROOM" = downstairs ] && echo "" || echo "$ROOM-")
R="$A -s $D shell am broadcast -f 0x20 -n tv.orbit.classic/.InstallSnapshotReceiver -a tv.orbit.classic.INSTALL_SNAPSHOT"
( cd "$APKS" && sha256sum -c "orbit-tv-$NEW.apk.sha256" >/dev/null ) || { echo "Checksum of orbit-tv-$NEW.apk failed or missing; nothing installed."; exit 1; }
PLAYING=$($A -s $D shell "dumpsys audio | grep -E 'AudioPlaybackConfiguration.*state:started' | grep -c \$(dumpsys package tv.orbit.classic | grep -m1 -o 'userId=[0-9]*' | cut -d= -f2)" | tr -d '\r')
APPID=$($A -s $D shell dumpsys package tv.orbit.classic | grep -m1 -oE '(userId|appId)=[0-9]+' | cut -d= -f2 | tr -d '\r')
[ -n "$APPID" ] || { echo "Couldn't find Orbit on $ROOM; nothing installed."; exit 1; }
PLAYING=$($A -s $D shell dumpsys audio | grep -c "u/pid:$APPID/.*state:started")
[ "${PLAYING:-0}" != "0" ] && [ "${FORCE:-0}" != "1" ] && { echo "Orbit is playing on $ROOM; not interrupting. FORCE=1 to install anyway."; exit 2; }
PREV=$($A -s $D shell dumpsys package tv.orbit.classic | grep -m1 versionName | sed 's/.*versionName=//' | tr -d '\r ')
B=$OT/backups/${PFX}install-$NEW-$(date +%Y%m%d-%H%M); mkdir -p "$B"; echo "room $ROOM, installed $PREV, backup $B"
@@ -24,6 +27,7 @@ fi
snap() { for i in 1 2 3; do r=$($R --es do snapshot | grep -o 'data="[^"]*"'); echo "$1 snapshot $r"; echo "$r" | grep -q failed || break; sleep 3; done
$A -s $D pull /sdcard/Android/data/tv.orbit.classic/files/install-snapshot "$B/$1" >/dev/null && $R --es do clear >/dev/null; }
snap before
if [ "${DRY_RUN:-0}" = "1" ]; then python3 "$TOOLS/compare_snapshots.py" "$B/before" "$B/before" | tail -4; echo "Dry run: nothing installed, backup kept at $B."; exit 0; fi
$R --es do rollback --es version "$(echo "$PREV" | grep -oE '^[0-9]+\.[0-9]+\.[0-9]+')" | grep -o 'data="[^"]*"'
$A -s $D install -r "$APKS/orbit-tv-$NEW.apk" | tail -1 || exit 1
$A -s $D shell cmd package compile -m speed -f tv.orbit.classic >/dev/null