Files
TeslaRel410/emulator/deploy/postinstall.bat
T
CydandClaude Fable 5 33a192a1fc Deploy: Npcap is a one-time MANUAL install per cockpit (operator consensus)
Retire the bundled-silent-installer requirement: postinstall now detects an
existing Npcap service and moves on, warns clearly when absent, and still
honors a bundled deploy\npcap.exe if one is shipped. package.ps1 no longer
flags the missing bundle as a warning.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-10 23:49:36 -05:00

53 lines
2.2 KiB
Batchfile

@echo off
setlocal enabledelayedexpansion
REM ==========================================================================
REM postinstall.bat -- runs ELEVATED after TeslaLauncher extracts the zip to
REM the games root (C:\games). The zip root holds this file + ONE package
REM folder; this script finds that folder, installs the bundled Npcap, and
REM hands off to deploy\configure.ps1 for the NIC bind / IP derivation / conf
REM rendering. Air-gapped: nothing is downloaded. See DEPLOYMENT-PLAN.md.
REM ==========================================================================
echo [postinstall] starting
REM --- locate ROOT: the single package folder beside this script -----------
set "HERE=%~dp0"
set "ROOT="
for /d %%D in ("%HERE%*") do set "ROOT=%%~fD"
if not defined ROOT (
echo [postinstall] ERROR: no package folder found beside postinstall.bat
exit /b 1
)
echo [postinstall] ROOT=!ROOT!
REM --- 1. Npcap: POLICY (operator consensus 2026-07-10) = installed MANUALLY
REM once per cockpit. Detect an existing install; a bundled
REM deploy\npcap.exe is still honored if someone ships one.
set "NPCAP=!ROOT!\deploy\npcap.exe"
sc query npcap >nul 2>&1
if not errorlevel 1 (
echo [postinstall] Npcap already installed -- OK
) else if exist "!NPCAP!" (
echo [postinstall] installing bundled Npcap silently...
"!NPCAP!" /S
if errorlevel 1 ( echo [postinstall] ERROR: Npcap install failed & exit /b 1 )
) else (
echo [postinstall] WARNING: Npcap is NOT installed on this machine.
echo [postinstall] Run the Npcap installer manually ^(default options^),
echo [postinstall] then launch normally -- the pod's NIC bridge needs it.
)
REM --- optional: bundled VC++ runtime, if present --------------------------
set "VCREDIST=!ROOT!\deploy\vc_redist.x64.exe"
if exist "!VCREDIST!" (
echo [postinstall] installing VC++ runtime...
"!VCREDIST!" /install /quiet /norestart
)
REM --- 2-4. NIC bind + WATTCP my_ip=bayIP+100 + render confs (PowerShell) ---
echo [postinstall] configuring network + rendering confs...
powershell -NoProfile -ExecutionPolicy Bypass -File "!ROOT!\deploy\configure.ps1" -Root "!ROOT!"
if errorlevel 1 ( echo [postinstall] ERROR: configure.ps1 failed & exit /b 1 )
echo [postinstall] done
exit /b 0