Update source/agent-remote/datacommands_v2.sh
All checks were successful
Build-Test-Publish / build (linux/amd64) (push) Successful in 31s
Build-Test-Publish / build (linux/arm64) (push) Successful in 56s

This commit is contained in:
Your Name
2025-08-30 18:04:20 +12:00
parent fedec545e8
commit d04beefb42

View File

@@ -281,7 +281,7 @@ backup_volume() {
restore_volume() { restore_volume() {
local label="$1" local label="$1"
local volume_name="$2" local volume_name="$2"
local backup_folder="$3" local backup_folder="$TEMP_DIR/backup"
echo "[restore_volume] label=$label volume=$volume_name backup_folder=$backup_folder" echo "[restore_volume] label=$label volume=$volume_name backup_folder=$backup_folder"
@@ -315,98 +315,98 @@ restore_volume() {
fi fi
} }
# # ============================================================================ # ============================================================================
# # MAIN BACKUP/RESTORE ORCHESTRATION # MAIN BACKUP/RESTORE ORCHESTRATION
# # ============================================================================ # ============================================================================
# # Process multiple items for backup # Process multiple items for backup
# # Usage: backup_items <backup_file> <temp_dir> type1:label1:location1 type2:label2:location2 ... # Usage: backup_items type1:label1:location1 type2:label2:location2 ...
# backup_items() { backup_items() {
# local backup_file="$1" _check_required_env_vars "BACKUP_FILE" "TEMP_DIR"
# local temp_dir="$2" local backup_file="${BACKUP_FILE}"
# shift 2 local temp_dir="${TEMP_DIR}"
# local backup_temp_path="${temp_dir}/backup" local backup_temp_path="${temp_dir}/backup"
# mkdir -p "$backup_temp_path" mkdir -p "$backup_temp_path"
# echo "Starting backup to ${backup_file}" echo "Starting backup to ${backup_file}"
# # Process each item # Process each item
# for item in "$@"; do for item in "$@"; do
# IFS=':' read -r type label location <<< "$item" IFS=':' read -r type label location <<< "$item"
# case "$type" in case "$type" in
# file) file)
# backup_file "$label" "$location" "$backup_temp_path" backup_file "$label" "$location" "$backup_temp_path"
# ;; ;;
# path) path)
# backup_path "$label" "$location" "$backup_temp_path" backup_path "$label" "$location" "$backup_temp_path"
# ;; ;;
# volume) volume)
# backup_volume "$label" "$location" "$backup_temp_path" backup_volume "$label" "$location" "$backup_temp_path"
# ;; ;;
# *) *)
# echo "Unknown type: $type (must be file, path, or volume)" echo "Unknown type: $type (must be file, path, or volume)"
# ;; ;;
# esac esac
# done done
# # Create final backup archive # Create final backup archive
# echo "Creating backup archive ${backup_file}" echo "Creating backup archive ${backup_file}"
# tar -czf "$backup_file" -C "$backup_temp_path" . tar -czf "$backup_file" -C "$backup_temp_path" .
# # Clean up temp directory # Clean up temp directory
# rm -rf "$backup_temp_path" rm -rf "$backup_temp_path"
# echo "Backup completed successfully" echo "Backup completed successfully"
# } }
# # Process multiple items for restore # Process multiple items for restore
# # Usage: restore_items <backup_file> <temp_dir> type1:label1:location1 type2:label2:location2 ... # Usage: restore_items type1:label1:location1 type2:label2:location2 ...
# restore_items() { restore_items() {
# local backup_file="$1" _check_required_env_vars "BACKUP_FILE" "TEMP_DIR"
# local temp_dir="$2" local backup_file="${BACKUP_FILE}"
# shift 2 local temp_dir="${TEMP_DIR}"
# if [ ! -f "$backup_file" ]; then if [ ! -f "$backup_file" ]; then
# echo "Backup file $backup_file not found" echo "Backup file $backup_file not found"
# return 1 return 1
# fi fi
# local restore_temp_path="${temp_dir}/restore" local restore_temp_path="${temp_dir}/restore"
# mkdir -p "$restore_temp_path" mkdir -p "$restore_temp_path"
# echo "Starting restore from ${backup_file}" echo "Starting restore from ${backup_file}"
# # Extract backup archive # Extract backup archive
# echo "Extracting backup archive" echo "Extracting backup archive"
# tar -xzf "$backup_file" -C "$restore_temp_path" tar -xzf "$backup_file" -C "$restore_temp_path"
# # Process each item # Process each item
# for item in "$@"; do for item in "$@"; do
# IFS=':' read -r type label location <<< "$item" IFS=':' read -r type label location <<< "$item"
# case "$type" in case "$type" in
# file) file)
# restore_file "$label" "$location" "$restore_temp_path" restore_file "$label" "$location" "$restore_temp_path"
# ;; ;;
# path) path)
# restore_path "$label" "$location" "$restore_temp_path" restore_path "$label" "$location" "$restore_temp_path"
# ;; ;;
# volume) volume)
# restore_volume "$label" "$location" "$restore_temp_path" restore_volume "$label" "$location" "$restore_temp_path"
# ;; ;;
# *) *)
# echo "Unknown type: $type (must be file, path, or volume)" echo "Unknown type: $type (must be file, path, or volume)"
# ;; ;;
# esac esac
# done done
# # Clean up temp directory # Clean up temp directory
# rm -rf "$restore_temp_path" rm -rf "$restore_temp_path"
# echo "Restore completed successfully" echo "Restore completed successfully"
# } }
# # ============================================================================ # # ============================================================================
# # LEGACY COMPATIBILITY WRAPPER (can be removed once migration is complete) # # LEGACY COMPATIBILITY WRAPPER (can be removed once migration is complete)