win-pvdrivers

view installer.nsi @ 425:ea14db3ca6f2

Don't disable xen drivers when gplpv isn't specified. Instead just make the xennet driver always report cable disconnected, and xenvbd not enumerate any disks.
author James Harper <james.harper@bendigoit.com.au>
date Thu Sep 04 22:31:38 2008 +1000 (2008-09-04)
parents 718d4567551d
children 599061042271
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.11-pre14"
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"
41 SectionEnd
43 Section "Shutdown Monitor Service" shutdownmon
44 SetOutPath $INSTDIR
46 ExecWait 'NET STOP XenShutdownMon'
47 File .\target\ShutdownMon.exe
48 # CreateShortCut "${StartMenu}\Install Shutdown Service.lnk" "$INSTDIR\ShutdownMon.exe" "-i"
49 # CreateShortCut "${StartMenu}\UnInstall Shutdown Service.lnk" "$INSTDIR\ShutdownMon.exe" "-u"
50 ExecWait '"$INSTDIR\ShutdownMon.exe" -i'
51 ExecWait 'NET START XenShutdownMon'
52 SectionEnd
54 Section "Windows 2000" win2k
55 SetOutPath $INSTDIR
56 File /nonfatal .\ca.cer
57 SetOutPath $INSTDIR\drivers
58 File .\target\win2k\xenpci.inf
59 File .\target\win2k\xennet.inf
60 File .\target\win2k\xenvbd.inf
61 File .\target\win2k\xenscsi.inf
62 File .\target\win2k\xenstub.inf
63 SetOutPath $INSTDIR\drivers\i386
64 File .\target\win2k\i386\xenpci.sys
65 File .\target\win2k\i386\xenhide.sys
66 File .\target\win2k\i386\xennet.sys
67 File .\target\win2k\i386\xenvbd.sys
68 File .\target\win2k\i386\xenscsi.sys
69 File .\target\win2k\i386\xenstub.sys
70 File .\target\win2k\i386\xenconfig.sys
71 SectionEnd
73 Section "Windows XP" winxp
74 SetOutPath $INSTDIR
75 File /nonfatal .\ca.cer
76 SetOutPath $INSTDIR\drivers
77 File .\target\winxp\xenpci.inf
78 File .\target\winxp\xennet.inf
79 File .\target\winxp\xenvbd.inf
80 File .\target\winxp\xenscsi.inf
81 File .\target\winxp\xenstub.inf
82 File /nonfatal .\target\winxp\xengplpv.cat
83 SetOutPath $INSTDIR\drivers\i386
84 File .\target\winxp\i386\xenpci.sys
85 File .\target\winxp\i386\xenhide.sys
86 File .\target\winxp\i386\xennet.sys
87 File .\target\winxp\i386\xenvbd.sys
88 File .\target\winxp\i386\xenscsi.sys
89 File .\target\winxp\i386\xenstub.sys
90 File .\target\winxp\i386\xenconfig.sys
91 SectionEnd
93 Section "Windows 2003 x32" win2k3x32
94 SetOutPath $INSTDIR
95 File /nonfatal .\ca.cer
96 SetOutPath $INSTDIR\drivers
97 File .\target\winnet\xenpci.inf
98 File .\target\winnet\xennet.inf
99 File .\target\winnet\xenvbd.inf
100 File .\target\winnet\xenscsi.inf
101 File .\target\winnet\xenstub.inf
102 File /nonfatal .\target\winnet\xengplpv.cat
103 SetOutPath $INSTDIR\drivers\i386
104 File .\target\winnet\i386\xenpci.sys
105 File .\target\winnet\i386\xenhide.sys
106 File .\target\winnet\i386\xennet.sys
107 File .\target\winnet\i386\xenvbd.sys
108 File .\target\winnet\i386\xenscsi.sys
109 File .\target\winnet\i386\xenstub.sys
110 File .\target\winnet\i386\xenconfig.sys
111 SectionEnd
113 Section "Windows 2003 x64" win2k3x64
114 SetOutPath $INSTDIR
115 File /nonfatal .\ca.cer
116 SetOutPath $INSTDIR\drivers
117 File .\target\winnet\xenpci.inf
118 File .\target\winnet\xennet.inf
119 File .\target\winnet\xenvbd.inf
120 File .\target\winnet\xenscsi.inf
121 File .\target\winnet\xenstub.inf
122 File /nonfatal .\target\winnet\xengplpv.cat
123 SetOutPath $INSTDIR\drivers\amd64
124 File .\target\winnet\amd64\xenpci.sys
125 File .\target\winnet\amd64\xenhide.sys
126 File .\target\winnet\amd64\xennet.sys
127 File .\target\winnet\amd64\xenvbd.sys
128 File .\target\winnet\amd64\xenscsi.sys
129 File .\target\winnet\amd64\xenstub.sys
130 File .\target\winnet\amd64\xenconfig.sys
131 SectionEnd
133 Section "Windows 2008 x32" win2k8x32
134 SetOutPath $INSTDIR
135 File /nonfatal .\ca.cer
136 SetOutPath $INSTDIR\drivers
137 File .\target\winlh\xenpci.inf
138 File .\target\winlh\xennet.inf
139 File .\target\winlh\xenvbd.inf
140 File .\target\winlh\xenscsi.inf
141 File .\target\winlh\xenstub.inf
142 File /nonfatal .\target\winlh\xengplpv.cat
143 SetOutPath $INSTDIR\drivers\i386
144 File .\target\winlh\i386\xenpci.sys
145 File .\target\winlh\i386\xenhide.sys
146 File .\target\winlh\i386\xennet.sys
147 File .\target\winlh\i386\xenvbd.sys
148 File .\target\winlh\i386\xenscsi.sys
149 File .\target\winlh\i386\xenstub.sys
150 File .\target\winlh\i386\xenconfig.sys
151 SectionEnd
153 Section "Windows 2008 x64" win2k8x64
154 SetOutPath $INSTDIR
155 File /nonfatal .\ca.cer
156 SetOutPath $INSTDIR\drivers
157 File .\target\winlh\xenpci.inf
158 File .\target\winlh\xennet.inf
159 File .\target\winlh\xenvbd.inf
160 File .\target\winlh\xenscsi.inf
161 File .\target\winlh\xenstub.inf
162 File /nonfatal .\target\winlh\xengplpv.cat
163 SetOutPath $INSTDIR\drivers\amd64
164 File .\target\winlh\amd64\xenpci.sys
165 File .\target\winlh\amd64\xenhide.sys
166 File .\target\winlh\amd64\xennet.sys
167 File .\target\winlh\amd64\xenvbd.sys
168 File .\target\winlh\amd64\xenscsi.sys
169 File .\target\winlh\amd64\xenstub.sys
170 File .\target\winlh\amd64\xenconfig.sys
171 SectionEnd
173 Section /o "Install Cert" installcert
174 ExecWait 'rundll32.exe cryptext.dll,CryptExtAddCER $INSTDIR\ca.cer'
175 SectionEnd
177 Section "Install Drivers" installdrivers
178 Push "$INSTDIR\drivers"
179 Push "$INSTDIR\drivers\xennet.inf"
180 Push "XEN\VIF"
181 Call InstallUpgradeDriver
183 Push "$INSTDIR\drivers"
184 Push "$INSTDIR\drivers\xenvbd.inf"
185 Push "XEN\VBD"
186 Call InstallUpgradeDriver
188 Push "$INSTDIR\drivers"
189 Push "$INSTDIR\drivers\xenscsi.inf"
190 Push "XEN\VSCSI"
191 Call InstallUpgradeDriver
193 Push "$INSTDIR\drivers"
194 Push "$INSTDIR\drivers\xenstub.inf"
195 Push "XEN\CONSOLE"
196 Call InstallUpgradeDriver
198 Push "$INSTDIR\drivers"
199 Push "$INSTDIR\drivers\xenstub.inf"
200 Push "XEN\VFB"
201 Call InstallUpgradeDriver
203 Push "$INSTDIR\drivers"
204 Push "$INSTDIR\drivers\xenstub.inf"
205 Push "XEN\VKBD"
206 Call InstallUpgradeDriver
208 Push "$INSTDIR\drivers"
209 Push "$INSTDIR\drivers\xenpci.inf"
210 Push "PCI\VEN_5853&DEV_0001"
211 Call InstallUpgradeDriver
212 SectionEnd
214 Var arch
216 Function .onInit
217 Push $0
219 ReadRegStr $0 HKLM SYSTEM\CurrentControlSet\Control SystemStartOptions
220 Push $0
221 Push "GPLPV"
222 Call StrContains
223 Pop $0
224 StrCmp $0 "" no_GPLPV
226 ReadRegStr $0 HKLM SYSTEM\CurrentControlSet\Services\XenHide DisplayName
227 StrCmp $0 "" 0 no_GPLPV
229 MessageBox MB_OK "Warning - GPLPV specified on boot but drivers not installed yet. You should cancel now and boot without GPLPV"
230 no_GPLPV:
232 Call GetWindowsVersion
233 Pop $R0
235 StrCmp $R0 "2000" 0 check_XP
236 StrCpy $arch "win2k"
237 Goto version_done
238 check_XP:
239 StrCmp $R0 "XP" 0 check_2k3
240 StrCpy $arch "winxp"
241 Goto version_done
242 check_2k3:
243 StrCmp $R0 "2003" 0 check_2k8
244 ReadRegStr $0 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" PROCESSOR_ARCHITECTURE
245 StrCmp $0 "AMD64" version_2k3x64
246 StrCpy $arch "win2k3x32"
247 Goto version_done
248 version_2k3x64:
249 StrCpy $arch "win2k3x64"
250 Goto version_done
251 check_2k8:
252 StrCmp $R0 "Vista" 0 version_error
253 ReadRegStr $0 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" PROCESSOR_ARCHITECTURE
254 StrCmp $0 "AMD64" version_2k8x64
255 StrCpy $arch "win2k8x32"
256 Goto version_done
257 version_2k8x64:
258 StrCpy $arch "win2k8x64"
259 Goto version_done
260 version_error:
261 MessageBox MB_OK "Unable to detect windows version - proceed with caution"
262 StrCpy $arch ""
264 version_done:
265 Call SelectSection
267 # SectionGetFlags ${sec1} $0
268 # IntOp $0 $0 | ${SF_SELECTED}
269 # SectionSetFlags ${sec1} $0
271 Pop $0
272 FunctionEnd
274 Var NewArch
276 Function .onSelChange
277 Push $0
279 StrCpy $newarch $arch
280 StrCmp $arch "win2k" check_xp
281 SectionGetFlags ${win2k} $0
282 IntOp $0 $0 & ${SF_SELECTED}
283 IntCmp $0 ${SF_SELECTED} 0 check_xp check_xp
284 StrCpy $newarch "win2k"
285 check_xp:
286 StrCmp $arch "winxp" check_2k3x32
287 SectionGetFlags ${winxp} $0
288 IntOp $0 $0 & ${SF_SELECTED}
289 IntCmp $0 ${SF_SELECTED} 0 check_2k3x32 check_2k3x32
290 StrCpy $newarch "winxp"
291 check_2k3x32:
292 StrCmp $arch "win2k3x32" check_2k3x64
293 SectionGetFlags ${win2k3x32} $0
294 IntOp $0 $0 & ${SF_SELECTED}
295 IntCmp $0 ${SF_SELECTED} 0 check_2k3x64 check_2k3x64
296 StrCpy $newarch "win2k3x32"
297 check_2k3x64:
298 StrCmp $arch "win2k3x64" check_2k8x32
299 SectionGetFlags ${win2k3x64} $0
300 IntOp $0 $0 & ${SF_SELECTED}
301 IntCmp $0 ${SF_SELECTED} 0 check_2k8x32 check_2k8x32
302 StrCpy $newarch "win2k3x64"
303 check_2k8x32:
304 StrCmp $arch "win2k8x32" check_2k8x64
305 SectionGetFlags ${win2k8x32} $0
306 IntOp $0 $0 & ${SF_SELECTED}
307 IntCmp $0 ${SF_SELECTED} 0 check_2k8x64 check_2k8x64
308 StrCpy $newarch "win2k8x32"
309 check_2k8x64:
310 StrCmp $arch "win2k8x64" done
311 SectionGetFlags ${win2k8x64} $0
312 IntOp $0 $0 & ${SF_SELECTED}
313 IntCmp $0 ${SF_SELECTED} 0 done done
314 StrCpy $newarch "win2k8x64"
315 done:
316 StrCpy $arch $newarch
317 Call SelectSection
319 Pop $0
320 FunctionEnd
322 Function SelectSection
323 Push $0
325 StrCmp $arch "win2k" set_win2k
326 SectionGetFlags ${win2k} $0
327 IntOp $0 $0 & ${SECTION_OFF}
328 SectionSetFlags ${win2k} $0
329 goto check_xp
330 set_win2k:
331 SectionGetFlags ${win2k} $0
332 IntOp $0 $0 | ${SF_SELECTED}
333 SectionSetFlags ${win2k} $0
334 check_xp:
335 StrCmp $arch "winxp" set_winxp
336 SectionGetFlags ${winxp} $0
337 IntOp $0 $0 & ${SECTION_OFF}
338 SectionSetFlags ${winxp} $0
339 goto check_2k3x32
340 set_winxp:
341 SectionGetFlags ${winxp} $0
342 IntOp $0 $0 | ${SF_SELECTED}
343 SectionSetFlags ${winxp} $0
344 check_2k3x32:
345 StrCmp $arch "win2k3x32" set_2k3x32
346 SectionGetFlags ${win2k3x32} $0
347 IntOp $0 $0 & ${SECTION_OFF}
348 SectionSetFlags ${win2k3x32} $0
349 goto check_2k3x64
350 set_2k3x32:
351 SectionGetFlags ${win2k3x32} $0
352 IntOp $0 $0 | ${SF_SELECTED}
353 SectionSetFlags ${win2k3x32} $0
354 check_2k3x64:
355 StrCmp $arch "win2k3x64" set_2k3x64
356 SectionGetFlags ${win2k3x64} $0
357 IntOp $0 $0 & ${SECTION_OFF}
358 SectionSetFlags ${win2k3x64} $0
359 goto check_2k8x32
360 set_2k3x64:
361 SectionGetFlags ${win2k3x64} $0
362 IntOp $0 $0 | ${SF_SELECTED}
363 SectionSetFlags ${win2k3x64} $0
364 check_2k8x32:
365 StrCmp $arch "win2k8x32" set_2k8x32
366 SectionGetFlags ${win2k8x32} $0
367 IntOp $0 $0 & ${SECTION_OFF}
368 SectionSetFlags ${win2k8x32} $0
369 goto check_2k8x64
370 set_2k8x32:
371 SectionGetFlags ${win2k8x32} $0
372 IntOp $0 $0 | ${SF_SELECTED}
373 SectionSetFlags ${win2k8x32} $0
374 check_2k8x64:
375 StrCmp $arch "win2k8x64" set_2k8x64
376 SectionGetFlags ${win2k8x64} $0
377 IntOp $0 $0 & ${SECTION_OFF}
378 SectionSetFlags ${win2k8x64} $0
379 goto done
380 set_2k8x64:
381 SectionGetFlags ${win2k8x64} $0
382 IntOp $0 $0 | ${SF_SELECTED}
383 SectionSetFlags ${win2k8x64} $0
384 done:
385 Pop $0
387 FunctionEnd
389 Section "Uninstall"
390 Delete "${StartMenu}\Uninstall.lnk"
391 RMDir "${StartMenu}\"
392 Delete $INSTDIR\uninstall.exe
393 RMDir $INSTDIR
394 SectionEnd
396 Var STR_HAYSTACK
397 Var STR_NEEDLE
398 Var STR_CONTAINS_VAR_1
399 Var STR_CONTAINS_VAR_2
400 Var STR_CONTAINS_VAR_3
401 Var STR_CONTAINS_VAR_4
402 Var STR_RETURN_VAR
404 Function StrContains
405 Exch $STR_NEEDLE
406 Exch 1
407 Exch $STR_HAYSTACK
408 ; Uncomment to debug
409 ;MessageBox MB_OK 'STR_NEEDLE = $STR_NEEDLE STR_HAYSTACK = $STR_HAYSTACK '
410 StrCpy $STR_RETURN_VAR ""
411 StrCpy $STR_CONTAINS_VAR_1 -1
412 StrLen $STR_CONTAINS_VAR_2 $STR_NEEDLE
413 StrLen $STR_CONTAINS_VAR_4 $STR_HAYSTACK
414 loop:
415 IntOp $STR_CONTAINS_VAR_1 $STR_CONTAINS_VAR_1 + 1
416 StrCpy $STR_CONTAINS_VAR_3 $STR_HAYSTACK $STR_CONTAINS_VAR_2 $STR_CONTAINS_VAR_1
417 StrCmp $STR_CONTAINS_VAR_3 $STR_NEEDLE found
418 StrCmp $STR_CONTAINS_VAR_1 $STR_CONTAINS_VAR_4 done
419 Goto loop
420 found:
421 StrCpy $STR_RETURN_VAR $STR_NEEDLE
422 Goto done
423 done:
424 Pop $STR_NEEDLE ;Prevent "invalid opcode" errors and keep the
425 Exch $STR_RETURN_VAR
426 FunctionEnd