Initial commit: VaultMesh Skills collection
Collection of operational skills for VaultMesh infrastructure including: - backup-sovereign: Backup and recovery operations - btc-anchor: Bitcoin anchoring - cloudflare-tunnel-manager: Cloudflare tunnel management - container-registry: Container registry operations - disaster-recovery: Disaster recovery procedures - dns-sovereign: DNS management - eth-anchor: Ethereum anchoring - gitea-bootstrap: Gitea setup and configuration - hetzner-bootstrap: Hetzner server provisioning - merkle-forest: Merkle tree operations - node-hardening: Node security hardening - operator-bootstrap: Operator initialization - proof-verifier: Cryptographic proof verification - rfc3161-anchor: RFC3161 timestamping - secrets-vault: Secrets management 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
59
backup-sovereign/scripts/rollback/purge_outputs.sh
Executable file
59
backup-sovereign/scripts/rollback/purge_outputs.sh
Executable file
@@ -0,0 +1,59 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# === METADATA ===
|
||||
SCRIPT_NAME="$(basename "$0")"
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
SKILL_ROOT="$(dirname "$(dirname "$SCRIPT_DIR")")"
|
||||
|
||||
# === CONFIGURATION ===
|
||||
: "${OUTPUT_DIR:=$SKILL_ROOT/outputs}"
|
||||
|
||||
# === FUNCTIONS ===
|
||||
log_info() { echo "[INFO] $(date -Iseconds) $*"; }
|
||||
log_warn() { echo "[WARN] $(date -Iseconds) $*" >&2; }
|
||||
log_error() { echo "[ERROR] $(date -Iseconds) $*" >&2; }
|
||||
die() { log_error "$@"; exit 1; }
|
||||
|
||||
main() {
|
||||
if [[ ! -d "$OUTPUT_DIR" ]]; then
|
||||
log_info "Output directory does not exist. Nothing to purge."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
local run_count=0
|
||||
if [[ -d "$OUTPUT_DIR/runs" ]]; then
|
||||
run_count=$(find "$OUTPUT_DIR/runs" -mindepth 1 -maxdepth 1 -type d | wc -l | tr -d ' ')
|
||||
fi
|
||||
|
||||
log_warn "This will PERMANENTLY DELETE all backup outputs:"
|
||||
log_warn " Directory: $OUTPUT_DIR"
|
||||
log_warn " Backup runs: $run_count"
|
||||
log_warn ""
|
||||
log_warn "This action cannot be undone!"
|
||||
echo ""
|
||||
echo "Type 'PURGE ALL' to confirm:"
|
||||
read -r confirm
|
||||
[[ "$confirm" == "PURGE ALL" ]] || die "Aborted."
|
||||
|
||||
# Clean up any restore drill temp directories
|
||||
if [[ -d "$OUTPUT_DIR/runs" ]]; then
|
||||
for run_dir in "$OUTPUT_DIR/runs"/*; do
|
||||
if [[ -f "$run_dir/last_restore_dir.txt" ]]; then
|
||||
local restore_dir
|
||||
restore_dir="$(cat "$run_dir/last_restore_dir.txt")"
|
||||
if [[ -d "$restore_dir" ]]; then
|
||||
log_info "Removing restore temp: $restore_dir"
|
||||
rm -rf "$restore_dir"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
log_info "Purging outputs directory..."
|
||||
rm -rf "$OUTPUT_DIR"/*
|
||||
|
||||
log_info "Purge complete."
|
||||
}
|
||||
|
||||
[[ "${BASH_SOURCE[0]}" == "$0" ]] && main "$@"
|
||||
Reference in New Issue
Block a user