Compare commits
No commits in common. "49aa5f01f3660e3ff70494dc11af6fe79955f0c4" and "95882ea7e6c01e526fd4b3e33b2c910dd6010eb5" have entirely different histories.
49aa5f01f3
...
95882ea7e6
@ -21,9 +21,6 @@ backupScheduleEnabledApps()
|
|||||||
|
|
||||||
local queued=0
|
local queued=0
|
||||||
for name in "${app_names[@]}"; do
|
for name in "${app_names[@]}"; do
|
||||||
# libreportal (the WebUI) is reproducible — its state rides in the system
|
|
||||||
# config snapshot, so it's never scheduled as an app backup.
|
|
||||||
[[ "$name" == "libreportal" ]] && continue
|
|
||||||
local backup_flag="CFG_${name^^}_BACKUP"
|
local backup_flag="CFG_${name^^}_BACKUP"
|
||||||
if [[ "${!backup_flag}" == "true" ]]; then
|
if [[ "${!backup_flag}" == "true" ]]; then
|
||||||
backupAppSchedule "$name"
|
backupAppSchedule "$name"
|
||||||
@ -31,17 +28,5 @@ backupScheduleEnabledApps()
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# Keep the system config fresh on the schedule too (settings + the
|
isSuccessful "Backup scheduling complete — $queued app(s) queued"
|
||||||
# backup-location creds). Queue it via the task processor on WebUI installs,
|
|
||||||
# else run inline — mirroring backupAppSchedule. backupSystemConfig no-ops
|
|
||||||
# when no locations are enabled.
|
|
||||||
if [[ "$CFG_REQUIREMENT_WEBUI" == "true" ]] && declare -f createTaskFile >/dev/null 2>&1; then
|
|
||||||
createTaskFile "libreportal backup system" "backup" "system" \
|
|
||||||
&& isSuccessful "System config backup task queued" \
|
|
||||||
|| backupSystemConfig
|
|
||||||
else
|
|
||||||
backupSystemConfig
|
|
||||||
fi
|
|
||||||
|
|
||||||
isSuccessful "Backup scheduling complete — $queued app(s) queued + system config"
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -56,7 +56,6 @@ engineSnapshotsJson() { local i="$1"; shift; engineDispatch "$(engineForL
|
|||||||
engineSystemSnapshotsJson() { local i="$1"; shift; engineDispatch "$(engineForLocation "$i")SystemSnapshotsJson" "$i" "$@"; }
|
engineSystemSnapshotsJson() { local i="$1"; shift; engineDispatch "$(engineForLocation "$i")SystemSnapshotsJson" "$i" "$@"; }
|
||||||
engineSnapshotListFiles() { local i="$1"; shift; engineDispatch "$(engineForLocation "$i")SnapshotListFiles" "$i" "$@"; }
|
engineSnapshotListFiles() { local i="$1"; shift; engineDispatch "$(engineForLocation "$i")SnapshotListFiles" "$i" "$@"; }
|
||||||
engineForgetApp() { local i="$1"; shift; engineDispatch "$(engineForLocation "$i")ForgetApp" "$i" "$@"; }
|
engineForgetApp() { local i="$1"; shift; engineDispatch "$(engineForLocation "$i")ForgetApp" "$i" "$@"; }
|
||||||
engineForgetSystem() { local i="$1"; shift; engineDispatch "$(engineForLocation "$i")ForgetSystem" "$i" "$@"; }
|
|
||||||
engineCheckLocation() { local i="$1"; shift; engineDispatch "$(engineForLocation "$i")CheckLocation" "$i" "$@"; }
|
engineCheckLocation() { local i="$1"; shift; engineDispatch "$(engineForLocation "$i")CheckLocation" "$i" "$@"; }
|
||||||
engineDumpFile() { local i="$1"; shift; engineDispatch "$(engineForLocation "$i")DumpFile" "$i" "$@"; }
|
engineDumpFile() { local i="$1"; shift; engineDispatch "$(engineForLocation "$i")DumpFile" "$i" "$@"; }
|
||||||
|
|
||||||
|
|||||||
@ -34,39 +34,6 @@ resticForgetApp()
|
|||||||
return $rc
|
return $rc
|
||||||
}
|
}
|
||||||
|
|
||||||
resticForgetSystem()
|
|
||||||
{
|
|
||||||
local idx="$1"
|
|
||||||
|
|
||||||
if resticLocationAppendOnly "$idx"; then
|
|
||||||
isNotice "$(resticLocationName "$idx") is append-only — skipping forget for system config"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
local keep_last keep_daily keep_weekly keep_monthly keep_yearly
|
|
||||||
keep_last=$(resticRetentionFor "$idx" KEEP_LAST)
|
|
||||||
keep_daily=$(resticRetentionFor "$idx" KEEP_DAILY)
|
|
||||||
keep_weekly=$(resticRetentionFor "$idx" KEEP_WEEKLY)
|
|
||||||
keep_monthly=$(resticRetentionFor "$idx" KEEP_MONTHLY)
|
|
||||||
keep_yearly=$(resticRetentionFor "$idx" KEEP_YEARLY)
|
|
||||||
|
|
||||||
resticEnvExport "$idx" || return 1
|
|
||||||
|
|
||||||
local args=(forget --tag "system=config" --group-by tags,host)
|
|
||||||
[[ -n "$keep_last" ]] && args+=(--keep-last "$keep_last")
|
|
||||||
[[ -n "$keep_daily" ]] && args+=(--keep-daily "$keep_daily")
|
|
||||||
[[ -n "$keep_weekly" ]] && args+=(--keep-weekly "$keep_weekly")
|
|
||||||
[[ -n "$keep_monthly" ]] && args+=(--keep-monthly "$keep_monthly")
|
|
||||||
[[ -n "$keep_yearly" ]] && args+=(--keep-yearly "$keep_yearly")
|
|
||||||
[[ "$CFG_BACKUP_PRUNE_AFTER_FORGET" == "true" ]] && args+=(--prune)
|
|
||||||
|
|
||||||
isNotice "Applying retention for system config on $(resticLocationName "$idx")"
|
|
||||||
runBackupOp restic "${args[@]}"
|
|
||||||
local rc=$?
|
|
||||||
resticEnvUnset
|
|
||||||
return $rc
|
|
||||||
}
|
|
||||||
|
|
||||||
resticRetentionFor()
|
resticRetentionFor()
|
||||||
{
|
{
|
||||||
local idx="$1"
|
local idx="$1"
|
||||||
|
|||||||
@ -40,14 +40,6 @@ backupSystemConfig()
|
|||||||
isError "System config backup failed on all locations"
|
isError "System config backup failed on all locations"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Apply retention so system snapshots don't accumulate (respects append-only
|
|
||||||
# locations; bypasses backupAppStart's per-app forget, so do it here).
|
|
||||||
while IFS= read -r idx; do
|
|
||||||
[[ -z "$idx" ]] && continue
|
|
||||||
engineForgetSystem "$idx" >/dev/null 2>&1 || true
|
|
||||||
done < <(resticEnabledLocations)
|
|
||||||
|
|
||||||
if [[ $fail -gt 0 ]]; then
|
if [[ $fail -gt 0 ]]; then
|
||||||
isNotice "System config backed up to $ok location(s), failed on $fail"
|
isNotice "System config backed up to $ok location(s), failed on $fail"
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user