From 7d600ade7e36f33a9efe904d12b040016e8d679b Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 13 Aug 2026 14:32:09 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20communication=20scrcpy=20=E2=80=94=20dro?= =?UTF-8?q?p=20scrcpy=20from=20apt=20PACKAGES=20(not=20in=20Debian/Ubuntu?= =?UTF-8?q?=20repos=20by=20default),=20install=20via=20apps/media/scrcpy.s?= =?UTF-8?q?h?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AGENT_TODO.md | 2 ++ DOC/POS.md | 2 +- DOC/howto/communication.md | 7 ++++--- bin/pos-communication-scrcpy | 2 +- preinstall.sh | 3 +-- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/AGENT_TODO.md b/AGENT_TODO.md index 60bbfaf..882af9e 100644 --- a/AGENT_TODO.md +++ b/AGENT_TODO.md @@ -16,6 +16,8 @@ summary (newest last). ## Done +- **2026-08-13** — Fix scrcpy apt install on the live box: preinstall `apt install` failed with `Unable to locate package scrcpy` (Debian/Ubuntu need contrib/universe for `scrcpy`, and the apt build is older anyway). Removed `scrcpy` from `preinstall.sh` PACKAGES (kept `adb`); `scrcpy` now installs via the existing optional app `apps/media/scrcpy.sh` (GitHub latest, bundles adb) — docs (POS.md, howto/communication.md) and the tool's deps-guard error reworded to lead with that path. Re-verified: `bash -n`, stub suite 21/21, `make gen && make check` green. + - **2026-08-13** — `pos communication scrcpy` (`bin/pos-communication-scrcpy`): wrapper over scrcpy+adb for Android mirroring/control. Subcommands: bare `scrcpy` (mirror — config defaults + verbatim pass-through of any scrcpy flag; no device → friendly error + hints), `devices` (`adb devices -l`), `record [file] [--headless]` (default `$SCRCPY_RECORD_DIR/_.mp4`, `--headless` = `--no-playback` for headless servers), `tcpip [port]` (USB→wireless switch + prints `connect` with the auto-detected device IP), `connect ` (adb connect + mirror `-s`), `push` (default `/sdcard/Download` = scrcpy's own default), `pull`, `screenshot` (`adb exec-out screencap -p` → PNG in RECORD_DIR), `info` (model/android/sdk/serial via getprop). Config scope `scrcpy` (`~/.config/linux_post_install/scrcpy.env`, `pos config scrcpy`): `SCRCPY_SERIAL/MAX_SIZE/MAX_FPS/BIT_RATE/FULLSCREEN/RECORD_DIR/PUSH_TARGET/EXTRA_FLAGS`, env-var precedence. Deps `scrcpy` + `adb` added to preinstall PACKAGES; docs note the apt build is older and point to the existing `apps/media/scrcpy.sh` app installer (GitHub latest, bundles adb) — researched 2026 releases (current v4.1). Conventions: `# POS:`/`# POS_SUBCMDS:`/`# POS_CONFIG:` headers, deps guards before `-h|--help`, no stdin → no INTERACTIVE_CMDS. Verified: `bash -n`, stub-PATH suite `/tmp/opencode/scrcpy-run-test.sh` 21/21 green (fake adb/scrcpy echo-args, HOME isolation, env/file precedence, rc paths, screenshot bytes), `make gen && make check` green, dispatch via `pos communication scrcpy --help`. Docs: POS.md communication table + detail block, howto/communication.md section, HOWTO.md index + env row, AGENT_Context Common Tasks row + gen'd tree/dispatch/filetable. - **2026-08-13** — Entertainment-module hardening (approved Tier 1 + Tier 2): delivery moved to `notify_send` (platform follows `NOTIFY_PLATFORM`, default Telegram) via `lib/notify.sh` sourced by `bin/pos-entertainment-send`; a **last-run state** is recorded per plugin (`~/.local/share/linux_post_install/entertainment/last/` — rc + timestamp) on every non-`--print` run and shown by `pos entertainment status`, which also lists installed-but-not-enabled plugins; a send that fails **while fired by a timer** (gated on `$INVOCATION_ID`) additionally notifies the configured platforms. New **message-safe plugin lib** `lib/entertainment-plugin-lib.sh` (defines only `plugin_*`, never writes stdout — the stdout contract stays "message only"): `plugin_load_config` (entertainment.env + env precedence), `plugin_have`, `plugin_require`, `plugin_err`, `plugin_http_json [--key ] [-H
]` (curl `--max-time 20 --retry 2`); `weather`/`joke`/`gold` refactored onto it. `pos entertainment config` gains `get|unset|ls|edit` (edit via the shared `pos config` UI — added to `INTERACTIVE_CMDS`). **Tier 2**: new shared lib `lib/user-timers-lib.sh` (only `ut_*`: `ut_interval_to_oncalendar`, `ut_interval_label`, `ut_unit_name`, `ut_write_unit_pair` incl. `TimeoutStopSec=5s` + `Persistent` + network-online deps, `ut_ensure_linger`, `USER_SYSTEMD_DIR`) dedupes the systemd user-timer machinery between `lib/entertainment-lib.sh` and `lib/scheduler-lib.sh` (the latter's `sched_*` duplicates deleted; both source it; collides-with-nothing). `install.sh` Phase 2 lib list += the two new libs; SCRIPTS.md/DEV.md/POS.md/howto/entertainment.md/AGENT_Context updated (hand-maintained lib rows: entertainment-lib 354→311, scheduler-lib 830→760, +112 user-timers-lib, +67 plugin lib). Verified: `bash -n` everywhere; smoke-tested in an isolated `HOME=/tmp/enttest` (status, config get/set/unset/ls, send path rc=0, failing plugin records rc=1, error-case message hygiene); `make gen && make check` green. diff --git a/DOC/POS.md b/DOC/POS.md index 6263038..bb9345a 100644 --- a/DOC/POS.md +++ b/DOC/POS.md @@ -352,7 +352,7 @@ A device must have **USB debugging** enabled (Developer options) and the phone's | `SCRCPY_PUSH_TARGET` | no | `/sdcard/Download` | Default `adb push` destination | | `SCRCPY_EXTRA_FLAGS` | no | — | Extra scrcpy flags appended to every mirror | -Requires `scrcpy` + `adb` (added to `preinstall.sh` PACKAGES). The apt `scrcpy` build is older than the latest release — the optional app `apps/media/scrcpy.sh` installs the current GitHub release (bundles `adb`); run it via `./install.sh --apps` or directly. +Requires `scrcpy` + `adb`. `adb` is in `preinstall.sh` PACKAGES; `scrcpy` is **not** — apt rarely ships it on Debian/Ubuntu without contrib/universe (and it's older there anyway), so it installs via the optional app `apps/media/scrcpy.sh` (GitHub latest release, bundles `adb`); run it via `./install.sh --apps` or directly. The tool errors with that hint when `scrcpy` is missing. ### entertainment diff --git a/DOC/howto/communication.md b/DOC/howto/communication.md index a0636aa..aeff4f6 100644 --- a/DOC/howto/communication.md +++ b/DOC/howto/communication.md @@ -245,9 +245,10 @@ pos communication scrcpy info # model / Android version pos config scrcpy # optional defaults (serial, size, fps, ...) ``` -Requires `scrcpy` + `adb` (both in preinstall PACKAGES). The apt build is older -than the latest release — install the current GitHub release (bundles `adb`) -with the optional app `apps/media/scrcpy.sh` (or `./install.sh --apps`). +Requires `scrcpy` + `adb`. `adb` is in preinstall PACKAGES; `scrcpy` usually is +**not** in apt on Debian/Ubuntu (needs contrib/universe and is older there), so +install the current GitHub release (bundles `adb`) with the optional app +`apps/media/scrcpy.sh` (or `./install.sh --apps`). ### Mirror diff --git a/bin/pos-communication-scrcpy b/bin/pos-communication-scrcpy index f4a9cf6..db284f6 100755 --- a/bin/pos-communication-scrcpy +++ b/bin/pos-communication-scrcpy @@ -8,7 +8,7 @@ source "$(dirname "$0")/../lib/common.sh" 2>/dev/null || source "$(dirname "$0") CONFIG_FILE="$HOME/.config/linux_post_install/scrcpy.env" -command -v scrcpy &>/dev/null || err "scrcpy not found — install it: 'sudo apt install scrcpy' (or the latest release via the app installer 'apps/media/scrcpy.sh', see 'pos help communication scrcpy')" +command -v scrcpy &>/dev/null || err "scrcpy not found — install the latest release with the app installer: 'apps/media/scrcpy.sh' (or 'sudo apt install scrcpy' if your distro ships it; it bundles adb), see 'pos help communication scrcpy'" command -v adb &>/dev/null || err "adb not found — install it: 'sudo apt install adb'" load_config() { diff --git a/preinstall.sh b/preinstall.sh index 813d6d8..ae15b63 100755 --- a/preinstall.sh +++ b/preinstall.sh @@ -37,8 +37,7 @@ PACKAGES=( lm-sensors smartmontools nvme-cli hdparm sysstat iotop atop vnstat python3 python3-pip rclone - libqrencode4 libgtk-3-0 - scrcpy adb + libqrencode4 libgtk-3-0 adb ) spawn "apt update" sudo apt update