... |
... |
@@ -10,20 +10,27 @@ |
10
|
10
|
!define DEFAULT_INSTALL_DIR "$LocalAppdata\${APP_DIR}\${NAME_NO_SPACES}\${UPDATE_CHANNEL}"
|
11
|
11
|
InstallDir "${DEFAULT_INSTALL_DIR}"
|
12
|
12
|
|
|
13
|
+ AutoCloseWindow true
|
|
14
|
+
|
13
|
15
|
;--------------------------------
|
14
|
16
|
; Pages
|
15
|
17
|
Page custom SetupType SetupTypeLeave
|
16
|
|
- Page custom CustomSetup CustomSetupLeave
|
|
18
|
+ Page custom AdvancedSetup AdvancedSetupLeave
|
17
|
19
|
; Disable the directory selection when updating
|
18
|
|
- !define MUI_PAGE_CUSTOMFUNCTION_PRE CustomPageDirectory
|
|
20
|
+ !define MUI_PAGE_CUSTOMFUNCTION_PRE PageDirectoryPre
|
|
21
|
+ !define MUI_PAGE_CUSTOMFUNCTION_SHOW PageDirectoryShow
|
19
|
22
|
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE CheckIfTargetDirectoryExists
|
|
23
|
+ !define MUI_PAGE_HEADER_SUBTEXT ""
|
20
|
24
|
!insertmacro MUI_PAGE_DIRECTORY
|
|
25
|
+ !define MUI_PAGE_CUSTOMFUNCTION_LEAVE StartBrowser
|
21
|
26
|
!insertmacro MUI_PAGE_INSTFILES
|
22
|
|
- !insertmacro MUI_PAGE_FINISH
|
23
|
27
|
|
24
|
28
|
!insertmacro MUI_UNPAGE_CONFIRM
|
25
|
29
|
!insertmacro MUI_UNPAGE_INSTFILES
|
26
|
|
- !insertmacro MUI_UNPAGE_FINISH
|
|
30
|
+ ; If we want to restore the finish page in the uninstaller, we have to enable
|
|
31
|
+ ; it also for the installer (but we can still skip it by adding Quit in
|
|
32
|
+ ; StartBrowser).
|
|
33
|
+ ; !insertmacro MUI_UNPAGE_FINISH
|
27
|
34
|
|
28
|
35
|
; Languages must be defined after pages
|
29
|
36
|
!include "languages.nsh"
|
... |
... |
@@ -35,57 +42,86 @@ |
35
|
42
|
var existingInstall
|
36
|
43
|
|
37
|
44
|
; Installation settings
|
38
|
|
-var isCustomMode
|
39
|
|
-var isPortableMode
|
|
45
|
+var isAdvancedMode
|
|
46
|
+var isStandaloneMode
|
40
|
47
|
var createDesktopShortcut
|
41
|
48
|
|
42
|
49
|
; Variable used by the setup type page
|
43
|
50
|
var typeRadioStandard
|
44
|
|
-var typeRadioCustom
|
|
51
|
+var typeRadioAdvanced
|
45
|
52
|
var typeRadioClicked
|
46
|
53
|
var typeNextButton
|
47
|
54
|
|
48
|
|
-; Variables used in the custom setup page
|
49
|
|
-var customCheckboxPortable
|
50
|
|
-var customCheckboxDesktop
|
|
55
|
+; Variables used in the advanced setup page
|
|
56
|
+var advancedCheckboxDesktop
|
|
57
|
+var advancedCheckboxStandalone
|
|
58
|
+
|
|
59
|
+ReserveFile ${WELCOME_IMAGE}
|
51
|
60
|
|
52
|
61
|
Function .onInit
|
53
|
62
|
Call CheckRequirements
|
54
|
63
|
|
55
|
|
- !insertmacro MUI_LANGDLL_DISPLAY
|
|
64
|
+ ; Skip NSIS's language selection prompt and try to use the OS language without
|
|
65
|
+ ; further confirmations.
|
|
66
|
+
|
|
67
|
+ File /oname=$PLUGINSDIR\${WELCOME_IMAGE} "${WELCOME_IMAGE}"
|
56
|
68
|
|
57
|
69
|
ReadRegStr $existingInstall HKCU "${UNINST_KEY}" "InstallLocation"
|
58
|
70
|
StrCpy $createDesktopShortcut "true"
|
59
|
71
|
FunctionEnd
|
60
|
72
|
|
61
|
73
|
Function SetupType
|
62
|
|
- !insertmacro MUI_HEADER_TEXT "Setup Type" "Choose setup options"
|
63
|
|
- nsDialogs::Create 1018
|
|
74
|
+ ; Freely inspired by the built-in page implemented in
|
|
75
|
+ ; Contrib/Modern UI 2/Pages/Welcome.nsh.
|
|
76
|
+ ; The problem with the built-in page is that the description label fills all
|
|
77
|
+ ; the vertical space, preventing the addition of other widgets (they will be
|
|
78
|
+ ; hidden, will become visible when using Tab, but it will not be possible to
|
|
79
|
+ ; interact with them with the mouse.
|
|
80
|
+ nsDialogs::Create 1044
|
64
|
81
|
Pop $0
|
65
|
82
|
${If} $0 == error
|
66
|
83
|
Abort
|
67
|
84
|
${EndIf}
|
|
85
|
+ SetCtlColors $0 "" "${MUI_BGCOLOR}"
|
|
86
|
+
|
|
87
|
+ ${NSD_CreateBitmap} 0 0 100% 100% ""
|
|
88
|
+ Pop $0
|
|
89
|
+ ${NSD_SetBitmap} $0 $PLUGINSDIR\${WELCOME_IMAGE} $1
|
|
90
|
+
|
|
91
|
+ ${NSD_CreateLabel} 120u 10u 195u 28u "Welcome to the ${DISPLAY_NAME} Installer"
|
|
92
|
+ Pop $0
|
|
93
|
+ SetCtlColors $0 "${MUI_TEXTCOLOR}" "${MUI_BGCOLOR}"
|
|
94
|
+ CreateFont $2 "$(^Font)" "12" "700"
|
|
95
|
+ SendMessage $0 ${WM_SETFONT} $2 0
|
|
96
|
+
|
|
97
|
+ ${NSD_CreateLabel} 120u 45u 195u 60u "${INTRO_TEXT}"
|
|
98
|
+ Pop $0
|
|
99
|
+ SetCtlColors $0 "${MUI_TEXTCOLOR}" "${MUI_BGCOLOR}"
|
|
100
|
+
|
|
101
|
+ ${NSD_CreateLabel} 120u 105u 195u 12u "Installation Type"
|
|
102
|
+ Pop $0
|
|
103
|
+ SetCtlColors $0 "" ${MUI_BGCOLOR}
|
68
|
104
|
|
69
|
|
- ${NSD_CreateLabel} 0 0 100% 18% "Choose the type of setup you prefer."
|
70
|
105
|
${If} $existingInstall == ""
|
71
|
|
- ${NSD_CreateRadioButton} 0 18% 100% 6% "Standard"
|
|
106
|
+ ${NSD_CreateRadioButton} 120u 117u 160u 12u "Standard"
|
72
|
107
|
Pop $typeRadioStandard
|
73
|
|
- ${NSD_CreateRadioButton} 0 30% 100% 6% "Custom"
|
74
|
|
- Pop $typeRadioCustom
|
75
|
108
|
${Else}
|
76
|
|
- ${NSD_CreateRadioButton} 0 18% 100% 6% "Update your existing installation"
|
|
109
|
+ ${NSD_CreateRadioButton} 120u 117u 160u 12u "Update current installation"
|
77
|
110
|
Pop $typeRadioStandard
|
78
|
|
- ${NSD_CreateRadioButton} 0 30% 100% 6% "Portable installation"
|
79
|
|
- Pop $typeRadioCustom
|
80
|
111
|
${EndIf}
|
|
112
|
+ ${NSD_CreateRadioButton} 120u 129u 160u 12u "Advanced"
|
|
113
|
+ Pop $typeRadioAdvanced
|
|
114
|
+
|
|
115
|
+ SetCtlColors $typeRadioStandard "" ${MUI_BGCOLOR}
|
81
|
116
|
${NSD_OnClick} $typeRadioStandard SetupTypeRadioClick
|
82
|
|
- ${NSD_OnClick} $typeRadioCustom SetupTypeRadioClick
|
|
117
|
+ SetCtlColors $typeRadioAdvanced "" ${MUI_BGCOLOR}
|
|
118
|
+ ${NSD_OnClick} $typeRadioAdvanced SetupTypeRadioClick
|
83
|
119
|
|
84
|
120
|
GetDlgItem $typeNextButton $HWNDPARENT 1
|
85
|
121
|
|
86
|
122
|
; Re-check radios if the user presses back
|
87
|
|
- ${If} $isCustomMode == "true"
|
88
|
|
- StrCpy $typeRadioClicked $typeRadioCustom
|
|
123
|
+ ${If} $isAdvancedMode == "true"
|
|
124
|
+ StrCpy $typeRadioClicked $typeRadioAdvanced
|
89
|
125
|
${Else}
|
90
|
126
|
StrCpy $typeRadioClicked $typeRadioStandard
|
91
|
127
|
${EndIf}
|
... |
... |
@@ -93,6 +129,8 @@ Function SetupType |
93
|
129
|
Call SetupTypeUpdate
|
94
|
130
|
|
95
|
131
|
nsDialogs::Show
|
|
132
|
+
|
|
133
|
+ ${NSD_FreeBitmap} $1
|
96
|
134
|
FunctionEnd
|
97
|
135
|
|
98
|
136
|
Function SetupTypeRadioClick
|
... |
... |
@@ -101,12 +139,12 @@ Function SetupTypeRadioClick |
101
|
139
|
FunctionEnd
|
102
|
140
|
|
103
|
141
|
Function SetupTypeUpdate
|
104
|
|
- ${If} $typeRadioClicked == $typeRadioCustom
|
105
|
|
- StrCpy $isCustomMode "true"
|
|
142
|
+ ${If} $typeRadioClicked == $typeRadioAdvanced
|
|
143
|
+ StrCpy $isAdvancedMode "true"
|
106
|
144
|
SendMessage $typeNextButton ${WM_SETTEXT} 0 "STR:$(^NextBtn)"
|
107
|
145
|
${ElseIf} $typeRadioClicked == $typeRadioStandard
|
108
|
|
- StrCpy $isCustomMode "false"
|
109
|
|
- StrCpy $isPortableMode "false"
|
|
146
|
+ StrCpy $isAdvancedMode "false"
|
|
147
|
+ StrCpy $isStandaloneMode "false"
|
110
|
148
|
${If} $existingInstall == ""
|
111
|
149
|
SendMessage $typeNextButton ${WM_SETTEXT} 0 "STR:$(^InstallBtn)"
|
112
|
150
|
${Else}
|
... |
... |
@@ -116,79 +154,81 @@ Function SetupTypeUpdate |
116
|
154
|
FunctionEnd
|
117
|
155
|
|
118
|
156
|
Function SetupTypeLeave
|
119
|
|
- ${If} $typeRadioClicked == $typeRadioCustom
|
120
|
|
- StrCpy $isCustomMode "true"
|
|
157
|
+ ${If} $typeRadioClicked == $typeRadioAdvanced
|
|
158
|
+ StrCpy $isAdvancedMode "true"
|
121
|
159
|
${ElseIf} $typeRadioClicked == $typeRadioStandard
|
122
|
|
- StrCpy $isCustomMode "false"
|
123
|
|
- StrCpy $isPortableMode "false"
|
|
160
|
+ StrCpy $isAdvancedMode "false"
|
|
161
|
+ StrCpy $isStandaloneMode "false"
|
124
|
162
|
${Else}
|
125
|
163
|
Abort
|
126
|
164
|
${EndIf}
|
127
|
165
|
FunctionEnd
|
128
|
166
|
|
129
|
|
-Function CustomSetup
|
130
|
|
- ${If} $isCustomMode != "true"
|
|
167
|
+Function AdvancedSetup
|
|
168
|
+ ${If} $isAdvancedMode != "true"
|
131
|
169
|
Return
|
132
|
170
|
${EndIf}
|
133
|
171
|
|
134
|
|
- !insertmacro MUI_HEADER_TEXT "Custom Setup" "Customize your setup options"
|
|
172
|
+ !insertmacro MUI_HEADER_TEXT "Advanced setup" ""
|
135
|
173
|
nsDialogs::Create 1018
|
136
|
174
|
Pop $0
|
137
|
175
|
${If} $0 == error
|
138
|
176
|
Abort
|
139
|
177
|
${EndIf}
|
140
|
178
|
|
141
|
|
- ${NSD_CreateCheckbox} 0 18% 100% 6% "Portable installation"
|
142
|
|
- Pop $customCheckboxPortable
|
143
|
|
- ${NSD_CreateCheckbox} 0 30% 100% 6% "Create a desktop shortcut"
|
144
|
|
- Pop $customCheckboxDesktop
|
145
|
|
- ${NSD_OnClick} $customCheckboxPortable CustomSetupCheckboxClick
|
146
|
|
- ${NSD_OnClick} $customCheckboxDesktop CustomSetupCheckboxClick
|
|
179
|
+ ${NSD_CreateCheckbox} 0 18% 100% 6% "Create a desktop shortcut"
|
|
180
|
+ Pop $advancedCheckboxDesktop
|
|
181
|
+ ${NSD_CreateCheckbox} 0 30% 100% 6% "Standalone installation"
|
|
182
|
+ Pop $advancedCheckboxStandalone
|
|
183
|
+ ${NSD_CreateLabel} 4% 37% 95% 50% "Choose the standalone installation if you want to install Mullvad Browser in its own dedicated folder, without adding it to the Start menu and to the list of applications."
|
|
184
|
+ Pop $0
|
|
185
|
+ ${NSD_OnClick} $advancedCheckboxStandalone AdvancedSetupCheckboxClick
|
|
186
|
+ ${NSD_OnClick} $advancedCheckboxDesktop AdvancedSetupCheckboxClick
|
147
|
187
|
|
148
|
|
- ${If} $existingInstall != ""
|
149
|
|
- ; If we already have an installation, this is already portable mode.
|
150
|
|
- StrCpy $isPortableMode "true"
|
151
|
|
- ${NSD_Check} $customCheckboxPortable
|
152
|
|
- EnableWindow $customCheckboxPortable 0
|
153
|
|
- ${ElseIf} $isPortableMode == "true"
|
154
|
|
- ${NSD_Check} $customCheckboxPortable
|
155
|
|
- ${EndIf}
|
156
|
188
|
${If} $createDesktopShortcut == "true"
|
157
|
|
- ${NSD_Check} $customCheckboxDesktop
|
|
189
|
+ ${NSD_Check} $advancedCheckboxDesktop
|
|
190
|
+ ${EndIf}
|
|
191
|
+ ${If} $existingInstall != ""
|
|
192
|
+ ; If we already have an installation, this is already standalone mode.
|
|
193
|
+ StrCpy $isStandaloneMode "true"
|
|
194
|
+ ${NSD_Check} $advancedCheckboxStandalone
|
|
195
|
+ EnableWindow $advancedCheckboxStandalone 0
|
|
196
|
+ ${ElseIf} $isStandaloneMode == "true"
|
|
197
|
+ ${NSD_Check} $advancedCheckboxStandalone
|
158
|
198
|
${EndIf}
|
159
|
199
|
|
160
|
200
|
nsDialogs::Show
|
161
|
201
|
FunctionEnd
|
162
|
202
|
|
163
|
|
-Function CustomSetupUpdate
|
164
|
|
- ${NSD_GetState} $customCheckboxPortable $0
|
|
203
|
+Function AdvancedSetupUpdate
|
|
204
|
+ ${NSD_GetState} $advancedCheckboxDesktop $0
|
165
|
205
|
${If} $0 == "${BST_CHECKED}"
|
166
|
|
- StrCpy $isPortableMode "true"
|
|
206
|
+ StrCpy $createDesktopShortcut "true"
|
167
|
207
|
${Else}
|
168
|
|
- StrCpy $isPortableMode "false"
|
|
208
|
+ StrCpy $createDesktopShortcut "false"
|
169
|
209
|
${EndIf}
|
170
|
210
|
|
171
|
|
- ${NSD_GetState} $customCheckboxDesktop $0
|
|
211
|
+ ${NSD_GetState} $advancedCheckboxStandalone $0
|
172
|
212
|
${If} $0 == "${BST_CHECKED}"
|
173
|
|
- StrCpy $createDesktopShortcut "true"
|
|
213
|
+ StrCpy $isStandaloneMode "true"
|
174
|
214
|
${Else}
|
175
|
|
- StrCpy $createDesktopShortcut "false"
|
|
215
|
+ StrCpy $isStandaloneMode "false"
|
176
|
216
|
${EndIf}
|
177
|
217
|
FunctionEnd
|
178
|
218
|
|
179
|
|
-Function CustomSetupCheckboxClick
|
|
219
|
+Function AdvancedSetupCheckboxClick
|
180
|
220
|
Pop $0
|
181
|
|
- Call CustomSetupUpdate
|
|
221
|
+ Call AdvancedSetupUpdate
|
182
|
222
|
FunctionEnd
|
183
|
223
|
|
184
|
|
-Function CustomSetupLeave
|
185
|
|
- Call CustomSetupUpdate
|
|
224
|
+Function AdvancedSetupLeave
|
|
225
|
+ Call AdvancedSetupUpdate
|
186
|
226
|
FunctionEnd
|
187
|
227
|
|
188
|
|
-Function CustomPageDirectory
|
189
|
|
- ${If} $isPortableMode == "true"
|
|
228
|
+Function PageDirectoryPre
|
|
229
|
+ ${If} $isStandaloneMode == "true"
|
190
|
230
|
StrCpy $INSTDIR "${DEFAULT_PORTABLE_DIR}"
|
191
|
|
- ; Always go through this page in portable mode.
|
|
231
|
+ ; Always go through this page in standalone mode.
|
192
|
232
|
Return
|
193
|
233
|
${ElseIf} $existingInstall != ""
|
194
|
234
|
; When updating, force the old directory and skip the page.
|
... |
... |
@@ -198,23 +238,29 @@ Function CustomPageDirectory |
198
|
238
|
StrCpy $INSTDIR "${DEFAULT_INSTALL_DIR}"
|
199
|
239
|
${EndIf}
|
200
|
240
|
|
201
|
|
- ${If} $isCustomMode != "true"
|
|
241
|
+ ${If} $isAdvancedMode != "true"
|
202
|
242
|
; Standard install, use the default directory and skip the page.
|
203
|
243
|
Abort
|
204
|
244
|
${EndIf}
|
205
|
245
|
FunctionEnd
|
206
|
246
|
|
|
247
|
+Function PageDirectoryShow
|
|
248
|
+ ShowWindow $mui.DirectoryPage.Text ${SW_HIDE}
|
|
249
|
+ ShowWindow $mui.DirectoryPage.SpaceRequired ${SW_HIDE}
|
|
250
|
+ ShowWindow $mui.DirectoryPage.SpaceAvailable ${SW_HIDE}
|
|
251
|
+FunctionEnd
|
|
252
|
+
|
207
|
253
|
Section "Browser" SecBrowser
|
208
|
254
|
SetOutPath "$INSTDIR"
|
209
|
255
|
|
210
|
|
- ${If} $isPortableMode == "true"
|
|
256
|
+ ${If} $isStandaloneMode == "true"
|
211
|
257
|
File /r "${PROGRAM_SOURCE}\*.*"
|
212
|
258
|
CreateShortCut "$INSTDIR\${DISPLAY_NAME}.lnk" "$INSTDIR\Browser\${EXE_NAME}"
|
213
|
259
|
${Else}
|
214
|
260
|
; Do not use a Browser directory for installs.
|
215
|
261
|
File /r "${PROGRAM_SOURCE}\Browser\*.*"
|
216
|
262
|
|
217
|
|
- ; Tell the browser we are not in portable mode anymore.
|
|
263
|
+ ; Tell the browser we are not in standalone mode anymore.
|
218
|
264
|
FileOpen $0 "$INSTDIR\system-install" w
|
219
|
265
|
FileClose $0
|
220
|
266
|
|
... |
... |
@@ -231,7 +277,7 @@ Section "Browser" SecBrowser |
231
|
277
|
SectionEnd
|
232
|
278
|
|
233
|
279
|
Function StartBrowser
|
234
|
|
- ${If} $isPortableMode == "true"
|
|
280
|
+ ${If} $isStandaloneMode == "true"
|
235
|
281
|
ExecShell "open" "$INSTDIR\${DISPLAY_NAME}.lnk"
|
236
|
282
|
${Else}
|
237
|
283
|
ExecShell "open" "$INSTDIR\${EXE_NAME}"
|