author | Dean Draper <dean.draper@nokia.com> |
Fri, 30 Apr 2010 10:19:33 +0100 | |
branch | fix |
changeset 491 | f60c4282816c |
parent 427 | d8edd94cd8e2 |
permissions | -rw-r--r-- |
142
26f2f0b4002b
Update Windows installation script to put Python 2.6.4 into the Windows installer.
Daniel Jacobs <daniel.jacobs@nokia.com>
parents:
79
diff
changeset
|
1 |
# Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). |
3 | 2 |
# All rights reserved. |
3 |
# This component and the accompanying materials are made available |
|
4 |
# under the terms of the License "Eclipse Public License v1.0" |
|
5 |
# which accompanies this distribution, and is available |
|
6 |
# at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 |
# |
|
8 |
# Initial Contributors: |
|
9 |
# Nokia Corporation - initial contribution. |
|
10 |
# |
|
11 |
# Contributors: |
|
12 |
# |
|
13 |
# Description: |
|
14 |
# Raptor installer/uninstaller script |
|
15 |
||
16 |
# Standard NSIS Library includes |
|
17 |
!include "MUI2.nsh" |
|
18 |
!include "LogicLib.nsh" |
|
19 |
!include "WinMessages.nsh" |
|
20 |
||
21 |
# Extra plugin includes |
|
22 |
!include "nsDialogs.nsh" |
|
23 |
!include "Registry.nsh" |
|
24 |
!include "NSISpcre.nsh" |
|
25 |
!include "Time.nsh" |
|
26 |
||
27 |
# Define functions from NSISpcre.nsh |
|
28 |
!insertmacro REMatches |
|
29 |
!insertmacro un.REMatches |
|
30 |
!insertmacro REQuoteMeta |
|
31 |
||
32 |
# Variables |
|
33 |
Var DIALOG |
|
34 |
Var RESULT # Generic variable to obtain results, and immediately thrown away after |
|
35 |
Var RESULT2 # Generic variable to obtain results, and immediately thrown away after |
|
36 |
Var SBS_HOME |
|
37 |
Var USERONLYINSTALL_HWND # HWND of radio button control for user-only installation |
|
38 |
Var ALLUSERSINSTALL_HWND # HWND of radio button control for system installation |
|
39 |
Var NOENVCHANGES_HWND # HWND of radio button control for file-only installation |
|
40 |
Var USERONLYINSTALL_STATE # State of user-only radio button |
|
41 |
Var ALLUSERSINSTALL_STATE # State of system radio button |
|
42 |
Var NOENVCHANGES_STATE # State of file-only installation radio button |
|
43 |
Var INSTALL_TYPE # Type of installer ("USR" or "SYS") |
|
44 |
||
45 |
# Custom includes (depend on above variables so much be here) |
|
46 |
!include "raptorinstallerutils.nsh" # Functions and macros for handling environment variables |
|
338
9372474d4b07
Updates to Raptor Windows installer maker tool.
Daniel Jacobs <daniel.jacobs@nokia.com>
parents:
142
diff
changeset
|
47 |
# !include "raptorversion.nsh" # Define the RAPTOR_VERSION variable |
3 | 48 |
|
49 |
# Defines |
|
50 |
!define INSTALLER_NAME "Raptor v${RAPTOR_VERSION}" |
|
51 |
!define RAPTOR "sbs" |
|
52 |
!define INSTALLER_FILENAME "${RAPTOR}-${RAPTOR_VERSION}.exe" |
|
53 |
!define UNINSTALLER_FILENAME "${RAPTOR}-${RAPTOR_VERSION}-uninstaller.exe" |
|
54 |
||
55 |
########################## Attributes ########################### |
|
56 |
# Name of installer executable to create! |
|
57 |
OutFile ${INSTALLER_FILENAME} |
|
58 |
# Name for the installer caption |
|
59 |
Name "Raptor v${RAPTOR_VERSION}" |
|
60 |
||
61 |
####################### Generic Behaviour ####################### |
|
62 |
# Vista support; use admin in case user decides to install Raptor for all users |
|
63 |
RequestExecutionLevel admin |
|
64 |
# Set XPStyle on |
|
65 |
XPStyle on |
|
66 |
||
67 |
###################### Installer Behaviour ###################### |
|
68 |
# Warn on Cancel |
|
69 |
!define MUI_ABORTWARNING |
|
70 |
# Abort warning text |
|
71 |
!define MUI_ABORTWARNING_TEXT "Are you sure you want to quit the ${INSTALLER_NAME} installer?" |
|
72 |
# Cancel is default button on cancel dialogue boxes. |
|
73 |
!define MUI_ABORTWARNING_CANCEL_DEFAULT |
|
74 |
# Don't just to final page |
|
75 |
!define MUI_FINISHPAGE_NOAUTOCLOSE |
|
76 |
# Show installer details |
|
77 |
ShowInstDetails show |
|
78 |
||
79 |
##################### Pages in the installer ##################### |
|
80 |
!insertmacro MUI_PAGE_WELCOME |
|
426
ae9510aa2ca1
Update Windows installer script for release notes changes
Jon Chatten
parents:
338
diff
changeset
|
81 |
!insertmacro MUI_PAGE_LICENSE ${RAPTOR_LOCATION}\license.txt |
3 | 82 |
!define MUI_PAGE_HEADER_TEXT "Installation type" |
83 |
Page custom UserOrSysInstall UserOrSysInstallLeave |
|
84 |
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE DirLeave # Directory page exit function - disallow spaces in $INSTDIR |
|
85 |
!insertmacro MUI_PAGE_DIRECTORY |
|
86 |
!insertmacro MUI_PAGE_INSTFILES |
|
87 |
!insertmacro MUI_PAGE_FINISH |
|
88 |
||
89 |
######################## .onInit function ######################## |
|
90 |
Function .onInit |
|
91 |
StrCpy $INSTDIR "C:\Apps\Raptor" |
|
92 |
FunctionEnd |
|
93 |
||
94 |
#################### Sections in the installer #################### |
|
95 |
# "Sections" - i.e. components to install. This installer |
|
96 |
# only has Raptor, so there is no point giving options |
|
97 |
# to the user. |
|
98 |
Section "Install Raptor" INSTALLRAPTOR |
|
99 |
||
100 |
StrCpy $SBS_HOME "SBS_HOME" |
|
101 |
||
102 |
# Install Raptor |
|
103 |
SetOutPath "$INSTDIR\bin" |
|
5 | 104 |
File /r /x distribution.policy.s60 ${RAPTOR_LOCATION}\bin\*.* |
3 | 105 |
SetOutPath "$INSTDIR\examples" |
5 | 106 |
File /r /x distribution.policy.s60 ${RAPTOR_LOCATION}\examples\*.* |
3 | 107 |
SetOutPath "$INSTDIR\lib" |
5 | 108 |
File /r /x distribution.policy.s60 ${RAPTOR_LOCATION}\lib\*.* |
3 | 109 |
SetOutPath "$INSTDIR\python" |
5 | 110 |
File /r /x distribution.policy.s60 ${RAPTOR_LOCATION}\python\*.* |
3 | 111 |
SetOutPath "$INSTDIR\schema" |
5 | 112 |
File /r /x distribution.policy.s60 ${RAPTOR_LOCATION}\schema\*.* |
338
9372474d4b07
Updates to Raptor Windows installer maker tool.
Daniel Jacobs <daniel.jacobs@nokia.com>
parents:
142
diff
changeset
|
113 |
SetOutPath "$INSTDIR\win32\bin" |
9372474d4b07
Updates to Raptor Windows installer maker tool.
Daniel Jacobs <daniel.jacobs@nokia.com>
parents:
142
diff
changeset
|
114 |
File /r /x distribution.policy.s60 ${RAPTOR_LOCATION}\win32\bin\*.* |
79
540de0f551cf
Updates to Raptor Installer Maker tool to take into account win32-support repository location.
Daniel Jacobs <daniel.jacobs@nokia.com>
parents:
5
diff
changeset
|
115 |
SetOutPath "$INSTDIR\win32\bv" |
338
9372474d4b07
Updates to Raptor Windows installer maker tool.
Daniel Jacobs <daniel.jacobs@nokia.com>
parents:
142
diff
changeset
|
116 |
File /r /x distribution.policy.s60 /x .hg ${BV_LOCATION}\*.* |
79
540de0f551cf
Updates to Raptor Installer Maker tool to take into account win32-support repository location.
Daniel Jacobs <daniel.jacobs@nokia.com>
parents:
5
diff
changeset
|
117 |
SetOutPath "$INSTDIR\win32\cygwin" |
338
9372474d4b07
Updates to Raptor Windows installer maker tool.
Daniel Jacobs <daniel.jacobs@nokia.com>
parents:
142
diff
changeset
|
118 |
File /r /x distribution.policy.s60 /x .hg ${CYGWIN_LOCATION}\*.* |
79
540de0f551cf
Updates to Raptor Installer Maker tool to take into account win32-support repository location.
Daniel Jacobs <daniel.jacobs@nokia.com>
parents:
5
diff
changeset
|
119 |
SetOutPath "$INSTDIR\win32\mingw" |
338
9372474d4b07
Updates to Raptor Windows installer maker tool.
Daniel Jacobs <daniel.jacobs@nokia.com>
parents:
142
diff
changeset
|
120 |
File /r /x distribution.policy.s60 /x .hg ${MINGW_LOCATION}\*.* |
142
26f2f0b4002b
Update Windows installation script to put Python 2.6.4 into the Windows installer.
Daniel Jacobs <daniel.jacobs@nokia.com>
parents:
79
diff
changeset
|
121 |
SetOutPath "$INSTDIR\win32\python264" |
338
9372474d4b07
Updates to Raptor Windows installer maker tool.
Daniel Jacobs <daniel.jacobs@nokia.com>
parents:
142
diff
changeset
|
122 |
File /r /x distribution.policy.s60 /x .hg ${PYTHON_LOCATION}\*.* |
3 | 123 |
|
124 |
SetOutPath "$INSTDIR" |
|
426
ae9510aa2ca1
Update Windows installer script for release notes changes
Jon Chatten
parents:
338
diff
changeset
|
125 |
File ${RAPTOR_LOCATION}\RELEASE-NOTES.html |
ae9510aa2ca1
Update Windows installer script for release notes changes
Jon Chatten
parents:
338
diff
changeset
|
126 |
SetOutPath "$INSTDIR\notes" |
ae9510aa2ca1
Update Windows installer script for release notes changes
Jon Chatten
parents:
338
diff
changeset
|
127 |
File /r /x distribution.policy.s60 ${RAPTOR_LOCATION}\notes\*.* |
3 | 128 |
|
129 |
||
130 |
${Unless} $INSTALL_TYPE == "NO_ENV" |
|
131 |
# Back up system and user environments before changing them. |
|
132 |
!insertmacro DefineDateStamp |
|
133 |
!define SYS_REG_BACKUP_FILE "$INSTDIR\SysEnvBackUpPreInstall-${DATE_STAMP}.reg" |
|
134 |
!define USR_REG_BACKUP_FILE "$INSTDIR\UsrEnvBackUpPreInstall-${DATE_STAMP}.reg" |
|
135 |
||
136 |
# Save System Environment just in case. |
|
137 |
${registry::SaveKey} "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "${SYS_REG_BACKUP_FILE}" "" "$RESULT" |
|
138 |
||
139 |
${If} $RESULT == 0 |
|
140 |
DetailPrint "Successfully backed up system environment in ${SYS_REG_BACKUP_FILE}." |
|
141 |
${Else} |
|
142 |
DetailPrint "Failed to back up system environment due to an unknown error." |
|
143 |
${EndIf} |
|
144 |
||
145 |
# Save user Environment just in case. |
|
146 |
${registry::SaveKey} "HKCU\Environment" "${USR_REG_BACKUP_FILE}" "" "$RESULT" |
|
147 |
||
148 |
${If} $RESULT == 0 |
|
149 |
DetailPrint "Successfully backed up user environment in ${USR_REG_BACKUP_FILE}." |
|
150 |
${Else} |
|
151 |
DetailPrint "Failed to back up user environment due to an unknown error." |
|
152 |
${EndIf} |
|
153 |
||
154 |
# Reset error flag |
|
155 |
ClearErrors |
|
156 |
||
157 |
# Write SBS_HOME variable; if it exists, the user will be asked if they want it to be overwritten. |
|
158 |
# Read the env var from the appropriate place |
|
159 |
!insertmacro ReadEnvVar $SBS_HOME $RESULT |
|
160 |
||
161 |
${Unless} ${Errors} # No errors, so $SBS_HOME exists |
|
162 |
DetailPrint "Env Var $SBS_HOME exists with value $RESULT" |
|
163 |
# Ask user if they want it replaced. If yes, write it, if no don't write it. |
|
164 |
MessageBox MB_YESNO|MB_ICONQUESTION "The ${INSTALLER_NAME} installer has detected that you already have the SBS_HOME environment variable set with value $RESULT. Would you like the installer to overwrite it with the value $INSTDIR? Click yes to over write with value $INSTDIR, and no to leave it as $RESULT." IDYES write_env_var_yes IDNO write_env_var_no |
|
165 |
${Else} # No env var named $SBS_HOME |
|
166 |
DetailPrint "Env Var $SBS_HOME does not exist!" |
|
167 |
${EndUnless} |
|
168 |
||
169 |
write_env_var_yes: |
|
170 |
# Write SBS_HOME to registry |
|
171 |
Push "SBS_HOME" # Third on stack |
|
172 |
Push "$INSTDIR" # Second on stack |
|
173 |
Push "" # First on stack |
|
174 |
||
175 |
# Needs env var name, env var value, then "" on the stack |
|
176 |
call WriteEnvVar |
|
177 |
||
178 |
# Prepend PATH with %SBS_HOME%\bin |
|
179 |
Push "%SBS_HOME%\bin" # First on stack |
|
180 |
call PrependToPath |
|
181 |
goto end |
|
182 |
||
183 |
write_env_var_no: |
|
184 |
DetailPrint "Not writing the environment variable $SBS_HOME." |
|
185 |
||
186 |
end: |
|
187 |
${EndUnless} |
|
188 |
||
189 |
# Generate batch file to set environment variables for Raptor |
|
190 |
StrCpy $RESULT "@REM Environment variables for ${INSTALLER_NAME}$\r$\nset SBS_HOME=$INSTDIR$\r$\nset PATH=%SBS_HOME%\bin;%PATH%$\r$\n" |
|
427 | 191 |
SetOutPath "$INSTDIR" |
3 | 192 |
!insertmacro WriteFile "RaptorEnv.bat" "$RESULT" |
193 |
SectionEnd |
|
194 |
||
195 |
# Finishing up installation. |
|
196 |
Section |
|
197 |
${Unless} $INSTALL_TYPE == "NO_ENV" |
|
198 |
# Refresh environment to get changes for SBS_HOME and PATH |
|
199 |
!insertmacro RefreshEnv |
|
200 |
${EndUnless} |
|
201 |
||
202 |
# Write the uninstaller |
|
203 |
# WriteUninstaller "$INSTDIR\${UNINSTALLER_FILENAME}" |
|
204 |
WriteUninstaller "$INSTDIR\${UNINSTALLER_FILENAME}" |
|
205 |
# Unload registry plug in |
|
206 |
${registry::Unload} |
|
207 |
SectionEnd |
|
208 |
||
209 |
# Custom install page to select install type |
|
210 |
Function UserOrSysInstall |
|
211 |
!insertmacro MUI_HEADER_TEXT "Choose Installation Type" "Choose the type of installation \ |
|
212 |
you would like for your computer." |
|
213 |
||
214 |
nsDialogs::Create 1018 |
|
215 |
Pop $DIALOG |
|
216 |
||
217 |
# Exit is unable to create dialog |
|
218 |
${If} $DIALOG == error |
|
219 |
Abort |
|
220 |
${EndIf} |
|
221 |
||
222 |
# Create second radio button for system install |
|
223 |
#${NSD_CreateRadioButton} 0 10u 100% 33% "Install Raptor for all users on this computer. \ |
|
224 |
#(Recommended).$\nThis option modifies system wide environment variables." |
|
225 |
#Pop $ALLUSERSINSTALL_HWND |
|
226 |
||
227 |
# Create first radio button for user install |
|
228 |
#${NSD_CreateRadioButton} 0 45u 100% 67% "Install Raptor just for me on this computer.\ |
|
229 |
#$\nThis option modifies only user environment variables." |
|
230 |
#Pop $USERONLYINSTALL_HWND |
|
231 |
||
232 |
# Create first radio button for system install |
|
233 |
${NSD_CreateRadioButton} 0 0% 100% 30% "Install Raptor for all users on this computer. \ |
|
234 |
(Recommended).$\nThis option modifies system wide environment variables." |
|
235 |
Pop $ALLUSERSINSTALL_HWND |
|
236 |
||
237 |
# Create second radio button for user install |
|
238 |
${NSD_CreateRadioButton} 0 25% 100% 30% "Install Raptor just for me on this computer.\ |
|
239 |
$\nThis option modifies only user environment variables." |
|
240 |
Pop $USERONLYINSTALL_HWND |
|
241 |
||
242 |
# Create third radio button for file-only install |
|
243 |
${NSD_CreateRadioButton} 0 50% 100% 40% "Install, but do not modify the environment.\ |
|
244 |
$\nThis option only unpacks Raptor's files. A batch file in the installation \ |
|
245 |
folder (RaptorEnv.bat) can be used to set Raptor's environment variables in a command prompt." |
|
246 |
Pop $NOENVCHANGES_HWND |
|
247 |
||
248 |
# Update page control with previous state, if set. |
|
249 |
# Initially these will be blank, so set system install to be on by default. |
|
250 |
${If} $USERONLYINSTALL_STATE == "" |
|
251 |
${AndIf} $ALLUSERSINSTALL_STATE == "" |
|
252 |
${AndIf} $NOENVCHANGES_STATE == "" |
|
253 |
${NSD_SetState} $ALLUSERSINSTALL_HWND ${BST_CHECKED} |
|
254 |
${Else} # Previously set, user has returned to this page using "Back" button |
|
255 |
${If} $USERONLYINSTALL_STATE == ${BST_CHECKED} |
|
256 |
${NSD_SetState} $USERONLYINSTALL_HWND ${BST_CHECKED} |
|
257 |
${ElseIf} $NOENVCHANGES_STATE == ${BST_CHECKED} |
|
258 |
${NSD_SetState} $NOENVCHANGES_HWND ${BST_CHECKED} |
|
259 |
${Else} |
|
260 |
${NSD_SetState} $ALLUSERSINSTALL_HWND ${BST_CHECKED} |
|
261 |
${EndIf} |
|
262 |
${EndIf} |
|
263 |
||
264 |
nsDialogs::Show |
|
265 |
FunctionEnd |
|
266 |
||
267 |
# Store the states of the radio buttons once the user has left the page. |
|
268 |
Function UserOrSysInstallLeave |
|
269 |
${NSD_GetState} $USERONLYINSTALL_HWND $USERONLYINSTALL_STATE |
|
270 |
${NSD_GetState} $ALLUSERSINSTALL_HWND $ALLUSERSINSTALL_STATE |
|
271 |
${NSD_GetState} $NOENVCHANGES_HWND $NOENVCHANGES_STATE |
|
272 |
||
273 |
# Set the ${INSTALL_TYPE} variable |
|
274 |
${If} $USERONLYINSTALL_STATE == ${BST_CHECKED} |
|
275 |
StrCpy $INSTALL_TYPE "USR" |
|
276 |
${EndIf} |
|
277 |
||
278 |
${If} $ALLUSERSINSTALL_STATE == ${BST_CHECKED} |
|
279 |
StrCpy $INSTALL_TYPE "SYS" |
|
280 |
${EndIf} |
|
281 |
||
282 |
${If} $NOENVCHANGES_STATE == ${BST_CHECKED} |
|
283 |
StrCpy $INSTALL_TYPE "NO_ENV" |
|
284 |
${EndIf} |
|
285 |
||
286 |
${Unless} $INSTALL_TYPE == "USR" |
|
287 |
${AndUnless} $INSTALL_TYPE == "SYS" |
|
288 |
${AndUnless} $INSTALL_TYPE == "NO_ENV" |
|
289 |
Abort "Failed to determine installation type.\n\ |
|
290 |
$$INSTALL_TYPE = $\"$INSTALL_TYPE$\"." |
|
291 |
${EndUnless} |
|
292 |
FunctionEnd |
|
293 |
||
294 |
Function DirLeave |
|
295 |
StrCpy $0 " " |
|
296 |
${REQuoteMeta} $9 $0 # $9 now contains the meta-quoted version of $0 |
|
297 |
${If} $INSTDIR =~ $9 |
|
298 |
MessageBox MB_OK|MB_ICONSTOP "Please choose a directory without a space in it." |
|
299 |
Abort |
|
300 |
${EndIf} |
|
301 |
FunctionEnd |
|
302 |
||
303 |
########################### Uninstaller ######################### |
|
304 |
######################## .onInit function ######################## |
|
305 |
Function un.onInit |
|
306 |
!undef DATE_STAMP |
|
307 |
!insertmacro DefineDateStamp |
|
308 |
FunctionEnd |
|
309 |
########################### Behaviour ########################### |
|
310 |
# Warn on Cancel |
|
311 |
!define MUI_UNABORTWARNING |
|
312 |
# Abort warning text |
|
313 |
!undef MUI_UNABORTWARNING_TEXT |
|
314 |
!define MUI_UNABORTWARNING_TEXT "Are you sure you want to quit the ${INSTALLER_NAME} uninstaller?" |
|
315 |
# Cancel is default button on cancel dialogue boxes. |
|
316 |
!define MUI_UNABORTWARNING_CANCEL_DEFAULT |
|
317 |
# Don't just to final page |
|
318 |
!define MUI_UNFINISHPAGE_NOAUTOCLOSE |
|
319 |
# Show uninstaller details |
|
320 |
ShowUninstDetails show |
|
321 |
||
322 |
#################### Pages in the uninstaller #################### |
|
323 |
!insertmacro MUI_UNPAGE_WELCOME |
|
324 |
!insertmacro MUI_UNPAGE_CONFIRM |
|
325 |
!insertmacro MUI_UNPAGE_INSTFILES |
|
326 |
!insertmacro MUI_UNPAGE_FINISH |
|
327 |
||
328 |
################## Sections in the uninstaller ################## |
|
329 |
# There is only one section in the uninstaller. |
|
330 |
Section "Uninstall" |
|
331 |
# Delete Raptor |
|
332 |
RmDir /r $INSTDIR\bin |
|
333 |
RmDir /r $INSTDIR\examples |
|
334 |
RmDir /r $INSTDIR\lib |
|
335 |
RmDir /r $INSTDIR\python |
|
336 |
RmDir /r $INSTDIR\schema |
|
337 |
RmDir /r $INSTDIR\win32 |
|
426
ae9510aa2ca1
Update Windows installer script for release notes changes
Jon Chatten
parents:
338
diff
changeset
|
338 |
Delete $INSTDIR\RELEASE-NOTES.html |
ae9510aa2ca1
Update Windows installer script for release notes changes
Jon Chatten
parents:
338
diff
changeset
|
339 |
RmDir /r $INSTDIR\notes |
3 | 340 |
Delete $INSTDIR\RaptorEnv.bat |
341 |
Delete $INSTDIR\${UNINSTALLER_FILENAME} |
|
342 |
||
343 |
!undef SYS_REG_BACKUP_FILE |
|
344 |
!undef USR_REG_BACKUP_FILE |
|
345 |
!define SYS_REG_BACKUP_FILE "$INSTDIR\SysEnvBackUpPreUninstall-${DATE_STAMP}.reg" |
|
346 |
!define USR_REG_BACKUP_FILE "$INSTDIR\UsrEnvBackUpPreUninstall-${DATE_STAMP}.reg" |
|
347 |
||
348 |
# Save System Environment just in case. |
|
349 |
${registry::SaveKey} "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "${SYS_REG_BACKUP_FILE}" "" "$RESULT" |
|
350 |
||
351 |
${If} $RESULT == 0 |
|
352 |
DetailPrint "Successfully backed up system environment in ${SYS_REG_BACKUP_FILE}." |
|
353 |
${Else} |
|
354 |
DetailPrint "Failed to back up system environment due to an unknown error." |
|
355 |
${EndIf} |
|
356 |
||
357 |
# Save user Environment just in case. |
|
358 |
${registry::SaveKey} "HKCU\Environment" "${USR_REG_BACKUP_FILE}" "" "$RESULT" |
|
359 |
||
360 |
${If} $RESULT == 0 |
|
361 |
DetailPrint "Successfully backed up user environment in ${USR_REG_BACKUP_FILE}." |
|
362 |
${Else} |
|
363 |
DetailPrint "Failed to back up user environment due to an unknown error." |
|
364 |
${EndIf} |
|
365 |
||
366 |
# Reset error flag |
|
367 |
ClearErrors |
|
368 |
||
369 |
# Read user SBS_HOME |
|
370 |
!insertmacro ReadUsrEnvVar "SBS_HOME" $RESULT |
|
371 |
||
372 |
${Unless} ${Errors} # No errors, so user %SBS_HOME% exists |
|
373 |
DetailPrint "Removing user environment variable SBS_HOME ($RESULT)" |
|
374 |
||
375 |
# Reset error flag |
|
376 |
ClearErrors |
|
377 |
!insertmacro RmUsrEnvVar "SBS_HOME" |
|
378 |
||
379 |
${If} ${Errors} |
|
380 |
DetailPrint "ERROR: The ${INSTALLER_NAME} uninstaller could not remove the user environment variable SBS_HOME." |
|
381 |
DetailPrint "Please remove it manually." |
|
382 |
${EndIf} |
|
383 |
||
384 |
${Else} # No env var named $SBS_HOME |
|
385 |
DetailPrint "Note: Unable to find user environment variable SBS_HOME." |
|
386 |
DetailPrint "If required, this variable may need to be removed manually." |
|
387 |
${EndUnless} |
|
388 |
||
389 |
# Reset error flag |
|
390 |
ClearErrors |
|
391 |
||
392 |
# Read system SBS_HOME |
|
393 |
!insertmacro ReadSysEnvVar "SBS_HOME" $RESULT |
|
394 |
||
395 |
${Unless} ${Errors} # No errors, so system $SBS_HOME exists |
|
396 |
DetailPrint "Removing system environment variable SBS_HOME ($RESULT)" |
|
397 |
||
398 |
# Reset error flag |
|
399 |
ClearErrors |
|
400 |
!insertmacro RmSysEnvVar "SBS_HOME" |
|
401 |
||
402 |
${If} ${Errors} |
|
403 |
DetailPrint "ERROR: The ${INSTALLER_NAME} uninstaller could not remove the \ |
|
404 |
System environment variable SBS_HOME." |
|
405 |
DetailPrint "Please remove it manually." |
|
406 |
${EndIf} |
|
407 |
||
408 |
${Else} # No env var named $SBS_HOME |
|
409 |
DetailPrint "Note: Unable to find system environment variable SBS_HOME." |
|
410 |
DetailPrint "If required, this variable may need to be removed manually." |
|
411 |
${EndUnless} |
|
412 |
||
413 |
################################# Clean up the path env vars ################################# |
|
414 |
# Reset error flag |
|
415 |
ClearErrors |
|
416 |
||
417 |
# Read user path |
|
418 |
!insertmacro ReadUsrPath $RESULT |
|
419 |
DetailPrint "Read user Path: $RESULT" |
|
420 |
||
421 |
${Unless} ${Errors} # No errors, so user $SBS_HOME exists |
|
422 |
${If} $RESULT == "" # If it came back empty. |
|
423 |
DetailPrint "No user Path available - nothing to do." |
|
424 |
${Else} |
|
425 |
${If} $RESULT un.=~ "%SBS_HOME%\\bin;" # Only need to act if %SBS_HOME%\bin; is in the Path |
|
426 |
DetailPrint "Removing %SBS_HOME%\bin; from user path" |
|
427 |
||
428 |
# Reset error flag and clean user Path |
|
429 |
ClearErrors |
|
430 |
!insertmacro RemoveFromPathString $RESULT "%SBS_HOME%\bin;" |
|
431 |
||
432 |
DetailPrint "DEBUG: User path $$RESULT = " |
|
433 |
DetailPrint "DEBUG: User path $RESULT" |
|
434 |
||
435 |
${If} $RESULT == "" |
|
436 |
!insertmacro RmUsrEnvVar "Path" |
|
437 |
${Else} |
|
438 |
# Write cleaned Path to registry |
|
439 |
!insertmacro WriteUsrEnvVarExp "Path" $RESULT |
|
440 |
${EndIf} |
|
441 |
||
442 |
${If} ${Errors} |
|
443 |
DetailPrint "ERROR: The ${INSTALLER_NAME} uninstaller could not clean the user Path. Please clean it manually." |
|
444 |
${EndIf} |
|
445 |
${Else} |
|
446 |
DetailPrint "Nothing to remove from user path." |
|
447 |
${EndIf} |
|
448 |
${EndIf} |
|
449 |
||
450 |
${Else} # No user path |
|
451 |
DetailPrint "Note: Unable to find user Path environment variable." |
|
452 |
DetailPrint "Please check that the variable exists and remove %SBS_HOME\bin manually if required." |
|
453 |
${EndUnless} |
|
454 |
||
455 |
# Read system path |
|
456 |
!insertmacro ReadSysPath $RESULT |
|
457 |
DetailPrint "Read system Path: $RESULT" |
|
458 |
||
459 |
${Unless} ${Errors} # No errors, so system path read OK. |
|
460 |
${If} $RESULT un.=~ "%SBS_HOME%\\bin;" # Only need to act if %SBS_HOME%\bin; is in the Path |
|
461 |
||
462 |
DetailPrint "Removing %SBS_HOME%\bin; from system path" |
|
463 |
||
464 |
# Reset error flag |
|
465 |
ClearErrors |
|
466 |
!insertmacro RemoveFromPathString $RESULT "%SBS_HOME%\bin;" |
|
467 |
DetailPrint "DEBUG: System Path $$RESULT = " |
|
468 |
DetailPrint "DEBUG: System Path $RESULT" |
|
469 |
ClearErrors |
|
470 |
# Write cleaned PATH to registry |
|
471 |
!insertmacro WriteSysEnvVarExp "Path" $RESULT |
|
472 |
||
473 |
${If} ${Errors} |
|
474 |
DetailPrint "ERROR: The ${INSTALLER_NAME} uninstaller could not clean the PATH." |
|
475 |
DetailPrint "Please clean it manually." |
|
476 |
${EndIf} |
|
477 |
${Else} |
|
478 |
DetailPrint "Nothing to remove from system path." |
|
479 |
${EndIf} |
|
480 |
${Else} # Some error reading system path |
|
481 |
DetailPrint "Note: Unable to read the system Path environment variable." |
|
482 |
DetailPrint "Please check that the variable and remove %SBS_HOME\bin manually if required." |
|
483 |
${EndUnless} |
|
484 |
||
485 |
########################################################################## |
|
486 |
# Refresh environment to get changes for SBS_HOME and PATH |
|
487 |
!insertmacro RefreshEnv |
|
488 |
||
489 |
# Unload registry plug in |
|
490 |
${registry::Unload} |
|
491 |
SectionEnd |
|
492 |
||
493 |
# Languages |
|
494 |
!insertmacro MUI_LANGUAGE "English" |
|
495 |
||
496 |
################################################ End ################################################ |