; Per-user installer for the Luminary Windows bundle, built with NSIS 3. ; ; NSIS runs on Linux, macOS and Windows, so the same build host that produces ; the zip also produces the setup executable: ; ; node windows/build.mjs --installer --publish ; ; or by hand, from the repository root: ; ; makensis -DAPP_VERSION=0.5.1 -DAPP_VERSION4=0.5.1.0 \ ; -DSOURCE_DIR="$PWD/../.cache/stage/Luminary" windows/installer.nsi ; ; Nothing is installed for all users: no UAC prompt, no Program Files. The ; program goes to %LOCALAPPDATA%\Programs\Luminary and the catalog stays in ; %LOCALAPPDATA%\Luminary\data, which the uninstaller never touches. Unicode true ManifestDPIAware true ManifestSupportedOS win10 RequestExecutionLevel user SetCompressor /SOLID lzma SetCompressorDictSize 32 CRCCheck on !include "MUI2.nsh" !include "x64.nsh" !include "WinVer.nsh" !ifndef APP_VERSION !define APP_VERSION "0.5.1" !endif ; NSIS wants four numeric fields for the exe's version resource. !ifndef APP_VERSION4 !define APP_VERSION4 "0.5.1.0" !endif ; Forward slashes throughout: makensis is cross-platform, and this file is ; compiled on Linux as often as on Windows. !ifndef SOURCE_DIR !define SOURCE_DIR "${__FILEDIR__}/stage/Luminary" !endif !ifndef OUTPUT_DIR !define OUTPUT_DIR "${__FILEDIR__}/installer-output" !endif !ifndef ICON !define ICON "${__FILEDIR__}/launcher/Luminary.ico" !endif ; Size of the installed tree in KB, for Add/Remove Programs. The builder ; measures the staged bundle; the fallback is roughly right for a full build. !ifndef INSTALL_KB !define INSTALL_KB "250000" !endif !define APP_NAME "Luminary" !define APP_PUBLISHER "Maple Street" !define APP_URL "https://git.maple-street.net/bhursey/luminary" !define UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\Luminary" !define APP_KEY "Software\Luminary" !define RUN_KEY "Software\Microsoft\Windows\CurrentVersion\Run" Name "${APP_NAME} ${APP_VERSION}" BrandingText "${APP_NAME} ${APP_VERSION}" OutFile "${OUTPUT_DIR}/Luminary-${APP_VERSION}-win-x64-setup.exe" InstallDir "$LOCALAPPDATA\Programs\Luminary" InstallDirRegKey HKCU "${APP_KEY}" "InstallDir" VIProductVersion "${APP_VERSION4}" VIAddVersionKey "ProductName" "${APP_NAME}" VIAddVersionKey "ProductVersion" "${APP_VERSION}" VIAddVersionKey "FileDescription" "${APP_NAME} setup" VIAddVersionKey "FileVersion" "${APP_VERSION}" VIAddVersionKey "CompanyName" "${APP_PUBLISHER}" VIAddVersionKey "LegalCopyright" "MIT licensed" !define MUI_ICON "${ICON}" !define MUI_UNICON "${ICON}" !define MUI_ABORTWARNING !define MUI_WELCOMEPAGE_TITLE "Install ${APP_NAME} ${APP_VERSION}" !define MUI_WELCOMEPAGE_TEXT "This installs the Luminary desktop app for your Windows account.$\r$\n$\r$\nNo administrator rights are needed: the app goes in your own AppData folder, and the catalog, previews and originals index stay in %LOCALAPPDATA%\Luminary\data. Uninstalling keeps that folder so you never lose a catalog.$\r$\n$\r$\nNode.js, .NET and the Visual C++ runtime are not required - everything Luminary needs ships inside." !define MUI_FINISHPAGE_TEXT "${APP_NAME} is installed.$\r$\n$\r$\nYour catalog lives in %LOCALAPPDATA%\Luminary\data. Back it up by copying that folder while Luminary is stopped.$\r$\n$\r$\nUninstalling removes the app but not the catalog." !define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\README-windows.txt" !define MUI_FINISHPAGE_SHOWREADME_TEXT "Show the Windows readme" !define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED !if /FileExists "${SOURCE_DIR}/Luminary.vbs" !define MUI_FINISHPAGE_RUN "$INSTDIR\Luminary.vbs" !else !define MUI_FINISHPAGE_RUN "$INSTDIR\Luminary.cmd" !endif !define MUI_FINISHPAGE_RUN_TEXT "Start ${APP_NAME}" !insertmacro MUI_PAGE_WELCOME !if /FileExists "${SOURCE_DIR}/LICENSE" !insertmacro MUI_PAGE_LICENSE "${SOURCE_DIR}/LICENSE" !endif !insertmacro MUI_PAGE_COMPONENTS !insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_PAGE_FINISH !insertmacro MUI_UNPAGE_CONFIRM !insertmacro MUI_UNPAGE_INSTFILES !insertmacro MUI_LANGUAGE "English" LangString DESC_Main ${LANG_ENGLISH} "The editor, film looks, bundled Node runtime and documentation. Required." LangString DESC_Desktop ${LANG_ENGLISH} "Put a Luminary shortcut on the desktop." LangString DESC_Startup ${LANG_ENGLISH} "Start Luminary in the background when you sign in to Windows." Function .onInit ; The launcher refuses these too, but the installer should say so before it ; copies 250 MB onto an unsupported PC. ${IfNot} ${RunningX64} MessageBox MB_ICONSTOP "${APP_NAME} needs 64-bit Windows 10 or 11. This PC is running a 32-bit copy of Windows." Abort ${EndIf} ${IfNot} ${AtLeastWin10} MessageBox MB_ICONSTOP "${APP_NAME} needs Windows 10 or 11. Older versions are not supported." Abort ${EndIf} FunctionEnd ; Stop a copy started from this folder, so an upgrade can replace node.exe and ; app\ while it is not in use. Uses the launcher's own -Stop path, which reads ; runtime.json, rather than killing every node.exe on the machine. !macro StopRunning ${If} ${FileExists} "$INSTDIR\Luminary.ps1" DetailPrint "Stopping a running Luminary..." nsExec::ExecToLog 'powershell.exe -NoProfile -ExecutionPolicy Bypass -File "$INSTDIR\Luminary.ps1" -Stop' Pop $0 Sleep 1200 ${EndIf} !macroend Section "Luminary (required)" SEC_MAIN SectionIn RO !insertmacro StopRunning SetOutPath "$INSTDIR" File /r "${SOURCE_DIR}/*.*" CreateDirectory "$LOCALAPPDATA\Luminary\data" WriteUninstaller "$INSTDIR\Uninstall.exe" CreateDirectory "$SMPROGRAMS\Luminary" !if /FileExists "${SOURCE_DIR}/Luminary.vbs" CreateShortCut "$SMPROGRAMS\Luminary\Luminary.lnk" "$INSTDIR\Luminary.vbs" "" "$INSTDIR\Luminary.ico" 0 !else CreateShortCut "$SMPROGRAMS\Luminary\Luminary.lnk" "$INSTDIR\Luminary.cmd" "" "$INSTDIR\Luminary.ico" 0 !endif CreateShortCut "$SMPROGRAMS\Luminary\Stop Luminary.lnk" "$INSTDIR\Stop Luminary.cmd" "" "$INSTDIR\Luminary.ico" 0 CreateShortCut "$SMPROGRAMS\Luminary\Luminary data folder.lnk" "$LOCALAPPDATA\Luminary\data" "" "$INSTDIR\Luminary.ico" 0 WriteRegStr HKCU "${APP_KEY}" "InstallDir" "$INSTDIR" WriteRegStr HKCU "${APP_KEY}" "Version" "${APP_VERSION}" WriteRegStr HKCU "${UNINST_KEY}" "DisplayName" "${APP_NAME}" WriteRegStr HKCU "${UNINST_KEY}" "DisplayVersion" "${APP_VERSION}" WriteRegStr HKCU "${UNINST_KEY}" "Publisher" "${APP_PUBLISHER}" WriteRegStr HKCU "${UNINST_KEY}" "URLInfoAbout" "${APP_URL}" WriteRegStr HKCU "${UNINST_KEY}" "DisplayIcon" "$INSTDIR\Luminary.ico" WriteRegStr HKCU "${UNINST_KEY}" "InstallLocation" "$INSTDIR" WriteRegStr HKCU "${UNINST_KEY}" "UninstallString" '"$INSTDIR\Uninstall.exe"' WriteRegStr HKCU "${UNINST_KEY}" "QuietUninstallString" '"$INSTDIR\Uninstall.exe" /S' WriteRegDWORD HKCU "${UNINST_KEY}" "EstimatedSize" ${INSTALL_KB} WriteRegDWORD HKCU "${UNINST_KEY}" "NoModify" 1 WriteRegDWORD HKCU "${UNINST_KEY}" "NoRepair" 1 SectionEnd Section "Desktop shortcut" SEC_DESKTOP !if /FileExists "${SOURCE_DIR}/Luminary.vbs" CreateShortCut "$DESKTOP\Luminary.lnk" "$INSTDIR\Luminary.vbs" "" "$INSTDIR\Luminary.ico" 0 !else CreateShortCut "$DESKTOP\Luminary.lnk" "$INSTDIR\Luminary.cmd" "" "$INSTDIR\Luminary.ico" 0 !endif SectionEnd Section "Start Luminary when I sign in" SEC_STARTUP !if /FileExists "${SOURCE_DIR}/Luminary.vbs" WriteRegStr HKCU "${RUN_KEY}" "Luminary" '"$INSTDIR\Luminary.vbs"' !else WriteRegStr HKCU "${RUN_KEY}" "Luminary" '"$INSTDIR\Luminary.cmd"' !endif SectionEnd !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN !insertmacro MUI_DESCRIPTION_TEXT ${SEC_MAIN} $(DESC_Main) !insertmacro MUI_DESCRIPTION_TEXT ${SEC_DESKTOP} $(DESC_Desktop) !insertmacro MUI_DESCRIPTION_TEXT ${SEC_STARTUP} $(DESC_Startup) !insertmacro MUI_FUNCTION_DESCRIPTION_END Section "Uninstall" !insertmacro StopRunning Delete "$SMPROGRAMS\Luminary\Luminary.lnk" Delete "$SMPROGRAMS\Luminary\Stop Luminary.lnk" Delete "$SMPROGRAMS\Luminary\Luminary data folder.lnk" RMDir "$SMPROGRAMS\Luminary" Delete "$DESKTOP\Luminary.lnk" DeleteRegValue HKCU "${RUN_KEY}" "Luminary" DeleteRegKey HKCU "${UNINST_KEY}" DeleteRegKey HKCU "${APP_KEY}" ; %LOCALAPPDATA%\Luminary\data is deliberately outside $INSTDIR, so this ; only removes the program, its logs and its runtime marker. RMDir /r "$INSTDIR" IfSilent uninstallDone MessageBox MB_ICONINFORMATION|MB_OK "${APP_NAME} was removed.$\r$\n$\r$\nYour catalog in $LOCALAPPDATA\Luminary\data was kept: delete that folder yourself if you no longer want it." uninstallDone: SectionEnd