setup.nsi 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. Unicode true
  2. ####################################################################
  3. # Includes
  4. !include nsDialogs.nsh
  5. !include MUI2.nsh
  6. !include x64.nsh
  7. !include LogicLib.nsh
  8. ####################################################################
  9. # File Info
  10. !define PRODUCT_NAME "RustDesk"
  11. !define PRODUCT_DESCRIPTION "Installer for ${PRODUCT_NAME}"
  12. !define COPYRIGHT "Copyright © 2021"
  13. !define VERSION "1.1.6"
  14. VIProductVersion "${VERSION}.0"
  15. VIAddVersionKey "ProductName" "${PRODUCT_NAME}"
  16. VIAddVersionKey "ProductVersion" "${VERSION}"
  17. VIAddVersionKey "FileDescription" "${PRODUCT_DESCRIPTION}"
  18. VIAddVersionKey "LegalCopyright" "${COPYRIGHT}"
  19. VIAddVersionKey "FileVersion" "${VERSION}.0"
  20. ####################################################################
  21. # Installer Attributes
  22. Name "${PRODUCT_NAME}"
  23. Outfile "rustdesk-${VERSION}-setup.exe"
  24. Caption "Setup - ${PRODUCT_NAME}"
  25. BrandingText "${PRODUCT_NAME}"
  26. ShowInstDetails show
  27. RequestExecutionLevel admin
  28. SetOverwrite on
  29. InstallDir "$PROGRAMFILES64\${PRODUCT_NAME}"
  30. ####################################################################
  31. # Pages
  32. !define MUI_ICON "icon.ico"
  33. !define MUI_ABORTWARNING
  34. !define MUI_LANGDLL_ALLLANGUAGES
  35. !define MUI_FINISHPAGE_SHOWREADME ""
  36. !define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
  37. !define MUI_FINISHPAGE_SHOWREADME_TEXT "Create desktop shortcut"
  38. !define MUI_FINISHPAGE_SHOWREADME_FUNCTION CreateDesktopShortcut
  39. !define MUI_FINISHPAGE_RUN "$INSTDIR\${PRODUCT_NAME}.exe"
  40. !insertmacro MUI_PAGE_DIRECTORY
  41. !insertmacro MUI_PAGE_INSTFILES
  42. !insertmacro MUI_PAGE_FINISH
  43. ####################################################################
  44. # Language
  45. !insertmacro MUI_LANGUAGE "English" ; The first language is the default language
  46. !insertmacro MUI_LANGUAGE "French"
  47. !insertmacro MUI_LANGUAGE "German"
  48. !insertmacro MUI_LANGUAGE "Spanish"
  49. !insertmacro MUI_LANGUAGE "SpanishInternational"
  50. !insertmacro MUI_LANGUAGE "SimpChinese"
  51. !insertmacro MUI_LANGUAGE "TradChinese"
  52. !insertmacro MUI_LANGUAGE "Japanese"
  53. !insertmacro MUI_LANGUAGE "Korean"
  54. !insertmacro MUI_LANGUAGE "Italian"
  55. !insertmacro MUI_LANGUAGE "Dutch"
  56. !insertmacro MUI_LANGUAGE "Danish"
  57. !insertmacro MUI_LANGUAGE "Swedish"
  58. !insertmacro MUI_LANGUAGE "Norwegian"
  59. !insertmacro MUI_LANGUAGE "NorwegianNynorsk"
  60. !insertmacro MUI_LANGUAGE "Finnish"
  61. !insertmacro MUI_LANGUAGE "Greek"
  62. !insertmacro MUI_LANGUAGE "Russian"
  63. !insertmacro MUI_LANGUAGE "Portuguese"
  64. !insertmacro MUI_LANGUAGE "PortugueseBR"
  65. !insertmacro MUI_LANGUAGE "Polish"
  66. !insertmacro MUI_LANGUAGE "Ukrainian"
  67. !insertmacro MUI_LANGUAGE "Czech"
  68. !insertmacro MUI_LANGUAGE "Slovak"
  69. !insertmacro MUI_LANGUAGE "Croatian"
  70. !insertmacro MUI_LANGUAGE "Bulgarian"
  71. !insertmacro MUI_LANGUAGE "Hungarian"
  72. !insertmacro MUI_LANGUAGE "Thai"
  73. !insertmacro MUI_LANGUAGE "Romanian"
  74. !insertmacro MUI_LANGUAGE "Latvian"
  75. !insertmacro MUI_LANGUAGE "Macedonian"
  76. !insertmacro MUI_LANGUAGE "Estonian"
  77. !insertmacro MUI_LANGUAGE "Turkish"
  78. !insertmacro MUI_LANGUAGE "Lithuanian"
  79. !insertmacro MUI_LANGUAGE "Slovenian"
  80. !insertmacro MUI_LANGUAGE "Serbian"
  81. !insertmacro MUI_LANGUAGE "SerbianLatin"
  82. !insertmacro MUI_LANGUAGE "Arabic"
  83. !insertmacro MUI_LANGUAGE "Farsi"
  84. !insertmacro MUI_LANGUAGE "Hebrew"
  85. !insertmacro MUI_LANGUAGE "Indonesian"
  86. !insertmacro MUI_LANGUAGE "Mongolian"
  87. !insertmacro MUI_LANGUAGE "Luxembourgish"
  88. !insertmacro MUI_LANGUAGE "Albanian"
  89. !insertmacro MUI_LANGUAGE "Breton"
  90. !insertmacro MUI_LANGUAGE "Belarusian"
  91. !insertmacro MUI_LANGUAGE "Icelandic"
  92. !insertmacro MUI_LANGUAGE "Malay"
  93. !insertmacro MUI_LANGUAGE "Bosnian"
  94. !insertmacro MUI_LANGUAGE "Kurdish"
  95. !insertmacro MUI_LANGUAGE "Irish"
  96. !insertmacro MUI_LANGUAGE "Uzbek"
  97. !insertmacro MUI_LANGUAGE "Galician"
  98. !insertmacro MUI_LANGUAGE "Afrikaans"
  99. !insertmacro MUI_LANGUAGE "Catalan"
  100. !insertmacro MUI_LANGUAGE "Esperanto"
  101. !insertmacro MUI_LANGUAGE "Asturian"
  102. !insertmacro MUI_LANGUAGE "Basque"
  103. !insertmacro MUI_LANGUAGE "Pashto"
  104. !insertmacro MUI_LANGUAGE "ScotsGaelic"
  105. !insertmacro MUI_LANGUAGE "Georgian"
  106. !insertmacro MUI_LANGUAGE "Vietnamese"
  107. !insertmacro MUI_LANGUAGE "Welsh"
  108. !insertmacro MUI_LANGUAGE "Armenian"
  109. !insertmacro MUI_LANGUAGE "Corsican"
  110. !insertmacro MUI_LANGUAGE "Tatar"
  111. !insertmacro MUI_LANGUAGE "Hindi"
  112. ####################################################################
  113. # Sections
  114. Section "Install"
  115. SetOutPath $INSTDIR
  116. # Regkeys
  117. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayIcon" "$INSTDIR\${PRODUCT_NAME}.exe"
  118. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayName" "${PRODUCT_NAME} (x64)"
  119. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "DisplayVersion" "${VERSION}"
  120. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "UninstallString" '"$INSTDIR\${PRODUCT_NAME}.exe" --uninstall'
  121. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "InstallLocation" "$INSTDIR"
  122. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "Publisher" "Purslane Ltd."
  123. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "HelpLink" "https://www.rustdesk.com/"
  124. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "URLInfoAbout" "https://www.rustdesk.com/"
  125. WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" "URLUpdateInfo" "https://www.rustdesk.com/"
  126. nsExec::Exec "taskkill /F /IM ${PRODUCT_NAME}.exe"
  127. Sleep 500 ; Give time for process to be completely killed
  128. File "${PRODUCT_NAME}.exe"
  129. SetShellVarContext all
  130. CreateShortCut "$INSTDIR\Uninstall ${PRODUCT_NAME}.lnk" "$INSTDIR\${PRODUCT_NAME}.exe" "--uninstall" "msiexec.exe"
  131. CreateDirectory "$SMPROGRAMS\${PRODUCT_NAME}"
  132. CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\${PRODUCT_NAME}.lnk" "$INSTDIR\${PRODUCT_NAME}.exe"
  133. CreateShortCut "$SMPROGRAMS\${PRODUCT_NAME}\Uninstall ${PRODUCT_NAME}.lnk" "$INSTDIR\${PRODUCT_NAME}.exe" "--uninstall" "msiexec.exe"
  134. CreateShortCut "$SMSTARTUP\${PRODUCT_NAME} Tray.lnk" "$INSTDIR\${PRODUCT_NAME}.exe" "--tray"
  135. nsExec::Exec 'sc create ${PRODUCT_NAME} start=auto DisplayName="${PRODUCT_NAME} Service" binPath= "\"$INSTDIR\${PRODUCT_NAME}.exe\" --service"'
  136. nsExec::Exec 'netsh advfirewall firewall add rule name="${PRODUCT_NAME} Service" dir=in action=allow program="$INSTDIR\${PRODUCT_NAME}.exe" enable=yes'
  137. nsExec::Exec 'sc start ${PRODUCT_NAME}'
  138. SectionEnd
  139. ####################################################################
  140. # Functions
  141. Function .onInit
  142. # RustDesk is 64-bit only
  143. ${IfNot} ${RunningX64}
  144. MessageBox MB_ICONSTOP "${PRODUCT_NAME} is 64-bit only!"
  145. Quit
  146. ${EndIf}
  147. ${DisableX64FSRedirection}
  148. SetRegView 64
  149. !insertmacro MUI_LANGDLL_DISPLAY
  150. FunctionEnd
  151. Function CreateDesktopShortcut
  152. CreateShortCut "$DESKTOP\${PRODUCT_NAME}.lnk" "$INSTDIR\${PRODUCT_NAME}.exe"
  153. FunctionEnd