; NSIS installer for Ultimate Media Tracker ; ; Build with: makensis installer.nsi ; Expects the packaged app in the dist\ folder (produced by build-windows.sh). Unicode true !define APPNAME "Ultimate Media Tracker" !define COMPANY "UMT" !define VERSION "1.0.0" !define EXE "umt.exe" !define SOURCEDIR "dist" !define REGUNINST "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" !include "MUI2.nsh" ; Anchor all source paths to this script's own directory so makensis works ; regardless of the current working directory it is invoked from. !define ROOT "${__FILEDIR__}" Name "${APPNAME}" OutFile "${ROOT}\UltimateMediaTracker-Setup.exe" InstallDir "$PROGRAMFILES64\${APPNAME}" InstallDirRegKey HKLM "Software\${APPNAME}" "InstallDir" RequestExecutionLevel admin VIProductVersion "${VERSION}.0" VIAddVersionKey "ProductName" "${APPNAME}" VIAddVersionKey "CompanyName" "${COMPANY}" VIAddVersionKey "FileVersion" "${VERSION}" VIAddVersionKey "FileDescription" "${APPNAME} Installer" VIAddVersionKey "LegalCopyright" "${COMPANY}" !define MUI_ICON "${ROOT}\resources\icons\appicon.ico" !define MUI_UNICON "${ROOT}\resources\icons\appicon.ico" !insertmacro MUI_PAGE_WELCOME !insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_INSTFILES !define MUI_FINISHPAGE_RUN "$INSTDIR\${EXE}" !insertmacro MUI_PAGE_FINISH !insertmacro MUI_UNPAGE_CONFIRM !insertmacro MUI_UNPAGE_INSTFILES ; First language listed is the default. !insertmacro MUI_LANGUAGE "German" !insertmacro MUI_LANGUAGE "English" Section "Install" SetOutPath "$INSTDIR" ; "\*" (not "*.*") also grabs extensionless files and all subfolders ; (platforms\, tls\, sqldrivers\, imageformats\, iconengines\ ...). File /r "${ROOT}\${SOURCEDIR}\*" ; Shortcuts CreateDirectory "$SMPROGRAMS\${APPNAME}" CreateShortcut "$SMPROGRAMS\${APPNAME}\${APPNAME}.lnk" "$INSTDIR\${EXE}" "" "$INSTDIR\${EXE}" CreateShortcut "$DESKTOP\${APPNAME}.lnk" "$INSTDIR\${EXE}" "" "$INSTDIR\${EXE}" ; Uninstaller + Add/Remove Programs entry WriteUninstaller "$INSTDIR\Uninstall.exe" WriteRegStr HKLM "Software\${APPNAME}" "InstallDir" "$INSTDIR" WriteRegStr HKLM "${REGUNINST}" "DisplayName" "${APPNAME}" WriteRegStr HKLM "${REGUNINST}" "DisplayVersion" "${VERSION}" WriteRegStr HKLM "${REGUNINST}" "DisplayIcon" "$INSTDIR\${EXE}" WriteRegStr HKLM "${REGUNINST}" "Publisher" "${COMPANY}" WriteRegStr HKLM "${REGUNINST}" "UninstallString" "$INSTDIR\Uninstall.exe" WriteRegDWORD HKLM "${REGUNINST}" "NoModify" 1 WriteRegDWORD HKLM "${REGUNINST}" "NoRepair" 1 SectionEnd Section "Uninstall" Delete "$SMPROGRAMS\${APPNAME}\${APPNAME}.lnk" RMDir "$SMPROGRAMS\${APPNAME}" Delete "$DESKTOP\${APPNAME}.lnk" ; Removes the program files only. User library/settings live in ; %APPDATA%\UMT and are intentionally left untouched. RMDir /r "$INSTDIR" DeleteRegKey HKLM "${REGUNINST}" DeleteRegKey HKLM "Software\${APPNAME}" SectionEnd