Files
proxmox/scripts/fix-besu-installation.sh
defiQUG 0d29343941 chore: update .env.master.example with new deployment scripts and treasury manager parameters; enhance AGENTS.md with GRU reference primacy details
- Added new deployment script references for Aave quote-push and treasury manager in .env.master.example.
- Updated AGENTS.md to include information on GRU reference primacy versus public PMM mesh execution model.
- Minor updates to various documentation files to reflect changes in policy and operational guidelines.

Made-with: Cursor
2026-04-12 18:20:41 -07:00

82 lines
2.1 KiB
Bash
Executable File

#!/usr/bin/env bash
# Fix Besu installation on selected nodes.
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
source "$PROJECT_ROOT/scripts/lib/load-project-env.sh"
APPLY=false
TARGET_VMIDS=()
usage() {
cat <<'EOF'
Usage: ./scripts/fix-besu-installation.sh --vmid <N> [--vmid <N> ...] [--apply]
Options:
--vmid <N> Required. Limit fix to one or more VMIDs.
--apply Perform the install fix. Without this flag, the script prints the target VMIDs and exits.
EOF
}
while [[ $# -gt 0 ]]; do
case "$1" in
--vmid)
[[ $# -ge 2 ]] || { usage >&2; exit 2; }
TARGET_VMIDS+=("$2")
shift 2
;;
--apply)
APPLY=true
shift
;;
-h|--help)
usage
exit 0
;;
*)
echo "Unknown argument: $1" >&2
usage >&2
exit 2
;;
esac
done
[[ ${#TARGET_VMIDS[@]} -gt 0 ]] || { usage >&2; exit 2; }
if ! $APPLY; then
echo "Dry-run only. Target VMIDs:"
for vmid in "${TARGET_VMIDS[@]}"; do
echo " VMID $vmid on $(get_host_for_vmid "$vmid")"
done
echo "Re-run with --apply to perform the Besu installation fix."
exit 0
fi
fix_besu() {
local vmid=$1
local host
host="$(get_host_for_vmid "$vmid")"
ssh -o StrictHostKeyChecking=no root@${host} "pct exec $vmid -- bash -c '
cd /opt
if [ -f besu-23.10.3.tar.gz ] && [ ! -d besu-23.10.3 ]; then
echo \"Extracting Besu for $vmid...\"
tar -xzf besu-23.10.3.tar.gz
fi
if [ -d besu-23.10.3 ] && [ ! -L besu ]; then
ln -sf besu-23.10.3 besu
fi
if [ -d besu-23.10.3 ]; then
chown -R besu:besu besu-23.10.3 besu 2>/dev/null || true
echo \"Besu fixed for $vmid\"
fi
'" 2>&1 | grep -E "(Extracting|fixed)" || true
}
for vmid in "${TARGET_VMIDS[@]}"; do
fix_besu "$vmid" &
done
wait
echo "Besu installation fix attempted on selected nodes"