602
|
1 |
# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
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 |
#
|
|
15 |
|
|
16 |
###########################################################################################
|
|
17 |
# CBR Tools handling
|
|
18 |
#
|
|
19 |
!define RELTOOLSKEY "SOFTWARE\Symbian\Release Tools"
|
|
20 |
!define CBRTOOLSKEY "SOFTWARE\Symbian\Symbian CBR Tools"
|
|
21 |
!define PRODUCT_UNINST_KEY "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
|
|
22 |
|
|
23 |
VAR CBRUNINSTALL
|
|
24 |
|
|
25 |
!macro CBRToolsNSISManualUninstall inVersion inPath
|
|
26 |
SetShellVarContext current
|
|
27 |
RMDir /r "$SMPROGRAMS\Symbian CBR Tools\${inVersion}"
|
|
28 |
RMDir "$SMPROGRAMS\Symbian CBR Tools" ; delete if empty
|
|
29 |
RMDir /r "${inPath}"
|
|
30 |
DeleteRegKey HKLM "${PRODUCT_UNINST_KEY}\Symbian CBR Tools ${inVersion}"
|
|
31 |
DeleteRegKey HKLM "${CBRTOOLSKEY}\${inVersion}"
|
|
32 |
DeleteRegKey /ifempty HKLM "${CBRTOOLSKEY}"
|
|
33 |
Push "${inPath}"
|
|
34 |
!insertmacro PathTypeRmvFromEnvVar "path" "${inPath}" ""
|
|
35 |
!insertmacro SetShellVarCtxt
|
|
36 |
!macroend
|
|
37 |
|
|
38 |
|
|
39 |
!macro CBRToolsISManualUninstall inVersion inPath inUninstallKey
|
|
40 |
RMDir /r "$SMPROGRAMS\Symbian OS Release Tools\"
|
|
41 |
RMDir /r "${inPath}"
|
|
42 |
${If} "${inUninstallKey}" != ""
|
|
43 |
DeleteRegKey HKLM "${PRODUCT_UNINST_KEY}\${inUninstallKey}"
|
|
44 |
${EndIf}
|
|
45 |
DeleteRegKey HKLM "${RELTOOLSKEY}\${inVersion}"
|
|
46 |
DeleteRegKey /ifempty HKLM "${RELTOOLSKEY}"
|
|
47 |
DeleteRegKey /ifempty HKLM "SOFTWARE\Symbian"
|
|
48 |
Push "${inPath}"
|
|
49 |
!insertmacro PathTypeRmvFromEnvVar "path" "${inPath}" ""
|
|
50 |
!macroend
|
|
51 |
|
|
52 |
|
|
53 |
Function CBRToolsPreConfigureFunction
|
|
54 |
exch $0
|
|
55 |
push $1 # counter
|
|
56 |
push $2 # version
|
|
57 |
push $3 # uninstall string
|
|
58 |
push $4
|
|
59 |
push $5
|
|
60 |
|
|
61 |
push $6
|
|
62 |
|
|
63 |
push $R0 # $ReplaceVer
|
|
64 |
push $R1 # $ReplaceKey
|
|
65 |
|
|
66 |
push $R2 # nsis installations found
|
|
67 |
push $R3 # install shield installations found
|
|
68 |
StrCpy $CBRUNINSTALL "no"
|
|
69 |
StrCpy $5 1
|
|
70 |
SectionGetFlags $0 $R0
|
|
71 |
IntOp $R0 $R0 & ${SF_SELECTED}
|
|
72 |
${If} $R0 == ${SF_SELECTED}
|
|
73 |
|
|
74 |
StrCpy $R0 "Following CBR Tools version(s) are already installed: "
|
|
75 |
StrCpy $R1 ""
|
|
76 |
StrCpy $R2 ""
|
|
77 |
StrCpy $R3 ""
|
|
78 |
StrCpy $6 ""
|
|
79 |
StrCpy $1 0
|
|
80 |
loop: #check if there is install shield installation
|
|
81 |
EnumRegKey $2 HKLM "${RELTOOLSKEY}" $1
|
|
82 |
StrCmp $2 "" checkNsis
|
|
83 |
IntOp $1 $1 + 1
|
|
84 |
readregstr $3 HKLM "${RELTOOLSKEY}\$2" "Path"
|
|
85 |
StrCpy $R3 "1"
|
|
86 |
StrCpy $R0 "$R0$\r$\nVersion $2 is already installed in $3."
|
|
87 |
GoTo loop
|
|
88 |
|
|
89 |
checkNsis: # check if there is NSIS installation
|
|
90 |
StrCpy $4 $1
|
|
91 |
StrCpy $1 0
|
|
92 |
loop1:
|
|
93 |
EnumRegKey $2 HKLM "${CBRTOOLSKEY}" $1
|
|
94 |
StrCmp $2 "" done
|
|
95 |
IntOp $1 $1 + 1
|
|
96 |
readregstr $3 HKLM "${CBRTOOLSKEY}\$2" "Path"
|
|
97 |
StrCpy $R2 "$R2-$2-"
|
|
98 |
StrCpy $R0 "$R0$\r$\nVersion $2 is already installed in $3."
|
|
99 |
GoTo loop1
|
|
100 |
|
|
101 |
done:
|
|
102 |
IntOp $1 $1 + $4
|
|
103 |
${If} $1 > 0
|
|
104 |
|
|
105 |
${If} $SILENT == "true"
|
|
106 |
${AndIf} $DIALOGS == "false"
|
|
107 |
!insertmacro LogStopMessage "CBRTools (Release Tools) already installed. Stopping installation.\
|
|
108 |
$\r$\nPlease uninstall CBRTools (Rlease Tools) before continuing " "${OTHER_ERROR}"
|
|
109 |
${Else}
|
|
110 |
MessageBox MB_YESNOCANCEL "$R0$\r$\n\
|
|
111 |
Do you want to uninstall previous installation(s) before continuing?" IDYES continue IDNO finish
|
|
112 |
${EndIf}
|
|
113 |
|
|
114 |
cancel:
|
|
115 |
StrCpy $5 0
|
|
116 |
GoTo finish
|
|
117 |
|
|
118 |
|
|
119 |
continue:
|
|
120 |
StrCpy $CBRUNINSTALL "yes"
|
|
121 |
|
|
122 |
${EndIf}
|
|
123 |
finish:
|
|
124 |
${EndIf}
|
|
125 |
StrCpy $0 "$5"
|
|
126 |
pop $R3
|
|
127 |
pop $R2
|
|
128 |
pop $R1
|
|
129 |
pop $R0
|
|
130 |
pop $6
|
|
131 |
pop $5
|
|
132 |
pop $4
|
|
133 |
pop $3
|
|
134 |
pop $2
|
|
135 |
pop $1
|
|
136 |
exch $0
|
|
137 |
FunctionEnd
|
|
138 |
|
|
139 |
Function CBRToolsPreviousUninstall
|
|
140 |
exch $0
|
|
141 |
push $1 # counter
|
|
142 |
push $2 # version
|
|
143 |
push $3 # uninstall string
|
|
144 |
push $4
|
|
145 |
push $5
|
|
146 |
|
|
147 |
push $6
|
|
148 |
|
|
149 |
push $R0 # $ReplaceVer
|
|
150 |
push $R1 # $ReplaceKey
|
|
151 |
|
|
152 |
push $R2 # nsis installations found
|
|
153 |
push $R3 # install shield installations found
|
|
154 |
|
|
155 |
${If} $CBRUNINSTALL == "yes"
|
|
156 |
#uninstall
|
|
157 |
#Uninstall first all NSIS installations
|
|
158 |
StrCpy $1 0
|
|
159 |
EnumRegKey $2 HKLM "${CBRTOOLSKEY}" $1
|
|
160 |
${While} $2 != ""
|
|
161 |
ReadRegStr $3 HKLM "${PRODUCT_UNINST_KEY}\Symbian CBR Tools $2" "UninstallString"
|
|
162 |
ReadRegStr $4 HKLM "${CBRTOOLSKEY}\$2" "Path"
|
|
163 |
${If} $3 == "" #no uninstaller found
|
|
164 |
StrCpy $6 "error"
|
|
165 |
${Else}
|
|
166 |
IfFileExists $3 +2 0
|
|
167 |
StrCpy $6 "error"
|
|
168 |
${EndIf}
|
|
169 |
|
|
170 |
${If} $SILENT == "false"
|
|
171 |
${OrIf} $DIALOGS == "true"
|
|
172 |
Banner::show /NOUNLOAD /set 76 "Removing previous installation $2..." "Please wait."
|
|
173 |
${EndIf}
|
|
174 |
IfFileExists "$4\reltools.ini" 0 +3
|
|
175 |
CreateDirectory "$TEMP\sitk\$2\"
|
|
176 |
CopyFiles /SILENT "$4\reltools.ini" "$TEMP\sitk\$2\"
|
|
177 |
${If} $6 == "error"
|
|
178 |
!insertmacro CBRToolsNSISManualUninstall "$2" "$4"
|
|
179 |
${Else}
|
|
180 |
ClearErrors
|
|
181 |
ExecWait '"$3" /S _?=$4\' ;$3: Uninstaller $4:installation path
|
|
182 |
IfErrors +2 0
|
|
183 |
RMDir /r $4 ; delete installation folder
|
|
184 |
${EndIf}
|
|
185 |
IfFileExists "$TEMP\sitk\$2\reltools.ini" 0 +4
|
|
186 |
CreateDirectory "$4"
|
|
187 |
CopyFiles /SILENT "$TEMP\sitk\$2\reltools.ini" "$4"
|
|
188 |
RMDir /r "$TEMP\sitk\$2\"
|
|
189 |
${If} $SILENT == "false"
|
|
190 |
${OrIf} $DIALOGS == "true"
|
|
191 |
Banner::destroy
|
|
192 |
${EndIf}
|
|
193 |
|
|
194 |
#IntOp $1 $1 + 1
|
|
195 |
EnumRegKey $2 HKLM "${CBRTOOLSKEY}" $1
|
|
196 |
${EndWhile}
|
|
197 |
|
|
198 |
loop: #check if there is install shield installation
|
|
199 |
|
|
200 |
|
|
201 |
StrCpy $1 0
|
|
202 |
StrCpy $R3 0
|
|
203 |
EnumRegKey $2 HKLM "${RELTOOLSKEY}" $1
|
|
204 |
${While} $2 != ""
|
|
205 |
ReadRegStr $3 HKLM "${RELTOOLSKEY}\$2" "Path"
|
|
206 |
|
|
207 |
CreateDirectory "$TEMP\sitk\InstallShield\$2\"
|
|
208 |
IfFileExists "$3\reltools.ini" 0 +2
|
|
209 |
CopyFiles /SILENT "$3\reltools.ini" "$TEMP\sitk\InstallShield\$2\"
|
|
210 |
FileOpen $4 "$TEMP\sitk\InstallShield\$2\dir.txt" "w"
|
|
211 |
FileWrite $4 "$3"
|
|
212 |
FileClose $4
|
|
213 |
StrCpy $R3 "1"
|
|
214 |
IntOp $1 $1 + 1
|
|
215 |
EnumRegKey $2 HKLM "${RELTOOLSKEY}" $1
|
|
216 |
${EndWhile}
|
|
217 |
|
|
218 |
|
|
219 |
${If} $R3 == "1" #Look for install shield installations to uninstall
|
|
220 |
StrCpy $1 0
|
|
221 |
StrCpy $6 ""
|
|
222 |
EnumRegKey $2 HKLM "${PRODUCT_UNINST_KEY}" $1
|
|
223 |
${While} $2 != ""
|
|
224 |
ReadRegStr $3 HKLM "${PRODUCT_UNINST_KEY}\$2" "DisplayName"
|
|
225 |
${If} $3 == "Release Tools"
|
|
226 |
${ExitWhile}
|
|
227 |
${EndIf}
|
|
228 |
IntOp $1 $1 + 1
|
|
229 |
EnumRegKey $2 HKLM "${PRODUCT_UNINST_KEY}" $1
|
|
230 |
${EndWhile}
|
|
231 |
|
|
232 |
${If} $2 == ""
|
|
233 |
StrCpy $6 "error"
|
|
234 |
${ElseIf} $3 == "Release Tools"
|
|
235 |
ReadRegStr $3 HKLM "${PRODUCT_UNINST_KEY}\$2" "UninstallString"
|
|
236 |
${If} $3 == ""
|
|
237 |
StrCpy $6 "error"
|
|
238 |
${Else}
|
|
239 |
MessageBox MB_OK "InstallShield will be launched, please select <remove> and follow the wizard" /SD IDOK
|
|
240 |
ExecWait $3
|
|
241 |
${EndIf}
|
|
242 |
${EndIf}
|
|
243 |
|
|
244 |
FindFirst $0 $4 "$TEMP\sitk\InstallShield\*"
|
|
245 |
${While} $4 != ""
|
|
246 |
${If} $4 != "."
|
|
247 |
${AndIf} $4 != ".."
|
|
248 |
IfFileExists "$TEMP\sitk\InstallShield\$4\dir.txt" 0 notfound
|
|
249 |
|
|
250 |
FileOpen $3 "$TEMP\sitk\InstallShield\$4\dir.txt" "r"
|
|
251 |
FileRead $3 $1
|
|
252 |
FileClose $3
|
|
253 |
|
|
254 |
${If} $6 == "error"
|
|
255 |
!insertmacro CBRToolsISManualUninstall "$4" "$1" "$2"
|
|
256 |
${EndIf}
|
|
257 |
|
|
258 |
IfFileExists "$TEMP\sitk\InstallShield\$4\reltools.ini" 0 notfound
|
|
259 |
CreateDirectory "$1"
|
|
260 |
CopyFiles /SILENT "$TEMP\sitk\InstallShield\$4\reltools.ini" "$1"
|
|
261 |
notfound:
|
|
262 |
|
|
263 |
${EndIf}
|
|
264 |
FindNext $0 $4
|
|
265 |
${EndWhile}
|
|
266 |
FindClose $0
|
|
267 |
|
|
268 |
${EndIf}
|
|
269 |
#uninstal
|
|
270 |
${EndIF}
|
|
271 |
|
|
272 |
pop $R3
|
|
273 |
pop $R2
|
|
274 |
pop $R1
|
|
275 |
pop $R0
|
|
276 |
pop $6
|
|
277 |
pop $5
|
|
278 |
pop $4
|
|
279 |
pop $3
|
|
280 |
pop $2
|
|
281 |
pop $1
|
|
282 |
pop $0
|
|
283 |
FunctionEnd
|
|
284 |
|
|
285 |
!macro CBRToolsPreconfigure inSectionName
|
|
286 |
push "${inSectionName}"
|
|
287 |
call CBRToolsPreConfigureFunction
|
|
288 |
!macroend
|