Critical fix for DOS 6.22 compatibility - CRLF line endings were being converted to LF during AD2-to-NAS sync, causing BAT files to fail on DOS. Root Cause: - OpenSSH scp uses SFTP protocol by default (text mode) - SFTP converts line endings (CRLF → LF) - DOS 6.22 requires CRLF for batch file execution Solution - Fixed AD2 Sync Script: - Added -O flag to scp commands in Sync-FromNAS.ps1 - Forces legacy SCP protocol (binary mode) - Preserves CRLF line endings during transfer Created deployment scripts: - fix-ad2-scp-line-endings.ps1: Updates Sync-FromNAS.ps1 with -O flag - deploy-all-bat-files.ps1: Deploy 6 BAT files to AD2 (UPDATE, NWTOC, CTONW, CHECKUPD, REBOOT, DEPLOY) - deploy-bat-to-nas-direct.ps1: Direct SCP to NAS with -O flag for immediate testing - verify-nas-crlf.ps1: Validates CRLF preservation on NAS Created diagnostic scripts: - check-line-endings.ps1: Compare original vs NAS file line endings - check-ad2-sync-log.ps1: Monitor sync log on AD2 - check-ad2-bat-files.ps1: Verify files on AD2 - check-scp-commands.ps1: Analyze SCP command usage - trigger-ad2-sync-now.ps1: Manual sync trigger for testing Verification: - DEPLOY.BAT: 9,753 bytes with CRLF (was 9,408 bytes with LF) - All 6 BAT files deployed to NAS with CRLF preserved - DOS machines can now execute batch files from T:\ Files deployed: - DEPLOY.BAT (one-time installer) - UPDATE.BAT (backup utility) - NWTOC.BAT (network to computer updates) - CTONW.BAT (computer to network uploads) - CHECKUPD.BAT (check for updates) - REBOOT.BAT (reboot utility) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
54 lines
1.5 KiB
PowerShell
54 lines
1.5 KiB
PowerShell
# Check line endings in BAT files
|
|
|
|
Write-Host "[INFO] Checking line endings..."
|
|
Write-Host ""
|
|
|
|
# Check original
|
|
$Original = Get-Content "DEPLOY.BAT" -Raw
|
|
$HasCRLF_Original = $Original -match "`r`n"
|
|
$HasLF_Original = $Original -match "[^`r]`n"
|
|
|
|
Write-Host "DEPLOY.BAT (Original):"
|
|
if ($HasCRLF_Original) {
|
|
Write-Host " [OK] Contains CRLF (DOS-compatible)"
|
|
} elseif ($HasLF_Original) {
|
|
Write-Host " [WARNING] Contains LF only (Unix format)"
|
|
} else {
|
|
Write-Host " [UNKNOWN] No line breaks detected"
|
|
}
|
|
|
|
Write-Host ""
|
|
|
|
# Check NAS copy
|
|
if (Test-Path "DEPLOY_FROM_NAS.BAT") {
|
|
$FromNAS = Get-Content "DEPLOY_FROM_NAS.BAT" -Raw
|
|
$HasCRLF_NAS = $FromNAS -match "`r`n"
|
|
$HasLF_NAS = $FromNAS -match "[^`r]`n"
|
|
|
|
Write-Host "DEPLOY_FROM_NAS.BAT (From NAS):"
|
|
if ($HasCRLF_NAS) {
|
|
Write-Host " [OK] Contains CRLF (DOS-compatible)"
|
|
} elseif ($HasLF_NAS) {
|
|
Write-Host " [ERROR] Contains LF only (Unix format - DOS won't work!)"
|
|
} else {
|
|
Write-Host " [UNKNOWN] No line breaks detected"
|
|
}
|
|
|
|
# Compare file sizes
|
|
$OrigSize = (Get-Item "DEPLOY.BAT").Length
|
|
$NASSize = (Get-Item "DEPLOY_FROM_NAS.BAT").Length
|
|
|
|
Write-Host ""
|
|
Write-Host "File Sizes:"
|
|
Write-Host " Original: $OrigSize bytes"
|
|
Write-Host " From NAS: $NASSize bytes"
|
|
|
|
if ($OrigSize -ne $NASSize) {
|
|
Write-Host " [WARNING] Size mismatch - line endings may have been converted"
|
|
} else {
|
|
Write-Host " [OK] Sizes match"
|
|
}
|
|
} else {
|
|
Write-Host "[ERROR] DEPLOY_FROM_NAS.BAT not found"
|
|
}
|