#!/bin/bash
# Copy deployment scripts to OMV share
# Run this from your PC/terminal where you have SSH access to Proxmox

PROXMOX_HOST="10.0.10.3"
OPENCLAW_HOST="10.0.10.28"
OMV_SCRIPTS="/mnt/omv-backups/scripts"

echo "📋 Copying deployment scripts to OMV share..."
echo ""

# Create scripts directory on Proxmox/OMV
echo "Creating scripts directory..."
ssh root@${PROXMOX_HOST} "mkdir -p ${OMV_SCRIPTS}"

# Copy deployment script from OpenClaw to OMV
echo "Copying deploy-inline.sh..."
ssh root@${OPENCLAW_HOST} "cat /root/.openclaw/workspace/fred-infrastructure/deploy-inline.sh" | \
  ssh root@${PROXMOX_HOST} "cat > ${OMV_SCRIPTS}/deploy-prometheus-alerts.sh"

# Make executable
ssh root@${PROXMOX_HOST} "chmod +x ${OMV_SCRIPTS}/deploy-prometheus-alerts.sh"

echo ""
echo "✅ Script copied to OMV share!"
echo ""
echo "Location: ${PROXMOX_HOST}:${OMV_SCRIPTS}/deploy-prometheus-alerts.sh"
echo ""
echo "To deploy the alert fix, SSH to Proxmox and run:"
echo "  ssh root@${PROXMOX_HOST}"
echo "  bash ${OMV_SCRIPTS}/deploy-prometheus-alerts.sh"
echo ""
