LibrePortal/scripts/cli/commands/updater/cli_updater_header.sh
librelad cdeb2d1658 feat(updater): per-app UPDATE_TYPE, automatic by default
Adds the decision half of the app updater. Detection (P2) and the
snapshot-first apply/revert (P3) were already real, but nothing ever
pressed the button — every update waited for a click.

  CFG_<APP>_UPDATE_TYPE=auto|manual   per app, default auto (33 templates)
  CFG_UPDATER_AUTO=true|false         master switch, default true

updaterAppPolicy resolves the two the way backupResolveStrategy already
resolves backup strategy: the global switch can only make things more
manual. updaterApplyAuto runs at the end of `updater check` and enqueues
the ordinary updater_apply task for each auto app that has an update —
never applies inline, so an automatic update is the same code path, task
log, History entry and Roll back button as a manual one.

Safety: each attempt stamps its target digest under generated/auto/, so a
build that fails is rolled back and then left alone rather than retried on
every scan; in-flight updater tasks are skipped so scans can't stack.

Tracked end to end: updates.json carries each app's resolved update_type,
History entries carry trigger=manual|auto. The WebUI says whether updates
install themselves, chips only the apps that opted out, labels automatic
history, and — since an auto app's pending update needs no decision — keeps
it off the Overview board's "Needs action" view.

Also fixes artifactApplyAuto enqueueing without --detach: it runs inside
the single-threaded task processor's own poll, so following the new task in
the foreground waits for a task that cannot start until it returns.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-11 16:22:04 +01:00

29 lines
1.5 KiB
Bash

#!/bin/bash
# App Updater Commands Header
# Shows available `libreportal updater` subcommands.
cliShowUpdaterHelp()
{
echo ""
echo "Available App Updater Commands:"
echo ""
echo " libreportal updater check [auto] - Refresh per-app version & vulnerability data"
echo " (auto = background mode: only scans when the data is"
echo " older than CFG_UPDATER_SCAN_INTERVAL minutes)"
echo " libreportal updater apply <app> - Update one app (snapshots it first; auto-rollback on failure)"
echo " libreportal updater apply-all [a,b] - Update a comma-list of apps (each snapshotted first)"
echo " libreportal updater rollback <app> - Restore an app's most recent pre-update snapshot"
echo ""
echo "Every update takes a recovery snapshot via the Backup engine before"
echo "touching the app, so any update is reversible. These commands back the"
echo "WebUI Updates page (features/updater); actions run through the task system."
echo ""
echo "Automatic updates: each check enqueues the update for every app set to"
echo "CFG_<APP>_UPDATE_TYPE=auto (the default) — the same snapshot-first apply"
echo "as pressing Update, recorded in History as automatic. Set an app to"
echo "'manual' on its Configure page to hold it back, or CFG_UPDATER_AUTO=false"
echo "to hold back every app. A build that fails is never auto-retried."
echo ""
}