Files
TeslaRel410/emulator/deploy/package.ps1
T
CydandClaude Opus 4.8 9df87f2c01 Deploy: pod install scaffold -- supervisor entry-point, postinstall, packaging
Network-agnostic, air-gapped pod install for the two DOSBox titles (BT/RP 4.10),
fitting the existing TeslaConsole/TeslaLauncher pod-bay architecture.

emulator/DEPLOYMENT-PLAN.md
  Full design: bridge on the one NIC (pods form a source-proven P2P TCP mesh, so
  NAT/slirp is out); launcher keeps the bay IP, the DOSBox guest bridges at
  bayIP+100 (egg/mesh/game endpoint); two-edit +100 convention (postinstall +
  console DOSBox flag); static, air-gapped, <=32 pods.

emulator/pod-launch/  (C# net8 supervising entry-point)
  Creates a Job Object (KILL_ON_JOB_CLOSE), launches DOSBox-X + the render bridge
  into it and blocks -- kill this process and both die (kernel-enforced, even on
  a hard TerminateProcess of a hung session; verified). Mode dispatch: bt/rp
  wired (also serve camera + live mission-review via egg hostType); review +
  diagnostics recognized but fail clean until their DOS launch args are known.

emulator/deploy/  (install side)
  postinstall.bat (thin elevated wrapper) + configure.ps1 (NIC detect, realnic
  bind as a contiguous letter-leading GUID fragment, game IP = bayIP+100, stable
  MAC, render net_*.conf templates, stamp WATTCP.CFG my_ip) + tokenized conf
  templates + package.ps1 (assemble the zip). Render/bind/stamp + packaging
  verified against a scratch tree.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-10 10:36:30 -05:00

94 lines
4.5 KiB
PowerShell

# package.ps1 -- assemble the deployable pod zip from repo sources + a fresh
# self-contained pod-launch publish. Output: <OutDir>\<PackageName>.zip whose
# ROOT holds postinstall.bat + the single package folder (extract to C:\games).
# See README.md for the tree. Externally-procured pieces (Npcap, frozen renderer)
# are bundled only if their paths are passed; otherwise they're flagged missing.
param(
[string]$PackageName = "TeslaPod410",
[string]$OutDir,
[string]$Npcap, # bundled Npcap silent installer -> deploy\npcap.exe
[string]$Renderer, # frozen renderer exe -> renderer.exe
[string]$VcRedist, # optional VC++ runtime -> deploy\vc_redist.x64.exe
[switch]$NoContent, # skip ALPHA_1 + net-boot (fast structural test)
[switch]$SkipBuild # reuse the last pod-launch publish
)
$ErrorActionPreference = 'Stop'
function Log($m) { Write-Host "[package] $m" }
function Warn($m) { Write-Warning "[package] $m" }
$Repo = (Resolve-Path "$PSScriptRoot\..\..").Path
$Emu = Join-Path $Repo 'emulator'
if (-not $OutDir) { $OutDir = Join-Path $Emu 'dist' }
New-Item -ItemType Directory -Force $OutDir | Out-Null
# --- 1. build pod-launch.exe (self-contained single-file, no runtime needed) --
$plProj = Join-Path $Emu 'pod-launch\pod-launch.csproj'
$plOut = Join-Path $Emu 'pod-launch\bin\pkg'
if (-not $SkipBuild) {
Log "publishing pod-launch (self-contained win-x64)..."
dotnet publish $plProj -c Release -r win-x64 --self-contained true `
-p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true `
-o $plOut | Out-Null
if ($LASTEXITCODE -ne 0) { throw "dotnet publish failed" }
}
$podLaunch = Join-Path $plOut 'pod-launch.exe'
if (-not (Test-Path $podLaunch)) { throw "pod-launch.exe not found at $podLaunch" }
# --- 2. stage the tree --------------------------------------------------------
$stage = Join-Path $OutDir '_stage'
if (Test-Path $stage) { Remove-Item $stage -Recurse -Force }
$root = Join-Path $stage $PackageName
New-Item -ItemType Directory -Force (Join-Path $root 'deploy') | Out-Null
New-Item -ItemType Directory -Force (Join-Path $root 'roms') | Out-Null
# postinstall.bat -> zip ROOT (beside the package folder)
Copy-Item (Join-Path $Emu 'deploy\postinstall.bat') $stage
# supervisor
Copy-Item $podLaunch $root
# DOSBox-X + its DLLs
$dbDir = Join-Path $Emu 'src\src'
Copy-Item (Join-Path $dbDir 'dosbox-x.exe') $root
$dlls = Get-ChildItem (Join-Path $dbDir '*.dll') -ErrorAction SilentlyContinue
if ($dlls) { $dlls | ForEach-Object { Copy-Item $_.FullName $root } ; Log "copied $($dlls.Count) DLL(s) beside dosbox-x.exe" }
else { Warn "no DLLs beside dosbox-x.exe -- verify the MinGW/SDL runtime DLLs the build needs are present" }
# conf templates + configure.ps1
Copy-Item (Join-Path $Emu 'deploy\net_loop.conf.tmpl') $root
Copy-Item (Join-Path $Emu 'deploy\net_rp.conf.tmpl') $root
Copy-Item (Join-Path $Emu 'deploy\configure.ps1') (Join-Path $root 'deploy')
# AWE32 ROM
Copy-Item (Join-Path $Emu 'roms\awe32.raw') (Join-Path $root 'roms')
# game content + packet drivers (large)
if ($NoContent) {
Warn "-NoContent: skipping ALPHA_1 + net-boot (structural test only, NOT installable)"
} else {
Log "copying ALPHA_1 game content (large)..."
Copy-Item (Join-Path $Repo 'ALPHA_1') $root -Recurse
Copy-Item (Join-Path $Emu 'net-boot') $root -Recurse
}
# renderer (frozen exe) -- else flagged
if ($Renderer) { Copy-Item $Renderer (Join-Path $root 'renderer.exe'); Log "bundled renderer -> renderer.exe" }
else { Warn "no -Renderer: renderer NOT bundled (freeze pending). pod-launch needs --renderer or a bundled render-bridge at runtime." }
# Npcap installer -- else flagged
if ($Npcap) { Copy-Item $Npcap (Join-Path $root 'deploy\npcap.exe'); Log "bundled Npcap -> deploy\npcap.exe" }
else { Warn "no -Npcap: installer NOT bundled. postinstall will warn + the pcap bridge won't work until Npcap is present." }
if ($VcRedist) { Copy-Item $VcRedist (Join-Path $root 'deploy\vc_redist.x64.exe'); Log "bundled VC++ runtime" }
# --- 3. zip -------------------------------------------------------------------
$zip = Join-Path $OutDir "$PackageName.zip"
if (Test-Path $zip) { Remove-Item $zip -Force }
Log "compressing -> $zip"
Compress-Archive -Path (Join-Path $stage '*') -DestinationPath $zip
Remove-Item $stage -Recurse -Force
$size = "{0:N1} MB" -f ((Get-Item $zip).Length / 1MB)
Log "DONE: $zip ($size)"
Log "zip root = postinstall.bat + $PackageName\ (TeslaLauncher extracts to C:\games, runs postinstall.bat elevated)"