#!/bin/bash
# =============================================================================
# staking-monitor postinst
# Sets permissions on installed scripts and prints usage instructions.
# =============================================================================

set -e

SHARE_DIR="/usr/share/staking-monitor"

# Make all scripts executable
find "${SHARE_DIR}" -name "*.sh" -exec chmod 755 {} \;
find "${SHARE_DIR}" -name "*.env.example" -exec chmod 644 {} \;
find "${SHARE_DIR}" -name "*.md" -exec chmod 644 {} \;
find "${SHARE_DIR}" -name "*-crontab" -exec chmod 644 {} \;

echo ""
echo "════════════════════════════════════════════════════════"
echo "  staking-monitor installed successfully"
echo "════════════════════════════════════════════════════════"
echo ""
echo "  1. obol-monitor — Obol DVT cluster monitoring"
echo "     Run the installer on each node:"
echo ""
echo "     bash /usr/share/staking-monitor/obol-monitor/install.sh obol"
echo "     bash /usr/share/staking-monitor/obol-monitor/install.sh control"
echo "     bash /usr/share/staking-monitor/obol-monitor/install.sh control-failover"
echo ""
echo "  2. validator-monitor — Standalone validator duty monitoring"
echo "     bash /usr/share/staking-monitor/validator-monitor/install.sh"
echo ""
echo "  3. Validator key import tools:"
echo "     /usr/share/staking-monitor/tools/"
echo ""
echo "  Documentation: /usr/share/doc/staking-monitor/README.md"
echo "════════════════════════════════════════════════════════"
