win-pvdrivers

view installer.nsi @ 293:279f5623f6c7

Tweaks to try and improve performance.
author James Harper <james.harper@bendigoit.com.au>
date Sun Jun 08 23:13:44 2008 +1000 (2008-06-08)
parents 873944504204
children 60372bd2582d
line source
1 !include "MUI.nsh"
2 !include "driver.nsh"
4 !define AppName "Xen PV Drivers"
5 !define StartMenu "$SMPROGRAMS\${AppName}"
6 !define Version "0.9.8"
7 #!define Version "$%VERSION%"
8 Name "${AppName}"
9 InstallDir "$PROGRAMFILES\${AppName}"
10 OutFile "${AppName} ${Version}.exe"
12 # make sure /GPLPV is not currently active
14 #!define MUI_PAGE_CUSTOMFUNCTION_PRE WelcomePageSetupLinkPre
15 #!define MUI_PAGE_CUSTOMFUNCTION_SHOW WelcomePageSetupLinkShow
16 !define MUI_STARTMENUPAGE
17 !define MUI_COMPONENTSPAGE
18 !define MUI_DIRECTORYPAGE
19 !insertmacro MUI_PAGE_WELCOME
20 !insertmacro MUI_PAGE_COMPONENTS
21 !insertmacro MUI_PAGE_INSTFILES
22 !define MUI_UNINSTALLER
23 !insertmacro MUI_LANGUAGE "English"
25 Section "Common Files"
26 SectionIn RO
27 SetOutPath $INSTDIR
28 File .\doc\Building.txt
29 File .\doc\Installing.txt
30 File .\doc\Readme.txt
31 File .\doc\TODO.txt
32 CreateDirectory "${StartMenu}\"
33 CreateShortCut "${StartMenu}\Building.lnk" "$INSTDIR\Building.txt"
34 CreateShortCut "${StartMenu}\Installing.lnk" "$INSTDIR\Installing.txt"
35 CreateShortCut "${StartMenu}\Readme.lnk" "$INSTDIR\Readme.txt"
36 CreateShortCut "${StartMenu}\TODO.lnk" "$INSTDIR\TODO.txt"
37 CreateShortCut "${StartMenu}\Wiki Page.lnk" "http://wiki.xensource.com/xenwiki/XenWindowsGplPv"
38 WriteUninstaller $INSTDIR\Uninstall.exe
39 CreateShortCut "${StartMenu}\Uninstall.lnk" "$INSTDIR\uninstall.exe"
40 SectionEnd
42 Section "Shutdown Monitor Service" shutdownmon
43 SetOutPath $INSTDIR
45 # stop shutdownmon service
46 File .\target\ShutdownMon.exe
47 CreateShortCut "${StartMenu}\Install Shutdown Service.lnk" "$INSTDIR\ShutdownMon.exe" "-i"
48 CreateShortCut "${StartMenu}\UnInstall Shutdown Service.lnk" "$INSTDIR\ShutdownMon.exe" "-u"
49 # start shutdownmon service
50 SectionEnd
52 Section "Windows 2000" win2k
53 SetOutPath $INSTDIR\drivers
54 File .\target\win2k\xenpci.inf
55 File .\target\win2k\xennet.inf
56 File .\target\win2k\xenvbd.inf
57 File .\target\win2k\xenscsi.inf
58 File .\target\win2k\xenstub.inf
59 SetOutPath $INSTDIR\drivers\i386
60 File .\target\win2k\i386\xenpci.sys
61 File .\target\win2k\i386\xenhide.sys
62 File .\target\win2k\i386\xennet.sys
63 File .\target\win2k\i386\xenvbd.sys
64 File .\target\win2k\i386\xenscsi.sys
65 File .\target\win2k\i386\xenstub.sys
66 SectionEnd
68 Section "Windows XP" winxp
69 SetOutPath $INSTDIR\drivers
70 File .\target\winxp\xenpci.inf
71 File .\target\winxp\xennet.inf
72 File .\target\winxp\xenvbd.inf
73 File .\target\winxp\xenscsi.inf
74 File .\target\winxp\xenstub.inf
75 SetOutPath $INSTDIR\drivers\i386
76 File .\target\winxp\i386\xenpci.sys
77 File .\target\winxp\i386\xenhide.sys
78 File .\target\winxp\i386\xennet.sys
79 File .\target\winxp\i386\xenvbd.sys
80 File .\target\winxp\i386\xenscsi.sys
81 File .\target\winxp\i386\xenstub.sys
82 SectionEnd
84 Section "Windows 2003 x32" win2k3x32
85 SetOutPath $INSTDIR\drivers
86 File .\target\winnet\xenpci.inf
87 File .\target\winnet\xennet.inf
88 File .\target\winnet\xenvbd.inf
89 File .\target\winnet\xenscsi.inf
90 File .\target\winnet\xenstub.inf
91 SetOutPath $INSTDIR\drivers\i386
92 File .\target\winnet\i386\xenpci.sys
93 File .\target\winnet\i386\xenhide.sys
94 File .\target\winnet\i386\xennet.sys
95 File .\target\winnet\i386\xenvbd.sys
96 File .\target\winnet\i386\xenscsi.sys
97 File .\target\winnet\i386\xenstub.sys
98 SectionEnd
100 Section "Windows 2003 x64" win2k3x64
101 SetOutPath $INSTDIR\drivers
102 File .\target\winnet\xenpci.inf
103 File .\target\winnet\xennet.inf
104 File .\target\winnet\xenvbd.inf
105 File .\target\winnet\xenscsi.inf
106 File .\target\winnet\xenstub.inf
107 SetOutPath $INSTDIR\drivers\amd64
108 File .\target\winnet\amd64\xenpci.sys
109 File .\target\winnet\amd64\xenhide.sys
110 File .\target\winnet\amd64\xennet.sys
111 File .\target\winnet\amd64\xenvbd.sys
112 File .\target\winnet\amd64\xenscsi.sys
113 File .\target\winnet\amd64\xenstub.sys
114 SectionEnd
116 Section "Windows 2008 x32" win2k8x32
117 SetOutPath $INSTDIR\drivers
118 File .\target\winlh\xenpci.inf
119 File .\target\winlh\xennet.inf
120 File .\target\winlh\xenvbd.inf
121 File .\target\winlh\xenscsi.inf
122 File .\target\winlh\xenstub.inf
123 SetOutPath $INSTDIR\drivers\i386
124 File .\target\winlh\i386\xenpci.sys
125 File .\target\winlh\i386\xenhide.sys
126 File .\target\winlh\i386\xennet.sys
127 File .\target\winlh\i386\xenvbd.sys
128 File .\target\winlh\i386\xenscsi.sys
129 File .\target\winlh\i386\xenstub.sys
130 SectionEnd
132 Section "Windows 2008 x64" win2k8x64
133 SetOutPath $INSTDIR\drivers
134 File .\target\winlh\xenpci.inf
135 File .\target\winlh\xennet.inf
136 File .\target\winlh\xenvbd.inf
137 File .\target\winlh\xenscsi.inf
138 File .\target\winlh\xenstub.inf
139 SetOutPath $INSTDIR\drivers\amd64
140 File .\target\winlh\amd64\xenpci.sys
141 File .\target\winlh\amd64\xenhide.sys
142 File .\target\winlh\amd64\xennet.sys
143 File .\target\winlh\amd64\xenvbd.sys
144 File .\target\winlh\amd64\xenscsi.sys
145 File .\target\winlh\amd64\xenstub.sys
146 SectionEnd
148 Section "Install Drivers" installdrivers
149 Push "$INSTDIR\drivers"
150 Push "$INSTDIR\drivers\xenpci.inf"
151 Push "PCI\VEN_5853&DEV_0001"
152 Call InstallUpgradeDriver
154 Push "$INSTDIR\drivers"
155 Push "$INSTDIR\drivers\xennet.inf"
156 Push "XEN\VIF"
157 Call InstallUpgradeDriver
159 Push "$INSTDIR\drivers"
160 Push "$INSTDIR\drivers\xenvbd.inf"
161 Push "XEN\VBD"
162 Call InstallUpgradeDriver
164 Push "$INSTDIR\drivers"
165 Push "$INSTDIR\drivers\xenscsi.inf"
166 Push "XEN\VSCSI"
167 Call InstallUpgradeDriver
169 Push "$INSTDIR\drivers"
170 Push "$INSTDIR\drivers\xenstub.inf"
171 Push "XEN\CONSOLE"
172 Call InstallUpgradeDriver
174 Push "$INSTDIR\drivers"
175 Push "$INSTDIR\drivers\xenstub.inf"
176 Push "XEN\VFB"
177 Call InstallUpgradeDriver
179 Push "$INSTDIR\drivers"
180 Push "$INSTDIR\drivers\xenstub.inf"
181 Push "XEN\VKBD"
182 Call InstallUpgradeDriver
183 SectionEnd
185 Var arch
187 Function .onInit
188 Push $0
190 ReadRegStr $0 HKLM SYSTEM\CurrentControlSet\Control SystemStartOptions
191 Push $0
192 Push "GPLPV"
193 Call StrContains
194 Pop $0
195 StrCmp $0 "" no_GPLPV
196 MessageBox MB_OK "Warning - GPLPV specified on boot. Upgrade may work but install may break things"
197 no_GPLPV:
199 Call GetWindowsVersion
200 Pop $R0
202 StrCmp $R0 "2000" 0 check_XP
203 StrCpy $arch "win2k"
204 Goto version_done
205 check_XP:
206 StrCmp $R0 "XP" 0 check_2k3
207 StrCpy $arch "winxp"
208 Goto version_done
209 check_2k3:
210 StrCmp $R0 "2003" 0 check_2k8
211 ReadRegStr $0 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" PROCESSOR_ARCHITECTURE
212 StrCmp $0 "AMD64" version_2k3x64
213 StrCpy $arch "win2k3x32"
214 Goto version_done
215 version_2k3x64:
216 StrCpy $arch "win2k3x64"
217 Goto version_done
218 check_2k8:
219 StrCmp $R0 "Vista" 0 version_error
220 ReadRegStr $0 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" PROCESSOR_ARCHITECTURE
221 StrCmp $0 "AMD64" version_2k8x64
222 StrCpy $arch "win2k8x32"
223 Goto version_done
224 version_2k8x64:
225 StrCpy $arch "win2k8x64"
226 Goto version_done
227 version_error:
228 MessageBox MB_OK "Unable to detect windows version - proceed with caution"
229 StrCpy $arch ""
231 version_done:
232 Call SelectSection
234 # SectionGetFlags ${sec1} $0
235 # IntOp $0 $0 | ${SF_SELECTED}
236 # SectionSetFlags ${sec1} $0
238 Pop $0
239 FunctionEnd
241 Var NewArch
243 Function .onSelChange
244 Push $0
246 StrCmp $arch "win2k" check_xp
247 SectionGetFlags ${win2k} $0
248 IntOp $0 $0 & ${SF_SELECTED}
249 IntCmp $0 ${SF_SELECTED} 0 check_xp check_xp
250 StrCpy $newarch "win2k"
251 check_xp:
252 StrCmp $arch "winxp" check_2k3x32
253 SectionGetFlags ${winxp} $0
254 IntOp $0 $0 & ${SF_SELECTED}
255 IntCmp $0 ${SF_SELECTED} 0 check_2k3x32 check_2k3x32
256 StrCpy $newarch "winxp"
257 check_2k3x32:
258 StrCmp $arch "win2k3x32" check_2k3x64
259 SectionGetFlags ${win2k3x32} $0
260 IntOp $0 $0 & ${SF_SELECTED}
261 IntCmp $0 ${SF_SELECTED} 0 check_2k3x64 check_2k3x64
262 StrCpy $newarch "win2k3x32"
263 check_2k3x64:
264 StrCmp $arch "win2k3x64" check_2k8x32
265 SectionGetFlags ${win2k3x64} $0
266 IntOp $0 $0 & ${SF_SELECTED}
267 IntCmp $0 ${SF_SELECTED} 0 check_2k8x32 check_2k8x32
268 StrCpy $newarch "win2k3x64"
269 check_2k8x32:
270 StrCmp $arch "win2k8x32" check_2k8x64
271 SectionGetFlags ${win2k8x32} $0
272 IntOp $0 $0 & ${SF_SELECTED}
273 IntCmp $0 ${SF_SELECTED} 0 check_2k8x64 check_2k8x64
274 StrCpy $newarch "win2k8x32"
275 check_2k8x64:
276 StrCmp $arch "win2k8x64" done
277 SectionGetFlags ${win2k8x64} $0
278 IntOp $0 $0 & ${SF_SELECTED}
279 IntCmp $0 ${SF_SELECTED} 0 done done
280 StrCpy $newarch "win2k8x64"
281 done:
282 StrCpy $arch $newarch
283 Call SelectSection
285 Pop $0
286 FunctionEnd
288 Function SelectSection
289 Push $0
291 StrCmp $arch "win2k" check_xp
292 SectionGetFlags ${win2k} $0
293 IntOp $0 $0 & ${SECTION_OFF}
294 SectionSetFlags ${win2k} $0
295 check_xp:
296 StrCmp $arch "winxp" check_2k3x32
297 SectionGetFlags ${winxp} $0
298 IntOp $0 $0 & ${SECTION_OFF}
299 SectionSetFlags ${winxp} $0
300 check_2k3x32:
301 StrCmp $arch "win2k3x32" check_2k3x64
302 SectionGetFlags ${win2k3x32} $0
303 IntOp $0 $0 & ${SECTION_OFF}
304 SectionSetFlags ${win2k3x32} $0
305 check_2k3x64:
306 StrCmp $arch "win2k3x64" check_2k8x32
307 SectionGetFlags ${win2k3x64} $0
308 IntOp $0 $0 & ${SECTION_OFF}
309 SectionSetFlags ${win2k3x64} $0
310 check_2k8x32:
311 StrCmp $arch "win2k8x32" check_2k8x64
312 SectionGetFlags ${win2k8x32} $0
313 IntOp $0 $0 & ${SECTION_OFF}
314 SectionSetFlags ${win2k8x32} $0
315 check_2k8x64:
316 StrCmp $arch "win2k8x64" done
317 SectionGetFlags ${win2k8x64} $0
318 IntOp $0 $0 & ${SECTION_OFF}
319 SectionSetFlags ${win2k8x64} $0
320 done:
321 Pop $0
323 FunctionEnd
325 Section "Uninstall"
326 Delete "${StartMenu}\Uninstall.lnk"
327 RMDir "${StartMenu}\"
328 Delete $INSTDIR\uninstall.exe
329 RMDir $INSTDIR
330 SectionEnd
332 Var STR_HAYSTACK
333 Var STR_NEEDLE
334 Var STR_CONTAINS_VAR_1
335 Var STR_CONTAINS_VAR_2
336 Var STR_CONTAINS_VAR_3
337 Var STR_CONTAINS_VAR_4
338 Var STR_RETURN_VAR
340 Function StrContains
341 Exch $STR_NEEDLE
342 Exch 1
343 Exch $STR_HAYSTACK
344 ; Uncomment to debug
345 ;MessageBox MB_OK 'STR_NEEDLE = $STR_NEEDLE STR_HAYSTACK = $STR_HAYSTACK '
346 StrCpy $STR_RETURN_VAR ""
347 StrCpy $STR_CONTAINS_VAR_1 -1
348 StrLen $STR_CONTAINS_VAR_2 $STR_NEEDLE
349 StrLen $STR_CONTAINS_VAR_4 $STR_HAYSTACK
350 loop:
351 IntOp $STR_CONTAINS_VAR_1 $STR_CONTAINS_VAR_1 + 1
352 StrCpy $STR_CONTAINS_VAR_3 $STR_HAYSTACK $STR_CONTAINS_VAR_2 $STR_CONTAINS_VAR_1
353 StrCmp $STR_CONTAINS_VAR_3 $STR_NEEDLE found
354 StrCmp $STR_CONTAINS_VAR_1 $STR_CONTAINS_VAR_4 done
355 Goto loop
356 found:
357 StrCpy $STR_RETURN_VAR $STR_NEEDLE
358 Goto done
359 done:
360 Pop $STR_NEEDLE ;Prevent "invalid opcode" errors and keep the
361 Exch $STR_RETURN_VAR
362 FunctionEnd