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