LibrePortal/scripts/cli/commands/update/cli_update_header.sh
librelad d5fe1bc56b feat(webui): out-of-date detection + one-click update
Surface when LibrePortal is behind upstream and let users update from the
WebUI, reusing the proven git-update path instead of reinventing it.

Detection (host): webuiSystemUpdateCheck writes
frontend/data/system/update_status.json from a throttled git fetch +
behind-count + VERSION compare, off the existing per-minute
`webui generate system` cron. A new /VERSION file is the canonical version.

Display (frontend): update-notifier.js/.css render a global topbar badge
(every page) and a dashboard banner (prominent when behind, subtle "up to
date" with a manual check otherwise), plus a details panel.

Actions go through the task pipeline:
- `libreportal update apply` -> webuiRunUpdate (non-interactive: guards,
  forced check, gitPerformUpdate, then dockerInstallApp libreportal)
- `libreportal update check` -> forced recheck

gitFolderResetAndBackup's body is extracted into gitPerformUpdate (no exit)
so the WebUI path can reuse it; the interactive CLI flow is unchanged.

Detection JSON verified against the repo (up-to-date and behind cases).
webuiRunUpdate's re-clone + redeploy still needs validation on a live host.

The latest-version source is git for now and is the single swap point for
get.libreportal.org later — the JSON contract and frontend stay unchanged.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Signed-off-by: librelad <librelad@digitalangels.vip>
2026-05-21 23:33:43 +01:00

20 lines
733 B
Bash
Executable File

#!/bin/bash
# Update Commands Header
# Shows available update commands and help information
cliShowUpdateHelp()
{
echo ""
echo "Available Update Commands:"
echo ""
echo " libreportal update - Interactively check for and install updates"
echo " libreportal update check - Refresh the out-of-date status (no install)"
echo " libreportal update apply - Non-interactively update to the latest version"
echo ""
echo "These commands check for and install the latest LibrePortal updates."
echo "Your current configuration is backed up before updating."
echo "'check' and 'apply' are also what the WebUI Update notification uses."
echo ""
}