Add SSH-triggered Eve screenshots

This commit is contained in:
Meta Vens 2026-06-02 16:59:51 +01:00
commit df2953cc7f
3 changed files with 100 additions and 0 deletions

View file

@ -0,0 +1,31 @@
param(
[string] $Target = "eve",
[string] $OutputDirectory = "artifacts\screenshots"
)
$ErrorActionPreference = "Stop"
$projectRoot = Split-Path -Parent $PSScriptRoot
$outputRoot = Join-Path $projectRoot $OutputDirectory
New-Item -ItemType Directory -Force -Path $outputRoot | Out-Null
$stamp = Get-Date -Format "yyyyMMdd-HHmmss"
$localPath = Join-Path $outputRoot "eve-$stamp.png"
$remoteDir = "/var/mobile/Library/EveCanvas"
$remotePath = "$remoteDir/latest-screenshot.png"
$requestPath = "$remoteDir/capture-request"
ssh $Target "mkdir -p '$remoteDir' && chown mobile:mobile '$remoteDir' && rm -f '$remotePath' '$requestPath' && touch '$requestPath' && chown mobile:mobile '$requestPath'"
$deadline = (Get-Date).AddSeconds(10)
do {
Start-Sleep -Milliseconds 250
ssh $Target "test -s '$remotePath'"
if ($LASTEXITCODE -eq 0) {
scp "${Target}:$remotePath" $localPath
Write-Host $localPath
exit 0
}
} while ((Get-Date) -lt $deadline)
throw "Timed out waiting for EveCanvas screenshot at ${Target}:$remotePath"