diff --git a/packaging/windows/README.md b/packaging/windows/README.md index 87b9fb6..546084c 100644 --- a/packaging/windows/README.md +++ b/packaging/windows/README.md @@ -19,7 +19,7 @@ vendor-signed `wintun.dll`, `licenses`, and `build-info.json`. The NSIS compiler adds the generated uninstaller; it is not a separately built executable. The installer, extraction progress and uninstaller use the shared Windows icon -from `apps/gpauth/icons/windows/icon.ico`. The Finish page uses `sidebar.bmp`, +from `apps/gpauth/icons/windows/icon.ico`. The confirmation and Finish pages use `sidebar.bmp`, derived from that same icon. After regenerating application icons, run `powershell -NoProfile -File scripts/generate-windows-installer-artwork.ps1` on Windows and retain the updated bitmap before building installers. @@ -54,6 +54,12 @@ from the Start menu after completion. User configuration and licensing state are retained during upgrades and uninstall. Authenticode setup is separate; WinSparkle must still verify the installer payload signature before handoff. +Manual launches show an Install/Cancel confirmation page (Update/Cancel when +GP Connect is already installed). The update feed supplies `/UPDATE` through +WinSparkle's `sparkle:installerArguments` to skip that page after the user has +already confirmed the in-app update. This is not silent mode: elevation, +installation progress, errors, and the Finish page remain visible. + The service log rotates after 5 MiB and retains three numbered archives, keeping each entry whole. The bundle includes `licenses/file-rotate.txt` for the Windows service's rotation library. diff --git a/packaging/windows/installer.nsi b/packaging/windows/installer.nsi index 766eeda..aee3af0 100644 --- a/packaging/windows/installer.nsi +++ b/packaging/windows/installer.nsi @@ -2,6 +2,7 @@ Unicode true RequestExecutionLevel admin !include "MUI2.nsh" !include "x64.nsh" +!include "FileFunc.nsh" !ifndef PAYLOAD_DIR !error "PAYLOAD_DIR is required" @@ -33,12 +34,18 @@ VIAddVersionKey "FileVersion" "${BUILD_VERSION}" VIAddVersionKey "LegalCopyright" "GP Connect contributors" ShowInstDetails show ShowUninstDetails show +Var InstallAction !define MUI_ICON "${__FILEDIR__}\..\..\apps\gpauth\icons\windows\icon.ico" !define MUI_UNICON "${MUI_ICON}" !define MUI_WELCOMEFINISHPAGE_BITMAP "${__FILEDIR__}\sidebar.bmp" !define MUI_ABORTWARNING !define MUI_FINISHPAGE_TITLE "GP Connect is ready" !define MUI_FINISHPAGE_TEXT "Open GP Connect from the Start menu." +!define MUI_WELCOMEPAGE_TITLE "$InstallAction GP Connect" +!define MUI_WELCOMEPAGE_TEXT "$InstallAction GP Connect for all users on this computer.$\r$\n$\r$\nClick $InstallAction to continue." +!define MUI_PAGE_CUSTOMFUNCTION_PRE ConfirmInstall +!define MUI_PAGE_CUSTOMFUNCTION_SHOW ShowInstallAction +!insertmacro MUI_PAGE_WELCOME !insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_PAGE_FINISH !insertmacro MUI_UNPAGE_CONFIRM @@ -62,6 +69,25 @@ Function .onInit !error "Unsupported TARGET_ARCH" !endif SetRegView 64 + StrCpy $InstallAction "Install" + ReadRegStr $0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\GPConnect" "DisplayVersion" + ${If} $0 != "" + StrCpy $InstallAction "Update" + ${EndIf} +FunctionEnd + +Function ConfirmInstall + ${GetParameters} $0 + ClearErrors + ${GetOptions} $0 "/UPDATE" $1 + ${IfNot} ${Errors} + Abort + ${EndIf} +FunctionEnd + +Function ShowInstallAction + GetDlgItem $0 $HWNDPARENT 1 + SendMessage $0 ${WM_SETTEXT} 0 "STR:$InstallAction" FunctionEnd Section "Install" diff --git a/scripts/tests/test_windows_update_feed.py b/scripts/tests/test_windows_update_feed.py index 6ac8f3b..c05161c 100644 --- a/scripts/tests/test_windows_update_feed.py +++ b/scripts/tests/test_windows_update_feed.py @@ -64,6 +64,7 @@ class WindowsFeedTests(unittest.TestCase): self.assertEqual(int(enclosure.get("length")), payload.installer.stat().st_size) self.assertEqual(enclosure.get(f"{{{feed.SPARKLE}}}edSignature"), payload.signature_file.read_text()) self.assertEqual(enclosure.get(f"{{{feed.SPARKLE}}}os"), f"windows-{payload.architecture}") + self.assertEqual(enclosure.get(f"{{{feed.SPARKLE}}}installerArguments"), "/UPDATE") self.assertEqual(enclosure.get(f"{{{feed.SPARKLE}}}version"), "3.4.0") minimum = "10.0.22000" if payload.architecture == "arm64" else "10.0.19041" self.assertEqual(item.findtext(f"{{{feed.SPARKLE}}}minimumSystemVersion"), minimum) diff --git a/scripts/windows-update-feed.py b/scripts/windows-update-feed.py index 0b9d339..d6b1e06 100644 --- a/scripts/windows-update-feed.py +++ b/scripts/windows-update-feed.py @@ -102,6 +102,7 @@ def generate(args: argparse.Namespace) -> None: "url": payload.installer_url, "length": str(length), "type": "application/octet-stream", f"{{{SPARKLE}}}version": display_version, f"{{{SPARKLE}}}shortVersionString": display_version, + f"{{{SPARKLE}}}installerArguments": "/UPDATE", f"{{{SPARKLE}}}os": f"windows-{payload.architecture}", f"{{{SPARKLE}}}edSignature": signature, }) ET.indent(rss)