#!/bin/bash restoreFirstRunDiscover() { local idx="$1" if ! resticLocationEnabled "$idx"; then isError "Location $idx is not enabled" return 1 fi resticEnvExport "$idx" || return 1 sudo -E -u "$docker_install_user" restic snapshots --tag engine=libreportal --json --no-lock 2>/dev/null local rc=$? resticEnvUnset return $rc } restoreFirstRunBulk() { local idx="$1" local source_host="$2" shift 2 local apps_to_restore=("$@") if [[ ${#apps_to_restore[@]} -eq 0 ]]; then isError "No apps specified for bulk first-run restore" return 1 fi isHeader "First-run bulk restore from $(resticLocationName "$idx") (host=$source_host)" for app in "${apps_to_restore[@]}"; do restoreAppStart "$app" "latest" "$idx" "$source_host" done isSuccessful "First-run restore complete — ${#apps_to_restore[@]} apps restored" }