param( [string]$PythonHome = $env:EDGE_PYTHON_HOME ) $ErrorActionPreference = "Stop" if (-not $PythonHome) { throw "Python runtime directory is required. Pass -PythonHome or set EDGE_PYTHON_HOME." } $resolvedPythonHome = (Resolve-Path -LiteralPath $PythonHome).Path $root = Split-Path -Parent $PSScriptRoot $dist = Join-Path $root "dist" $timestamp = Get-Date -Format "yyyyMMdd-HHmmss" $packageRoot = Join-Path $dist "edge-agent-linux-$timestamp" $runtimeRoot = Join-Path $packageRoot "runtime\python" $archivePath = Join-Path $dist "edge-agent-linux-$timestamp.tar.gz" New-Item -ItemType Directory -Path $packageRoot -Force | Out-Null New-Item -ItemType Directory -Path $runtimeRoot -Force | Out-Null New-Item -ItemType Directory -Path $dist -Force | Out-Null Copy-Item -LiteralPath (Join-Path $root "app") -Destination $packageRoot -Recurse Copy-Item -LiteralPath (Join-Path $root "README.md") -Destination $packageRoot Copy-Item -LiteralPath (Join-Path $root "pyproject.toml") -Destination $packageRoot Copy-Item -LiteralPath (Join-Path $PSScriptRoot "start-linux.sh") -Destination (Join-Path $packageRoot "start.sh") Get-ChildItem -LiteralPath $resolvedPythonHome -Force | Copy-Item -Destination $runtimeRoot -Recurse tar -czf $archivePath -C $packageRoot . Write-Output $archivePath