author | Richard Taylor <richard.i.taylor@nokia.com> |
Wed, 17 Mar 2010 15:23:12 +0000 | |
changeset 365 | bab2d423b063 |
parent 142 | 26f2f0b4002b |
child 338 | 9372474d4b07 |
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 |
|
47 |
!include "raptorversion.nsh" # Define the RAPTOR_VERSION variable |
|
48 |
||
49 |
# Defines |
|
50 |
# !define /date DATE_STAMP "%Y-%m-%d-%H-%M-%S" |
|
51 |
!define INSTALLER_NAME "Raptor v${RAPTOR_VERSION}" |
|
52 |
!define RAPTOR "sbs" |
|
53 |
!define INSTALLER_FILENAME "${RAPTOR}-${RAPTOR_VERSION}.exe" |
|
54 |
!define UNINSTALLER_FILENAME "${RAPTOR}-${RAPTOR_VERSION}-uninstaller.exe" |
|
55 |
||
56 |
########################## Attributes ########################### |
|
57 |
# Name of installer executable to create! |
|
58 |
OutFile ${INSTALLER_FILENAME} |
|
59 |
# Name for the installer caption |
|
60 |
Name "Raptor v${RAPTOR_VERSION}" |
|
61 |
||
62 |
####################### Generic Behaviour ####################### |
|
63 |
# Vista support; use admin in case user decides to install Raptor for all users |
|
64 |
RequestExecutionLevel admin |
|
65 |
# Set XPStyle on |
|
66 |
XPStyle on |
|
67 |
||
68 |
###################### Installer Behaviour ###################### |
|
69 |
# Warn on Cancel |
|
70 |
!define MUI_ABORTWARNING |
|
71 |
# Abort warning text |
|
72 |
!define MUI_ABORTWARNING_TEXT "Are you sure you want to quit the ${INSTALLER_NAME} installer?" |
|
73 |
# Cancel is default button on cancel dialogue boxes. |
|
74 |
!define MUI_ABORTWARNING_CANCEL_DEFAULT |
|
75 |
# Don't just to final page |
|
76 |
!define MUI_FINISHPAGE_NOAUTOCLOSE |
|
77 |
# Show installer details |
|
78 |
ShowInstDetails show |
|
79 |
||
80 |
##################### Pages in the installer ##################### |
|
81 |
!insertmacro MUI_PAGE_WELCOME |
|
82 |
# Temporarily useing RELEASE-NOTES.txt as there is not license.txt |
|
83 |
!insertmacro MUI_PAGE_LICENSE ${RAPTOR_LOCATION}\RELEASE-NOTES.txt |
|
84 |
!define MUI_PAGE_HEADER_TEXT "Installation type" |
|
85 |
Page custom UserOrSysInstall UserOrSysInstallLeave |
|
86 |
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE DirLeave # Directory page exit function - disallow spaces in $INSTDIR |
|
87 |
!insertmacro MUI_PAGE_DIRECTORY |
|
88 |
!insertmacro MUI_PAGE_INSTFILES |
|
89 |
!insertmacro MUI_PAGE_FINISH |
|
90 |
||
91 |
######################## .onInit function ######################## |
|
92 |
Function .onInit |
|
93 |
StrCpy $INSTDIR "C:\Apps\Raptor" |
|
94 |
FunctionEnd |
|
95 |
||
96 |
#################### Sections in the installer #################### |
|
97 |
# "Sections" - i.e. components to install. This installer |
|
98 |
# only has Raptor, so there is no point giving options |
|
99 |
# to the user. |
|
100 |
Section "Install Raptor" INSTALLRAPTOR |
|
101 |
||
102 |
StrCpy $SBS_HOME "SBS_HOME" |
|
103 |
||
104 |
# Install Raptor |
|
105 |
SetOutPath "$INSTDIR\bin" |
|
5 | 106 |
File /r /x distribution.policy.s60 ${RAPTOR_LOCATION}\bin\*.* |
3 | 107 |
SetOutPath "$INSTDIR\examples" |
5 | 108 |
File /r /x distribution.policy.s60 ${RAPTOR_LOCATION}\examples\*.* |
3 | 109 |
SetOutPath "$INSTDIR\lib" |
5 | 110 |
File /r /x distribution.policy.s60 ${RAPTOR_LOCATION}\lib\*.* |
3 | 111 |
SetOutPath "$INSTDIR\python" |
5 | 112 |
File /r /x distribution.policy.s60 ${RAPTOR_LOCATION}\python\*.* |
3 | 113 |
SetOutPath "$INSTDIR\schema" |
5 | 114 |
File /r /x distribution.policy.s60 ${RAPTOR_LOCATION}\schema\*.* |
3 | 115 |
SetOutPath "$INSTDIR\win32" |
5 | 116 |
File /r /x distribution.policy.s60 ${RAPTOR_LOCATION}\win32\*.* |
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\bv" |
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
|
118 |
File /r /x distribution.policy.s60 /x .hg ${WIN32SUPPORT}\bv\*.* |
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\cygwin" |
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
|
120 |
File /r /x distribution.policy.s60 /x .hg ${WIN32SUPPORT}\cygwin\*.* |
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
|
121 |
SetOutPath "$INSTDIR\win32\mingw" |
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
|
122 |
File /r /x distribution.policy.s60 /x .hg ${WIN32SUPPORT}\mingw\*.* |
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
|
123 |
SetOutPath "$INSTDIR\win32\python264" |
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
|
124 |
File /r /x distribution.policy.s60 /x .hg ${WIN32SUPPORT}\python264\*.* |
3 | 125 |
|
126 |
SetOutPath "$INSTDIR" |
|
127 |
File ${RAPTOR_LOCATION}\RELEASE-NOTES.txt |
|
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" |
|
191 |
!insertmacro WriteFile "RaptorEnv.bat" "$RESULT" |
|
192 |
SectionEnd |
|
193 |
||
194 |
# Finishing up installation. |
|
195 |
Section |
|
196 |
${Unless} $INSTALL_TYPE == "NO_ENV" |
|
197 |
# Refresh environment to get changes for SBS_HOME and PATH |
|
198 |
!insertmacro RefreshEnv |
|
199 |
${EndUnless} |
|
200 |
||
201 |
# Write the uninstaller |
|
202 |
# WriteUninstaller "$INSTDIR\${UNINSTALLER_FILENAME}" |
|
203 |
WriteUninstaller "$INSTDIR\${UNINSTALLER_FILENAME}" |
|
204 |
# Unload registry plug in |
|
205 |
${registry::Unload} |
|
206 |
SectionEnd |
|
207 |
||
208 |
# Custom install page to select install type |
|
209 |
Function UserOrSysInstall |
|
210 |
!insertmacro MUI_HEADER_TEXT "Choose Installation Type" "Choose the type of installation \ |
|
211 |
you would like for your computer." |
|
212 |
||
213 |
nsDialogs::Create 1018 |
|
214 |
Pop $DIALOG |
|
215 |
||
216 |
# Exit is unable to create dialog |
|
217 |
${If} $DIALOG == error |
|
218 |
Abort |
|
219 |
${EndIf} |
|
220 |
||
221 |
# Create second radio button for system install |
|
222 |
#${NSD_CreateRadioButton} 0 10u 100% 33% "Install Raptor for all users on this computer. \ |
|
223 |
#(Recommended).$\nThis option modifies system wide environment variables." |
|
224 |
#Pop $ALLUSERSINSTALL_HWND |
|
225 |
||
226 |
# Create first radio button for user install |
|
227 |
#${NSD_CreateRadioButton} 0 45u 100% 67% "Install Raptor just for me on this computer.\ |
|
228 |
#$\nThis option modifies only user environment variables." |
|
229 |
#Pop $USERONLYINSTALL_HWND |
|
230 |
||
231 |
# Create first radio button for system install |
|
232 |
${NSD_CreateRadioButton} 0 0% 100% 30% "Install Raptor for all users on this computer. \ |
|
233 |
(Recommended).$\nThis option modifies system wide environment variables." |
|
234 |
Pop $ALLUSERSINSTALL_HWND |
|
235 |
||
236 |
# Create second radio button for user install |
|
237 |
${NSD_CreateRadioButton} 0 25% 100% 30% "Install Raptor just for me on this computer.\ |
|
238 |
$\nThis option modifies only user environment variables." |
|
239 |
Pop $USERONLYINSTALL_HWND |
|
240 |
||
241 |
# Create third radio button for file-only install |
|
242 |
${NSD_CreateRadioButton} 0 50% 100% 40% "Install, but do not modify the environment.\ |
|
243 |
$\nThis option only unpacks Raptor's files. A batch file in the installation \ |
|
244 |
folder (RaptorEnv.bat) can be used to set Raptor's environment variables in a command prompt." |
|
245 |
Pop $NOENVCHANGES_HWND |
|
246 |
||
247 |
# Update page control with previous state, if set. |
|
248 |
# Initially these will be blank, so set system install to be on by default. |
|
249 |
${If} $USERONLYINSTALL_STATE == "" |
|
250 |
${AndIf} $ALLUSERSINSTALL_STATE == "" |
|
251 |
${AndIf} $NOENVCHANGES_STATE == "" |
|
252 |
${NSD_SetState} $ALLUSERSINSTALL_HWND ${BST_CHECKED} |
|
253 |
${Else} # Previously set, user has returned to this page using "Back" button |
|
254 |
${If} $USERONLYINSTALL_STATE == ${BST_CHECKED} |
|
255 |
${NSD_SetState} $USERONLYINSTALL_HWND ${BST_CHECKED} |
|
256 |
${ElseIf} $NOENVCHANGES_STATE == ${BST_CHECKED} |
|
257 |
${NSD_SetState} $NOENVCHANGES_HWND ${BST_CHECKED} |
|
258 |
${Else} |
|
259 |
${NSD_SetState} $ALLUSERSINSTALL_HWND ${BST_CHECKED} |
|
260 |
${EndIf} |
|
261 |
${EndIf} |
|
262 |
||
263 |
nsDialogs::Show |
|
264 |
FunctionEnd |
|
265 |
||
266 |
# Store the states of the radio buttons once the user has left the page. |
|
267 |
Function UserOrSysInstallLeave |
|
268 |
${NSD_GetState} $USERONLYINSTALL_HWND $USERONLYINSTALL_STATE |
|
269 |
${NSD_GetState} $ALLUSERSINSTALL_HWND $ALLUSERSINSTALL_STATE |
|
270 |
${NSD_GetState} $NOENVCHANGES_HWND $NOENVCHANGES_STATE |
|
271 |
||
272 |
# Set the ${INSTALL_TYPE} variable |
|
273 |
${If} $USERONLYINSTALL_STATE == ${BST_CHECKED} |
|
274 |
StrCpy $INSTALL_TYPE "USR" |
|
275 |
${EndIf} |
|
276 |
||
277 |
${If} $ALLUSERSINSTALL_STATE == ${BST_CHECKED} |
|
278 |
StrCpy $INSTALL_TYPE "SYS" |
|
279 |
${EndIf} |
|
280 |
||
281 |
${If} $NOENVCHANGES_STATE == ${BST_CHECKED} |
|
282 |
StrCpy $INSTALL_TYPE "NO_ENV" |
|
283 |
${EndIf} |
|
284 |
||
285 |
${Unless} $INSTALL_TYPE == "USR" |
|
286 |
${AndUnless} $INSTALL_TYPE == "SYS" |
|
287 |
${AndUnless} $INSTALL_TYPE == "NO_ENV" |
|
288 |
Abort "Failed to determine installation type.\n\ |
|
289 |
$$INSTALL_TYPE = $\"$INSTALL_TYPE$\"." |
|
290 |
${EndUnless} |
|
291 |
FunctionEnd |
|
292 |
||
293 |
Function DirLeave |
|
294 |
StrCpy $0 " " |
|
295 |
${REQuoteMeta} $9 $0 # $9 now contains the meta-quoted version of $0 |
|
296 |
${If} $INSTDIR =~ $9 |
|
297 |
MessageBox MB_OK|MB_ICONSTOP "Please choose a directory without a space in it." |
|
298 |
Abort |
|
299 |
${EndIf} |
|
300 |
FunctionEnd |
|
301 |
||
302 |
########################### Uninstaller ######################### |
|
303 |
######################## .onInit function ######################## |
|
304 |
Function un.onInit |
|
305 |
!undef DATE_STAMP |
|
306 |
!insertmacro DefineDateStamp |
|
307 |
FunctionEnd |
|
308 |
########################### Behaviour ########################### |
|
309 |
# Warn on Cancel |
|
310 |
!define MUI_UNABORTWARNING |
|
311 |
# Abort warning text |
|
312 |
!undef MUI_UNABORTWARNING_TEXT |
|
313 |
!define MUI_UNABORTWARNING_TEXT "Are you sure you want to quit the ${INSTALLER_NAME} uninstaller?" |
|
314 |
# Cancel is default button on cancel dialogue boxes. |
|
315 |
!define MUI_UNABORTWARNING_CANCEL_DEFAULT |
|
316 |
# Don't just to final page |
|
317 |
!define MUI_UNFINISHPAGE_NOAUTOCLOSE |
|
318 |
# Show uninstaller details |
|
319 |
ShowUninstDetails show |
|
320 |
||
321 |
#################### Pages in the uninstaller #################### |
|
322 |
!insertmacro MUI_UNPAGE_WELCOME |
|
323 |
!insertmacro MUI_UNPAGE_CONFIRM |
|
324 |
!insertmacro MUI_UNPAGE_INSTFILES |
|
325 |
!insertmacro MUI_UNPAGE_FINISH |
|
326 |
||
327 |
################## Sections in the uninstaller ################## |
|
328 |
# There is only one section in the uninstaller. |
|
329 |
Section "Uninstall" |
|
330 |
# Delete Raptor |
|
331 |
RmDir /r $INSTDIR\bin |
|
332 |
RmDir /r $INSTDIR\examples |
|
333 |
RmDir /r $INSTDIR\lib |
|
334 |
RmDir /r $INSTDIR\python |
|
335 |
RmDir /r $INSTDIR\schema |
|
336 |
RmDir /r $INSTDIR\win32 |
|
337 |
Delete $INSTDIR\RELEASE-NOTES.txt |
|
338 |
Delete $INSTDIR\RaptorEnv.bat |
|
339 |
Delete $INSTDIR\${UNINSTALLER_FILENAME} |
|
340 |
||
341 |
!undef SYS_REG_BACKUP_FILE |
|
342 |
!undef USR_REG_BACKUP_FILE |
|
343 |
!define SYS_REG_BACKUP_FILE "$INSTDIR\SysEnvBackUpPreUninstall-${DATE_STAMP}.reg" |
|
344 |
!define USR_REG_BACKUP_FILE "$INSTDIR\UsrEnvBackUpPreUninstall-${DATE_STAMP}.reg" |
|
345 |
||
346 |
# Save System Environment just in case. |
|
347 |
${registry::SaveKey} "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "${SYS_REG_BACKUP_FILE}" "" "$RESULT" |
|
348 |
||
349 |
${If} $RESULT == 0 |
|
350 |
DetailPrint "Successfully backed up system environment in ${SYS_REG_BACKUP_FILE}." |
|
351 |
${Else} |
|
352 |
DetailPrint "Failed to back up system environment due to an unknown error." |
|
353 |
${EndIf} |
|
354 |
||
355 |
# Save user Environment just in case. |
|
356 |
${registry::SaveKey} "HKCU\Environment" "${USR_REG_BACKUP_FILE}" "" "$RESULT" |
|
357 |
||
358 |
${If} $RESULT == 0 |
|
359 |
DetailPrint "Successfully backed up user environment in ${USR_REG_BACKUP_FILE}." |
|
360 |
${Else} |
|
361 |
DetailPrint "Failed to back up user environment due to an unknown error." |
|
362 |
${EndIf} |
|
363 |
||
364 |
# Reset error flag |
|
365 |
ClearErrors |
|
366 |
||
367 |
# Read user SBS_HOME |
|
368 |
!insertmacro ReadUsrEnvVar "SBS_HOME" $RESULT |
|
369 |
||
370 |
${Unless} ${Errors} # No errors, so user %SBS_HOME% exists |
|
371 |
DetailPrint "Removing user environment variable SBS_HOME ($RESULT)" |
|
372 |
||
373 |
# Reset error flag |
|
374 |
ClearErrors |
|
375 |
!insertmacro RmUsrEnvVar "SBS_HOME" |
|
376 |
||
377 |
${If} ${Errors} |
|
378 |
DetailPrint "ERROR: The ${INSTALLER_NAME} uninstaller could not remove the user environment variable SBS_HOME." |
|
379 |
DetailPrint "Please remove it manually." |
|
380 |
${EndIf} |
|
381 |
||
382 |
${Else} # No env var named $SBS_HOME |
|
383 |
DetailPrint "Note: Unable to find user environment variable SBS_HOME." |
|
384 |
DetailPrint "If required, this variable may need to be removed manually." |
|
385 |
${EndUnless} |
|
386 |
||
387 |
# Reset error flag |
|
388 |
ClearErrors |
|
389 |
||
390 |
# Read system SBS_HOME |
|
391 |
!insertmacro ReadSysEnvVar "SBS_HOME" $RESULT |
|
392 |
||
393 |
${Unless} ${Errors} # No errors, so system $SBS_HOME exists |
|
394 |
DetailPrint "Removing system environment variable SBS_HOME ($RESULT)" |
|
395 |
||
396 |
# Reset error flag |
|
397 |
ClearErrors |
|
398 |
!insertmacro RmSysEnvVar "SBS_HOME" |
|
399 |
||
400 |
${If} ${Errors} |
|
401 |
DetailPrint "ERROR: The ${INSTALLER_NAME} uninstaller could not remove the \ |
|
402 |
System environment variable SBS_HOME." |
|
403 |
DetailPrint "Please remove it manually." |
|
404 |
${EndIf} |
|
405 |
||
406 |
${Else} # No env var named $SBS_HOME |
|
407 |
DetailPrint "Note: Unable to find system environment variable SBS_HOME." |
|
408 |
DetailPrint "If required, this variable may need to be removed manually." |
|
409 |
${EndUnless} |
|
410 |
||
411 |
################################# Clean up the path env vars ################################# |
|
412 |
# Reset error flag |
|
413 |
ClearErrors |
|
414 |
||
415 |
# Read user path |
|
416 |
!insertmacro ReadUsrPath $RESULT |
|
417 |
DetailPrint "Read user Path: $RESULT" |
|
418 |
||
419 |
${Unless} ${Errors} # No errors, so user $SBS_HOME exists |
|
420 |
${If} $RESULT == "" # If it came back empty. |
|
421 |
DetailPrint "No user Path available - nothing to do." |
|
422 |
${Else} |
|
423 |
${If} $RESULT un.=~ "%SBS_HOME%\\bin;" # Only need to act if %SBS_HOME%\bin; is in the Path |
|
424 |
DetailPrint "Removing %SBS_HOME%\bin; from user path" |
|
425 |
||
426 |
# Reset error flag and clean user Path |
|
427 |
ClearErrors |
|
428 |
!insertmacro RemoveFromPathString $RESULT "%SBS_HOME%\bin;" |
|
429 |
||
430 |
DetailPrint "DEBUG: User path $$RESULT = " |
|
431 |
DetailPrint "DEBUG: User path $RESULT" |
|
432 |
||
433 |
${If} $RESULT == "" |
|
434 |
!insertmacro RmUsrEnvVar "Path" |
|
435 |
${Else} |
|
436 |
# Write cleaned Path to registry |
|
437 |
!insertmacro WriteUsrEnvVarExp "Path" $RESULT |
|
438 |
${EndIf} |
|
439 |
||
440 |
${If} ${Errors} |
|
441 |
DetailPrint "ERROR: The ${INSTALLER_NAME} uninstaller could not clean the user Path. Please clean it manually." |
|
442 |
${EndIf} |
|
443 |
${Else} |
|
444 |
DetailPrint "Nothing to remove from user path." |
|
445 |
${EndIf} |
|
446 |
${EndIf} |
|
447 |
||
448 |
${Else} # No user path |
|
449 |
DetailPrint "Note: Unable to find user Path environment variable." |
|
450 |
DetailPrint "Please check that the variable exists and remove %SBS_HOME\bin manually if required." |
|
451 |
${EndUnless} |
|
452 |
||
453 |
# Read system path |
|
454 |
!insertmacro ReadSysPath $RESULT |
|
455 |
DetailPrint "Read system Path: $RESULT" |
|
456 |
||
457 |
${Unless} ${Errors} # No errors, so system path read OK. |
|
458 |
${If} $RESULT un.=~ "%SBS_HOME%\\bin;" # Only need to act if %SBS_HOME%\bin; is in the Path |
|
459 |
||
460 |
DetailPrint "Removing %SBS_HOME%\bin; from system path" |
|
461 |
||
462 |
# Reset error flag |
|
463 |
ClearErrors |
|
464 |
!insertmacro RemoveFromPathString $RESULT "%SBS_HOME%\bin;" |
|
465 |
DetailPrint "DEBUG: System Path $$RESULT = " |
|
466 |
DetailPrint "DEBUG: System Path $RESULT" |
|
467 |
ClearErrors |
|
468 |
# Write cleaned PATH to registry |
|
469 |
!insertmacro WriteSysEnvVarExp "Path" $RESULT |
|
470 |
||
471 |
${If} ${Errors} |
|
472 |
DetailPrint "ERROR: The ${INSTALLER_NAME} uninstaller could not clean the PATH." |
|
473 |
DetailPrint "Please clean it manually." |
|
474 |
${EndIf} |
|
475 |
${Else} |
|
476 |
DetailPrint "Nothing to remove from system path." |
|
477 |
${EndIf} |
|
478 |
${Else} # Some error reading system path |
|
479 |
DetailPrint "Note: Unable to read the system Path environment variable." |
|
480 |
DetailPrint "Please check that the variable and remove %SBS_HOME\bin manually if required." |
|
481 |
${EndUnless} |
|
482 |
||
483 |
########################################################################## |
|
484 |
# Refresh environment to get changes for SBS_HOME and PATH |
|
485 |
!insertmacro RefreshEnv |
|
486 |
||
487 |
# Unload registry plug in |
|
488 |
${registry::Unload} |
|
489 |
SectionEnd |
|
490 |
||
491 |
# Languages |
|
492 |
!insertmacro MUI_LANGUAGE "English" |
|
493 |
||
494 |
################################################ End ################################################ |