... |
... |
@@ -5,6 +5,7 @@ |
5
|
5
|
;--------------------------------
|
6
|
6
|
;Modern UI
|
7
|
7
|
|
|
8
|
+ !include "FileFunc.nsh"
|
8
|
9
|
!include "MUI2.nsh"
|
9
|
10
|
!include "LogicLib.nsh"
|
10
|
11
|
!include "WinVer.nsh"
|
... |
... |
@@ -12,25 +13,38 @@ |
12
|
13
|
;--------------------------------
|
13
|
14
|
;General
|
14
|
15
|
|
15
|
|
- ; location of Tor/Base/Privacy Browser to put into installer
|
|
16
|
+ ;Location of Tor/Base/Privacy Browser to put into installer
|
16
|
17
|
!define PROGRAM_SOURCE ".\[% c('var/Project_Name') %]\"
|
17
|
18
|
|
18
|
19
|
Name "[% c('var/Project_Name') %]"
|
19
|
|
- OutFile "[% c('var/projectname') %]-install.exe"
|
|
20
|
+ OutFile "browser-install.exe"
|
20
|
21
|
|
21
|
22
|
;Default installation folder
|
|
23
|
+[% IF system_install_mode -%]
|
|
24
|
+ InstallDir "$PROGRAMFILES\[% c('var/Project_Name') %]"
|
|
25
|
+[% ELSE -%]
|
22
|
26
|
InstallDir "$DESKTOP\[% c('var/Project_Name') %]"
|
|
27
|
+[% END -%]
|
23
|
28
|
|
24
|
29
|
;Best (but slowest) compression
|
25
|
30
|
SetCompressor /SOLID lzma
|
26
|
31
|
SetCompressorDictSize 32
|
27
|
32
|
|
28
|
33
|
;Request application privileges for Windows Vista
|
|
34
|
+[% IF system_install_mode -%]
|
|
35
|
+ RequestExecutionLevel admin
|
|
36
|
+[% ELSE -%]
|
29
|
37
|
RequestExecutionLevel user
|
|
38
|
+[% END -%]
|
30
|
39
|
|
31
|
40
|
;Support HiDPI displays
|
32
|
41
|
ManifestDPIAware true
|
33
|
42
|
|
|
43
|
+[% IF system_install_mode -%]
|
|
44
|
+ ;Registry keys to uninstall system-wide installs
|
|
45
|
+ !define UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\[% c('var/ProjectName') %]"
|
|
46
|
+[% END -%]
|
|
47
|
+
|
34
|
48
|
;--------------------------------
|
35
|
49
|
;Interface Configuration
|
36
|
50
|
|
... |
... |
@@ -133,16 +147,49 @@ |
133
|
147
|
Section "[% c('var/Project_Name') %]" SecBrowser
|
134
|
148
|
|
135
|
149
|
SetOutPath "$INSTDIR"
|
|
150
|
+[% IF !system_install_mode -%]
|
136
|
151
|
File /r "${PROGRAM_SOURCE}\*.*"
|
137
|
|
- SetOutPath "$INSTDIR\Browser"
|
138
|
152
|
CreateShortCut "$INSTDIR\Start [% c('var/Project_Name') %].lnk" "$INSTDIR\Browser\[% c('var/exe_name') %].exe"
|
|
153
|
+[% ELSE -%]
|
|
154
|
+ File /r "${PROGRAM_SOURCE}\Browser\*.*"
|
|
155
|
+
|
|
156
|
+ ;Enable system-wide install in the browser
|
|
157
|
+ FileOpen $0 "$INSTDIR\system-install" w
|
|
158
|
+ FileClose $0
|
|
159
|
+
|
|
160
|
+ ;Write the uninstaller
|
|
161
|
+ WriteUninstaller $INSTDIR\uninstall.exe
|
|
162
|
+
|
|
163
|
+ ;Add the uninstaller to the control panel
|
|
164
|
+ WriteRegStr HKLM "${UNINST_KEY}" "DisplayName" "[% c('var/Project_Name') %]"
|
|
165
|
+ WriteRegStr HKLM "${UNINST_KEY}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
|
|
166
|
+ WriteRegStr HKLM "${UNINST_KEY}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S"
|
|
167
|
+ WriteRegStr HKLM "${UNINST_KEY}" "DisplayIcon" "$\"$INSTDIR\[% c('var/exe_name') %].exe$\""
|
|
168
|
+ WriteRegDWORD HKLM "${UNINST_KEY}" "NoModify" "1"
|
|
169
|
+ WriteRegDWORD HKLM "${UNINST_KEY}" "NoRepair" "1"
|
|
170
|
+ ${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2
|
|
171
|
+ IntFmt $0 "0x%08X" $0
|
|
172
|
+ WriteRegDWORD HKLM "${UNINST_KEY}" "EstimatedSize" "$0"
|
|
173
|
+[% END -%]
|
139
|
174
|
|
140
|
175
|
SectionEnd
|
141
|
176
|
|
142
|
|
-Function CreateShortcuts
|
|
177
|
+[% IF system_install_mode -%]
|
|
178
|
+Section "Uninstall"
|
|
179
|
+ RMDir /r "$INSTDIR"
|
|
180
|
+ DeleteRegKey HKLM "${UNINST_KEY}"
|
|
181
|
+ SetShellVarContext all
|
|
182
|
+ Delete "$SMPROGRAMS\[% c('var/Project_Name') %].lnk"
|
|
183
|
+ Delete "$DESKTOP\[% c('var/Project_Name') %].lnk"
|
|
184
|
+SectionEnd
|
|
185
|
+[% END -%]
|
143
|
186
|
|
144
|
|
- CreateShortCut "$SMPROGRAMS\Start [% c('var/Project_Name') %].lnk" "$INSTDIR\Browser\[% c('var/exe_name') %].exe"
|
145
|
|
- CreateShortCut "$DESKTOP\Start [% c('var/Project_Name') %].lnk" "$INSTDIR\Browser\[% c('var/exe_name') %].exe"
|
|
187
|
+Function CreateShortcuts
|
|
188
|
+[% IF system_install_mode -%]
|
|
189
|
+ SetShellVarContext all
|
|
190
|
+[% END -%]
|
|
191
|
+ CreateShortCut "$SMPROGRAMS\[% c('var/Project_Name') %].lnk" "$INSTDIR\[% IF !system_install_mode -%]Browser\[% END -%][% c('var/exe_name') %].exe"
|
|
192
|
+ CreateShortCut "$DESKTOP\[% c('var/Project_Name') %].lnk" "$INSTDIR\[% IF !system_install_mode -%]Browser\[% END -%][% c('var/exe_name') %].exe"
|
146
|
193
|
|
147
|
194
|
FunctionEnd
|
148
|
195
|
;--------------------------------
|
... |
... |
@@ -181,7 +228,6 @@ ${If} ${FileExists} "$INSTDIR\*.*" |
181
|
228
|
${EndIf}
|
182
|
229
|
FunctionEnd
|
183
|
230
|
|
184
|
|
-
|
185
|
231
|
Function StartBrowser
|
186
|
232
|
ExecShell "open" "$INSTDIR/Start [% c('var/Project_Name') %].lnk"
|
187
|
233
|
FunctionEnd
|