1
0
forked from baron/baron-sso

kratos SSOT 재설계

This commit is contained in:
2026-06-12 18:36:18 +09:00
parent b96c8100e0
commit 8e9d015443
39 changed files with 3960 additions and 501 deletions

View File

@@ -2,4 +2,4 @@
set -euo pipefail
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
BACKUP="${BACKUP:-${1:-}}" DUMP_FILE="${DUMP_FILE:-}" RESTORE_REPORT="${RESTORE_REPORT:-}" "$script_dir/restore.sh" --dry-run
RESTORE_INPUT="${RESTORE_INPUT:-${FILE_PATH:-${1:-}}}" BACKUP="${BACKUP:-}" DUMP_FILE="${DUMP_FILE:-}" RESTORE_REPORT="${RESTORE_REPORT:-}" "$script_dir/restore.sh" --dry-run

View File

@@ -14,6 +14,7 @@ if [[ "${1:-}" == "--dry-run" ]]; then
fi
repo_root="$(backup_repo_root)"
restore_input="${RESTORE_INPUT:-${FILE_PATH:-}}"
backup_input="${BACKUP:-}"
dump_file="${DUMP_FILE:-}"
backup_source="directory"
@@ -107,8 +108,36 @@ trap on_restore_error ERR
trap cleanup_restore_input EXIT
resolve_backup_input() {
if [[ -n "$backup_input" && -n "$dump_file" ]]; then
backup_die "set only one of BACKUP or DUMP_FILE for restore."
local input_count=0
[[ -n "$restore_input" ]] && input_count=$((input_count + 1))
[[ -n "$backup_input" ]] && input_count=$((input_count + 1))
[[ -n "$dump_file" ]] && input_count=$((input_count + 1))
if [[ "$input_count" -gt 1 ]]; then
backup_die "set only one restore input: RESTORE_INPUT, BACKUP, or DUMP_FILE."
fi
if [[ -n "$restore_input" ]]; then
backup_require_path "$restore_input"
if [[ -d "$restore_input" ]]; then
backup_dir="$restore_input"
backup_source="directory"
return
fi
if [[ ! -f "$restore_input" ]]; then
backup_die "restore input must be a backup directory or supported archive: $restore_input"
fi
case "$restore_input" in
*.tar.zst | *.tar.gz | *.tgz | *.zip)
dump_file="$restore_input"
;;
*)
backup_die "unsupported restore input file extension: $restore_input"
;;
esac
fi
if [[ -n "$backup_input" ]]; then
@@ -134,6 +163,10 @@ resolve_backup_input() {
*.tar.gz | *.tgz)
tar -xzf "$dump_file" -C "$temp_extract_dir"
;;
*.zip)
backup_require_command unzip
unzip -q "$dump_file" -d "$temp_extract_dir"
;;
*)
backup_die "unsupported DUMP_FILE archive format: $dump_file"
;;