feat(cli): backup system / restore system subcommands

Expose the system-config backup on demand (not just within 'backup all'):

- `libreportal backup system`      -> backupSystemConfig (snapshot the system
  config — settings, WebUI creds, backup-location creds — to all enabled locations)
- `libreportal restore system [loc_idx]` -> backupRestoreSystemConfig (restore the
  latest system snapshot into a staging dir; never overwrites live config)

Distinct from the existing 'restore migrate system' (which restores all *apps*
from another host). Help text updated for both. Routing verified with stubs.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Signed-off-by: librelad <librelad@digitalangels.vip>
This commit is contained in:
librelad 2026-05-26 00:27:25 +01:00
parent f2dc3f27d9
commit 839cf3561a
4 changed files with 17 additions and 1 deletions

View File

@ -54,6 +54,9 @@ cliHandleBackupCommands()
all)
backupAllApps
;;
system)
backupSystemConfig
;;
scheduled)
backupScheduleEnabledApps
;;

View File

@ -19,7 +19,11 @@ cliShowBackupHelp()
echo " Delete every backup for an app (skips append-only locations)."
echo ""
echo "backup all"
echo " Snapshot every installed app."
echo " Snapshot every installed app (also runs 'backup system')."
echo ""
echo "backup system"
echo " Snapshot the system config (settings, WebUI creds, backup-location"
echo " creds) to all enabled locations — needed for a self-sufficient restore."
echo ""
echo "backup scheduled"
echo " Queue a backup for every app with backups enabled (daily cron entry)."

View File

@ -36,6 +36,11 @@ cliHandleRestoreCommands()
;;
esac
;;
system)
# Restore the latest system-config snapshot (settings + creds) into a
# staging dir; never overwrites live config. Optional location idx.
backupRestoreSystemConfig "$action"
;;
migrate)
case "$action" in
app)

View File

@ -9,6 +9,10 @@ cliShowRestoreHelp()
echo "restore app list <app_name>"
echo " List available backups for an app across all enabled locations."
echo ""
echo "restore system [loc_idx]"
echo " Restore the latest system-config snapshot into a staging dir"
echo " (review-then-copy; never overwrites live config). Default: first location."
echo ""
echo "restore migrate app <app_name> <source_host> [loc_idx]"
echo " Restore one app's backup taken on another host (cross-host migrate)."
echo ""