torbrowser.nsi 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. ;NSIS Installer for Tor Browser Bundle
  2. ;Written by Moritz Bartl
  3. ;released under Public Domain
  4. ;--------------------------------
  5. ;Modern" UI
  6. !include "MUI2.nsh"
  7. !include "LogicLib.nsh"
  8. !include "WinVer.nsh"
  9. ;--------------------------------
  10. ;General
  11. ; location of Tor Browser bundle to put into installer
  12. !define TBBSOURCE ".\Tor Browser\"
  13. Name "Tor Browser"
  14. OutFile "torbrowser-install.exe"
  15. ;Default installation folder
  16. InstallDir "$DESKTOP\Tor Browser"
  17. ;Best (but slowest) compression
  18. SetCompressor /SOLID lzma
  19. SetCompressorDictSize 32
  20. ;Request application privileges for Windows Vista
  21. RequestExecutionLevel user
  22. ;--------------------------------
  23. ;Interface Configuration
  24. !define MUI_ICON "torbrowser.ico"
  25. !define MUI_ABORTWARNING
  26. ;--------------------------------
  27. ;Modern UI settings
  28. !define MUI_FINISHPAGE_NOREBOOTSUPPORT ; we don't require a reboot
  29. !define MUI_FINISHPAGE_RUN
  30. !define MUI_FINISHPAGE_RUN_FUNCTION "StartTorBrowser"
  31. !define MUI_FINISHPAGE_SHOWREADME ; misuse for option to create shortcut; less ugly than MUI_PAGE_COMPONENTS
  32. !define MUI_FINISHPAGE_SHOWREADME_TEXT "&Add Start Menu && Desktop shortcuts"
  33. !define MUI_FINISHPAGE_SHOWREADME_FUNCTION "CreateShortCuts"
  34. ;--------------------------------
  35. ;Pages
  36. !define MUI_PAGE_CUSTOMFUNCTION_LEAVE CheckIfTargetDirectoryExists
  37. !insertmacro MUI_PAGE_DIRECTORY
  38. !insertmacro MUI_PAGE_INSTFILES
  39. !insertmacro MUI_PAGE_FINISH
  40. ;--------------------------------
  41. ;Languages
  42. !insertmacro MUI_LANGUAGE "English" ;first language is the default language
  43. !insertmacro MUI_LANGUAGE "French"
  44. !insertmacro MUI_LANGUAGE "German"
  45. !insertmacro MUI_LANGUAGE "Spanish"
  46. !insertmacro MUI_LANGUAGE "SpanishInternational"
  47. !insertmacro MUI_LANGUAGE "SimpChinese"
  48. !insertmacro MUI_LANGUAGE "TradChinese"
  49. !insertmacro MUI_LANGUAGE "Japanese"
  50. !insertmacro MUI_LANGUAGE "Korean"
  51. !insertmacro MUI_LANGUAGE "Italian"
  52. !insertmacro MUI_LANGUAGE "Dutch"
  53. !insertmacro MUI_LANGUAGE "Danish"
  54. !insertmacro MUI_LANGUAGE "Swedish"
  55. !insertmacro MUI_LANGUAGE "Norwegian"
  56. !insertmacro MUI_LANGUAGE "NorwegianNynorsk"
  57. !insertmacro MUI_LANGUAGE "Finnish"
  58. !insertmacro MUI_LANGUAGE "Greek"
  59. !insertmacro MUI_LANGUAGE "Russian"
  60. !insertmacro MUI_LANGUAGE "Portuguese"
  61. !insertmacro MUI_LANGUAGE "PortugueseBR"
  62. !insertmacro MUI_LANGUAGE "Polish"
  63. !insertmacro MUI_LANGUAGE "Ukrainian"
  64. !insertmacro MUI_LANGUAGE "Czech"
  65. !insertmacro MUI_LANGUAGE "Slovak"
  66. !insertmacro MUI_LANGUAGE "Croatian"
  67. !insertmacro MUI_LANGUAGE "Bulgarian"
  68. !insertmacro MUI_LANGUAGE "Hungarian"
  69. !insertmacro MUI_LANGUAGE "Thai"
  70. !insertmacro MUI_LANGUAGE "Romanian"
  71. !insertmacro MUI_LANGUAGE "Latvian"
  72. !insertmacro MUI_LANGUAGE "Macedonian"
  73. !insertmacro MUI_LANGUAGE "Estonian"
  74. !insertmacro MUI_LANGUAGE "Turkish"
  75. !insertmacro MUI_LANGUAGE "Lithuanian"
  76. !insertmacro MUI_LANGUAGE "Slovenian"
  77. !insertmacro MUI_LANGUAGE "Serbian"
  78. !insertmacro MUI_LANGUAGE "SerbianLatin"
  79. !insertmacro MUI_LANGUAGE "Arabic"
  80. !insertmacro MUI_LANGUAGE "Farsi"
  81. !insertmacro MUI_LANGUAGE "Hebrew"
  82. !insertmacro MUI_LANGUAGE "Indonesian"
  83. !insertmacro MUI_LANGUAGE "Mongolian"
  84. !insertmacro MUI_LANGUAGE "Luxembourgish"
  85. !insertmacro MUI_LANGUAGE "Albanian"
  86. !insertmacro MUI_LANGUAGE "Breton"
  87. !insertmacro MUI_LANGUAGE "Belarusian"
  88. !insertmacro MUI_LANGUAGE "Icelandic"
  89. !insertmacro MUI_LANGUAGE "Malay"
  90. !insertmacro MUI_LANGUAGE "Bosnian"
  91. !insertmacro MUI_LANGUAGE "Kurdish"
  92. !insertmacro MUI_LANGUAGE "Irish"
  93. !insertmacro MUI_LANGUAGE "Uzbek"
  94. !insertmacro MUI_LANGUAGE "Galician"
  95. !insertmacro MUI_LANGUAGE "Afrikaans"
  96. !insertmacro MUI_LANGUAGE "Catalan"
  97. !insertmacro MUI_LANGUAGE "Esperanto"
  98. ;--------------------------------
  99. ;Multi Language support: Read strings from separate file
  100. ; !include torbrowser-langstrings.nsi
  101. ;--------------------------------
  102. ;Reserve Files
  103. ;If you are using solid compression, files that are required before
  104. ;the actual installation should be stored first in the data block,
  105. ;because this will make your installer start faster.
  106. !insertmacro MUI_RESERVEFILE_LANGDLL
  107. ;--------------------------------
  108. ;Installer Sections
  109. Section "Tor Browser Bundle" SecTBB
  110. SetOutPath "$INSTDIR"
  111. File /r "${TBBSOURCE}\*.*"
  112. SetOutPath "$INSTDIR\Browser"
  113. CreateShortCut "$INSTDIR\Start Tor Browser.lnk" "$INSTDIR\Browser\firefox.exe"
  114. SectionEnd
  115. Function CreateShortcuts
  116. CreateShortCut "$SMPROGRAMS\Start Tor Browser.lnk" "$INSTDIR\Browser\firefox.exe"
  117. CreateShortCut "$DESKTOP\Start Tor Browser.lnk" "$INSTDIR\Browser\firefox.exe"
  118. FunctionEnd
  119. ;--------------------------------
  120. ;Installer Functions
  121. Function .onInit
  122. ${IfNot} ${AtLeastWin7}
  123. MessageBox MB_USERICON|MB_OK "Tor Browser requires at least Windows 7"
  124. SetErrorLevel 1
  125. Quit
  126. ${EndIf}
  127. ; Don't install on systems that don't support SSE2. The parameter value of
  128. ; 10 is for PF_XMMI64_INSTRUCTIONS_AVAILABLE which will check whether the
  129. ; SSE2 instruction set is available.
  130. System::Call "kernel32::IsProcessorFeaturePresent(i 10)i .R7"
  131. ${If} "$R7" == "0"
  132. MessageBox MB_OK|MB_ICONSTOP "Sorry, Tor Browser can't be installed. This version of Tor Browser requires a processor with SSE2 support."
  133. Abort
  134. ${EndIf}
  135. !insertmacro MUI_LANGDLL_DISPLAY
  136. FunctionEnd
  137. ;--------------------------------
  138. ;Helper Functions
  139. Function CheckIfTargetDirectoryExists
  140. ${If} ${FileExists} "$INSTDIR\*.*"
  141. MessageBox MB_YESNO "The destination directory already exists. You can try to upgrade the Tor Browser Bundle, but if you run into any problems, use a new directory instead. Continue?" IDYES NoAbort
  142. Abort
  143. NoAbort:
  144. ${EndIf}
  145. FunctionEnd
  146. Function StartTorBrowser
  147. ExecShell "open" "$INSTDIR/Start Tor Browser.lnk"
  148. FunctionEnd