Automatic updates
On a rooted TV the hourly run also updates the apps installed from the Homebrew Channel’s official repository (tools/app-updates.mjs, or npm run update-apps by hand): each newer version is downloaded, checked against the repository’s SHA-256, and installed over root SSH. An app that’s on screen waits for the next run; the Homebrew Channel and its Updater update themselves. The launcher itself also reloads once a night, between 3 and 5 AM, while it’s in the background or showing the screensaver.
tools/auto-update.mjs runs every hour from a systemd user timer. If the TV is on, it syncs. If anything changed since the last install (apps installed or removed, settings, or the launcher’s own code), it reinstalls the launcher without opening it. When the launcher is on screen it waits for the next run, because reinstalling closes it.
[Unit]Description=Update the TV launcher when the TV's apps or the settings changeWants=network-online.targetAfter=network-online.target
[Service]Type=oneshotWorkingDirectory=%h/github/projects/webos-launcherExecStart=/usr/bin/node tools/auto-update.mjsTimeoutStartSec=10min
# ~/.config/systemd/user/webos-launcher-update.timer[Unit]Description=Check the TV for launcher updates every hour
[Timer]OnCalendar=hourlyRandomizedDelaySec=5min
[Install]WantedBy=timers.targetsystemctl --user enable --now webos-launcher-update.timerjournalctl --user -u webos-launcher-update # what the last runs did
