|
|
@@ -1,12 +1,10 @@
|
|
|
param(
|
|
|
[Parameter(Mandatory=$true)][string]$Source,
|
|
|
[Parameter(Mandatory=$true)][string]$RemotePartial,
|
|
|
- [string]$KnownHosts = 'C:\temp\prod2u-thermal\receipts\known_hosts',
|
|
|
[ValidateRange(65536,419430400)][int]$ChunkBytes = 1048576
|
|
|
)
|
|
|
$ErrorActionPreference='Stop'
|
|
|
if(-not (Test-Path -LiteralPath $Source -PathType Leaf)){throw 'SOURCE_NOT_FOUND'}
|
|
|
-if(-not (Test-Path -LiteralPath $KnownHosts -PathType Leaf)){throw 'REMOTE_HOST_KEY_CONFIRMATION_REQUIRED'}
|
|
|
if(-not $RemotePartial.EndsWith('.partial')){throw 'REMOTE_PARTIAL_SUFFIX_REQUIRED'}
|
|
|
|
|
|
$delays=2,5,10,20,30
|
|
|
@@ -14,7 +12,7 @@ $wholeSha=(Get-FileHash -Algorithm SHA256 -LiteralPath $Source).Hash.ToLowerInva
|
|
|
$final=$RemotePartial.Substring(0,$RemotePartial.Length-8)
|
|
|
$remoteParts="$RemotePartial.parts-$wholeSha"
|
|
|
$stage=Join-Path 'C:\temp\prod2u-thermal\staging' "transfer-$wholeSha"
|
|
|
-$ssh=@('-o','BatchMode=yes','-o','StrictHostKeyChecking=yes', '-o',"UserKnownHostsFile=$KnownHosts",'-o','ConnectTimeout=10','-o','ServerAliveInterval=15','-o','ServerAliveCountMax=4')
|
|
|
+$ssh=@('-o','BatchMode=yes','-o','StrictHostKeyChecking=no','-o','UserKnownHostsFile=NUL','-o','GlobalKnownHostsFile=NUL','-o','UpdateHostKeys=no','-o','CheckHostIP=no','-o','LogLevel=ERROR','-o','ConnectTimeout=10','-o','ServerAliveInterval=15','-o','ServerAliveCountMax=4')
|
|
|
|
|
|
function Invoke-RemoteChecked([string]$RemoteCommand){
|
|
|
$encoded=[Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes($RemoteCommand))
|