sync-to-remote.ps1 622 B

12345678
  1. param([Parameter(Mandatory=$true)][string]$Source,[Parameter(Mandatory=$true)][string]$RemotePartial)
  2. $ErrorActionPreference='Stop'
  3. $knownHosts=Join-Path $HOME '.ssh\known_hosts'
  4. & scp -o StrictHostKeyChecking=yes -o "UserKnownHostsFile=$knownHosts" -o ConnectTimeout=10 `
  5. $Source "edk2-uefi-lab:$RemotePartial"
  6. if($LASTEXITCODE -ne 0){throw 'REMOTE_NETWORK_UNSTABLE'}
  7. $sha=(Get-FileHash -Algorithm SHA256 -LiteralPath $Source).Hash.ToLowerInvariant()
  8. & "$PSScriptRoot\invoke-remote.ps1" "test \`$(sha256sum '$RemotePartial' | cut -d' ' -f1) = '$sha' && mv '$RemotePartial' '$($RemotePartial -replace '\.partial$','')'"