Skip to content

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.

~/.config/systemd/user/webos-launcher-update.service
[Unit]
Description=Update the TV launcher when the TV's apps or the settings change
Wants=network-online.target
After=network-online.target
[Service]
Type=oneshot
WorkingDirectory=%h/github/projects/webos-launcher
ExecStart=/usr/bin/node tools/auto-update.mjs
TimeoutStartSec=10min
# ~/.config/systemd/user/webos-launcher-update.timer
[Unit]
Description=Check the TV for launcher updates every hour
[Timer]
OnCalendar=hourly
RandomizedDelaySec=5min
[Install]
WantedBy=timers.target
Terminal window
systemctl --user enable --now webos-launcher-update.timer
journalctl --user -u webos-launcher-update # what the last runs did