From d893f1f33f230918e45148d4b0c6b2da57722fdd Mon Sep 17 00:00:00 2001 From: Michael Oliver Date: Wed, 30 Sep 2026 14:49:57 -0700 Subject: [PATCH] fix(install): only create CLI launcher shims when the packaged launcher supports them openutv.com/install.ps1 redirects to this file. It turned utvio/utvpkg/py-interp/utvls into copies of utv.exe (real binaries moved to -bin.exe) for every release, but only launchers built with #63 dispatch on their own file name. With the current release (2026.9) the shims started the viewer instead, and the viewer's startup update check (run via py-interp.exe) relaunched the viewer every few seconds. - Create shims only when the downloaded package ships openutv-run.cmd (post-#63 builds), checked before the package is moved into place. - Otherwise repair installs shimmed by the previous installer: keep the package's real .exe and drop the stale -bin copy. - With shim support, always refresh -bin.exe from the package. Fixes #73 Co-Authored-By: Claude Opus 5.5 Signed-off-by: Michael Oliver --- scripts/install.ps1 | 39 +++++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/scripts/install.ps1 b/scripts/install.ps1 index 33edc617..3c19383d 100644 --- a/scripts/install.ps1 +++ b/scripts/install.ps1 @@ -202,6 +202,17 @@ if (-not (Test-Path $sourceDir)) { $sourceDir = $tempExtract } +# Dedicated CLI tools get launcher shims (a copy of utv.exe as .exe, the real binary as +# -bin.exe). That needs a launcher that dispatches on its own file name, which only builds +# with OpenUTV/utv#63 have; they are the ones that ship openutv-run.cmd. An older launcher always +# starts the viewer, so shimming it made every CLI tool open a viewer, and the startup update check +# (which runs py-interp.exe) relaunch the viewer endlessly (OpenUTV/utv#73). Check the package +# itself, before it is moved into place, so files from a previous install can't fool the check. +$cliTools = @("utvio", "utvpkg", "py-interp", "utvls") +$sourceBin = Join-Path $sourceDir "bin" +$launcherSupportsShims = Test-Path (Join-Path $sourceBin "openutv-run.cmd") +$packagedTools = @($cliTools | Where-Object { Test-Path (Join-Path $sourceBin "$_.exe") }) + New-Item -ItemType Directory -Force -Path $InstallDir | Out-Null & robocopy $sourceDir $InstallDir /E /MOVE /NDL /NFL /NJH /NJS /nc /ns /np | Out-Null Remove-Item -Recurse -Force $tempExtract -ErrorAction SilentlyContinue @@ -225,16 +236,32 @@ if ((Test-Path $legacyQtConf) -and -not (Test-Path $qtPluginDir)) { Write-Host "Removed legacy qt.conf." -ForegroundColor Gray } -# Ensure dedicated CLI tools (utvio, utvpkg, py-interp, utvls) have -bin copies and launcher shims +# Give dedicated CLI tools (utvio, utvpkg, py-interp, utvls) -bin copies and launcher shims when the +# packaged launcher supports them (see $launcherSupportsShims above). $utvExe = Join-Path $binDir "utv.exe" -$cliTools = @("utvio", "utvpkg", "py-interp", "utvls") foreach ($tool in $cliTools) { $toolExe = Join-Path $binDir "$tool.exe" $toolBin = Join-Path $binDir "$tool-bin.exe" - if ((Test-Path $toolExe) -and -not (Test-Path $toolBin) -and (Test-Path $utvExe)) { - Move-Item -Force -Path $toolExe -Destination $toolBin - Copy-Item -Force -Path $utvExe -Destination $toolExe - Write-Host "Configured hermetic launcher for $tool.exe" -ForegroundColor Gray + $packaged = $packagedTools -contains $tool + + if ($launcherSupportsShims) { + if ($packaged -and (Test-Path $utvExe)) { + # .exe is this package's real binary; it replaces any -bin copy from a previous install. + Move-Item -Force -Path $toolExe -Destination $toolBin + Copy-Item -Force -Path $utvExe -Destination $toolExe + Write-Host "Configured hermetic launcher for $tool.exe" -ForegroundColor Gray + } + } + elseif (Test-Path $toolBin) { + # Repair an install shimmed against a launcher that can't dispatch (OpenUTV/utv#73). + if ($packaged) { + # This package's real .exe is already in place; drop the stale -bin copy. + Remove-Item -Force -Path $toolBin + } + else { + Move-Item -Force -Path $toolBin -Destination $toolExe + } + Write-Host "Restored $tool.exe (launcher shims need a newer OpenUTV build)" -ForegroundColor Gray } }