#!/bin/bash
# deploy-to-nas.sh - Deploy batch files to NAS with validation
# Always validates and fixes before deploying

set -e

echo "======================================"
echo "DOS Batch File Deployment"
echo "======================================"
echo ""

# Step 1: Validate and fix
echo "Step 1: Validating and fixing batch files..."
./validate-dos.sh --fix

# Step 2: Re-validate (should have no trailing space issues)
echo ""
echo "Step 2: Re-validating..."
./validate-dos.sh 2>&1 | grep -v "WARNING" | tail -5

# Step 3: Deploy to NAS
echo ""
echo "Step 3: Deploying to NAS..."
scp *.BAT root@192.168.0.9:/data/test/COMMON/ProdSW/

echo ""
echo "======================================"
echo "Deployment complete!"
echo "======================================"
echo ""
echo "Files deployed to T:\\COMMON\\ProdSW"
echo "Run NWTOC on DOS machine to download updates"
