Make the system config a tracked backup, not just action buttons:
- engine: resticSystemSnapshotsJson (tag system=config) + engineSystemSnapshotsJson
dispatcher — query the system snapshots the way per-app status is queried.
- webui_backup_dashboard.sh: emit a "system": { latest_snapshot, latest_time }
object (latest system snapshot on the primary location), and exclude the
libreportal WebUI app from the per-app grid (it's intentionally not backed up, so
it no longer shows a perpetual "No backup yet" tile).
- backup dashboard card: a status line (dot + "Last backed up <relative>" / "No
backup yet"), populated in renderDashboard from d.system — mirrors the app tiles.
Verified: shell + JS parse; dashboard content assembles to valid JSON with the
system key; engine query defined + dispatched; frontend reads d.system into the
#backup-system-status element.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Signed-off-by: librelad <librelad@digitalangels.vip>
64 lines
1.4 KiB
Bash
64 lines
1.4 KiB
Bash
#!/bin/bash
|
|
|
|
resticSnapshotsJson()
|
|
{
|
|
local idx="$1"
|
|
local app_filter="$2"
|
|
local host_filter="$3"
|
|
|
|
resticEnvExport "$idx" || return 1
|
|
|
|
local args=(snapshots --json --no-lock)
|
|
[[ -n "$app_filter" ]] && args+=(--tag "app=$app_filter")
|
|
[[ -n "$host_filter" ]] && args+=(--host "$host_filter")
|
|
|
|
runBackupOp restic "${args[@]}" 2>/dev/null
|
|
local rc=$?
|
|
resticEnvUnset
|
|
return $rc
|
|
}
|
|
|
|
resticSystemSnapshotsJson()
|
|
{
|
|
local idx="$1"
|
|
local host_filter="$2"
|
|
|
|
resticEnvExport "$idx" || return 1
|
|
|
|
local args=(snapshots --json --no-lock --tag "system=config")
|
|
[[ -n "$host_filter" ]] && args+=(--host "$host_filter")
|
|
|
|
runBackupOp restic "${args[@]}" 2>/dev/null
|
|
local rc=$?
|
|
resticEnvUnset
|
|
return $rc
|
|
}
|
|
|
|
resticSnapshotLatestId()
|
|
{
|
|
local idx="$1"
|
|
local app_name="$2"
|
|
local host="${3:-$CFG_INSTALL_NAME}"
|
|
|
|
resticEnvExport "$idx" || return 1
|
|
local id
|
|
id=$(runBackupOp restic snapshots \
|
|
--tag "app=$app_name" --host "$host" \
|
|
--latest 1 --json --no-lock 2>/dev/null | \
|
|
grep -o '"short_id":"[^"]*"' | head -1 | cut -d'"' -f4)
|
|
resticEnvUnset
|
|
echo "$id"
|
|
}
|
|
|
|
resticSnapshotListFiles()
|
|
{
|
|
local idx="$1"
|
|
local snapshot_id="$2"
|
|
|
|
resticEnvExport "$idx" || return 1
|
|
runBackupOp restic ls --json --no-lock "$snapshot_id" 2>/dev/null
|
|
local rc=$?
|
|
resticEnvUnset
|
|
return $rc
|
|
}
|