Found while testing live backups end-to-end: - Engine backup adapters logged to stdout, so the caller's $() snapshot-id capture was polluted with log text — verify-after-backup then failed with 'no matching ID' on every run. Route their log lines to stderr so stdout is only the id (restic/borg/kopia). - 'libreportal app restore <app> --latest' (as the help advertises) and the bare 'restore <app>' both failed: --latest was passed to restic verbatim and unset args arrive as the literal 'empty'. Normalise both to 'latest'. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> Signed-off-by: librelad <librelad@digitalangels.vip>
29 lines
887 B
Bash
Executable File
29 lines
887 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# CLI handler for `libreportal app restore ...`.
|
|
#
|
|
# Shapes:
|
|
# libreportal app restore <app> [snapshot|latest] [repo]
|
|
# Restore from a snapshot id (or 'latest', the default).
|
|
# Optional repo name: local | remote_1 | remote_2.
|
|
|
|
cliAppRestore() {
|
|
local app_name="$1"
|
|
local snapshot="$2"
|
|
local repo="$3"
|
|
|
|
if [[ -z "$app_name" ]]; then
|
|
isError "App name required for restore."
|
|
cliShowAppHelp
|
|
return 1
|
|
fi
|
|
|
|
# Normalise the snapshot selector: unset args arrive as the literal
|
|
# "empty" from the CLI wrapper, and the help advertises --latest, but
|
|
# restorePickSnapshot expects the bare token "latest".
|
|
[[ -z "$snapshot" || "$snapshot" == "empty" || "$snapshot" == "--latest" ]] && snapshot="latest"
|
|
[[ -z "$repo" || "$repo" == "empty" ]] && repo=""
|
|
|
|
restoreAppStart "$app_name" "$snapshot" "$repo"
|
|
}
|