installer.nsh 1.6 KB
Newer Older
1
!ifndef BUILD_UNINSTALLER
2
  Function AddToStartup
3
    CreateShortCut "$SMSTARTUP\Rocket.Chat.lnk" "$INSTDIR\Rocket.Chat.exe" ""
4
  FunctionEnd
5

6 7
  !define MUI_FINISHPAGE_SHOWREADME
  !define MUI_FINISHPAGE_SHOWREADME_TEXT "Run at startup"
8
  !define MUI_FINISHPAGE_SHOWREADME_FUNCTION AddToStartup
9 10
!endif

11 12
!ifdef BUILD_UNINSTALLER
  Function un.AddAppData
13
    RMDir /r "$APPDATA\Rocket.Chat"
14 15 16 17 18 19 20 21 22
  FunctionEnd

  ; Using the read me setting to add option to remove app data
  !define MUI_FINISHPAGE_SHOWREADME
  !define MUI_FINISHPAGE_SHOWREADME_TEXT "Remove user data"
  !define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
  !define MUI_FINISHPAGE_SHOWREADME_FUNCTION un.AddAppData
!endif

23
!macro customInstall
24 25 26 27 28 29
  ; Remove dangling reference of version 2.13.1
  ${If} $installMode == "all"
    DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\66bed7da-e601-54e6-b2e8-7be611d82556"
  ${Else}
    DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\66bed7da-e601-54e6-b2e8-7be611d82556"
  ${EndIf}
30
  !insertMacro disableAutoUpdates
31 32 33
  Delete "$SMSTARTUP\Rocket.Chat+.lnk"
!macroend

34
!macro customUnInstall
35
  ${IfNot} ${Silent}
36
    Delete "$SMSTARTUP\Rocket.Chat.lnk"
37
  ${EndIf}
38
!macroend
39 40 41 42

!macro disableAutoUpdates
  ${GetParameters} $R0
  ClearErrors
43
  ${GetOptions} $R0 "/disableAutoUpdates" $R1
44
  ${IfNot} ${Errors}
45
    !insertMacro writeUpdateFile
46 47 48 49
  ${EndIf}
!macroend

!macro writeUpdateFile
50 51
  FileOpen $4 '$INSTDIR\resources\update.json' w
  FileWrite $4 '{$\r$\n'
52 53
  FileWrite $4 '  "canUpdate": false,$\r$\n'
  FileWrite $4 '  "autoUpdate": false$\r$\n'
54
  FileWrite $4 '}$\r$\n'
55
  FileClose $4
56
!macroend