Fix the damaged uninstaller that blocked every update from 1.4.35 on

On the TV the update stopped at "Bible App cannot be closed", and uninstalling
from Windows Settings showed "Installer integrity check has failed". The cause is
the uninstaller, not anything running.

An update runs the PREVIOUS version's uninstaller first. Versions 1.4.35-1.4.37
were built on macOS, where electron-builder can't run NSIS to write the uninstaller
and rebuilds it in JavaScript (UninstallerReader) from the installer's stub — without
NSIS's icon patch. makensis computes the uninstaller's CRC over the stub WITH the
uninstaller icon in it, so whenever the two icons differ the result fails NSIS's
integrity check. With no app icon configured, NSIS uses its two different default
icons, so every Mac-built uninstaller was damaged. Verified with a reimplementation
of NSIS's loadHeaders() check: the shipped installers pass; the captured uninstaller
failed (0x4235c8f5 vs stored 0x90f7de2c) and passes with this fix (0xb37e533c).

- build/installerIcon.ico: NSIS's own default install icon, so electron-builder uses
  ONE icon for installer and uninstaller (nothing looks different; the app's icon is
  unchanged). tools/build-win.cjs refuses to build without it.
- build/installer.nsh: for installs of 1.4.35-1.4.37 only, clear the old
  UninstallString so the damaged uninstaller is not run; the new files are copied over
  the old ones and a fresh, valid uninstaller is written. Every other version keeps
  the normal uninstall-then-install path.
- BUILD-AND-DEPLOY.md: why the icon file must stay.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-21 21:07:41 -04:00
co-authored by Claude Opus 5.5
parent 478763c60e
commit e7709e8756
4 changed files with 48 additions and 0 deletions
+29
View File
@@ -42,4 +42,33 @@
nsExec::Exec $2
Pop $0
Sleep 1000
!insertmacro bibleAppSkipDamagedUninstaller SHELL_CONTEXT
!insertmacro bibleAppSkipDamagedUninstaller HKCU
!macroend
; ---------------------------------------------------------------------------------------------------
; Versions 1.4.35 - 1.4.37 were built on macOS before build/installerIcon.ico existed, and their
; uninstallers are damaged: they fail NSIS's own integrity check ("Installer integrity check has
; failed"). electron-builder rebuilds the uninstaller in JavaScript on macOS and leaves out NSIS's
; icon patch, so whenever the installer and uninstaller icons differ (NSIS's two defaults do), the
; checksum is wrong. An update runs the PREVIOUS version's uninstaller first, so those versions could
; never be updated: the damaged uninstaller fails, and the installer reports "Bible App cannot be
; closed" (it also cannot be uninstalled from Windows Settings).
;
; For exactly those versions, the old uninstaller is not run: its UninstallString is cleared, so
; electron-builder's uninstallOldVersion finds nothing to run, and the new files are copied over the
; old ones. This installer then writes a fresh, valid uninstaller and registry entry. Every other
; version still goes through the normal uninstall-then-install path.
; ---------------------------------------------------------------------------------------------------
!macro bibleAppSkipDamagedUninstaller ROOT
ReadRegStr $3 ${ROOT} "${UNINSTALL_REGISTRY_KEY}" DisplayVersion
${If} $3 == "1.4.35"
${OrIf} $3 == "1.4.36"
${OrIf} $3 == "1.4.37"
DetailPrint `Version $3's uninstaller is damaged; installing over it instead.`
DeleteRegValue ${ROOT} "${UNINSTALL_REGISTRY_KEY}" UninstallString
!ifdef UNINSTALL_REGISTRY_KEY_2
DeleteRegValue ${ROOT} "${UNINSTALL_REGISTRY_KEY_2}" UninstallString
!endif
${EndIf}
!macroend
Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB