win-pvdrivers

view installer.nsi @ 427:599061042271

updates to add copyconfig to the installer
author James Harper <james.harper@bendigoit.com.au>
date Mon Sep 08 22:10:30 2008 +1000 (2008-09-08)
parents ea14db3ca6f2
children c3fd610dc60c
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 File .\target\i386\copyconfig.exe
77 SetOutPath $INSTDIR\drivers
78 File .\target\winxp\xenpci.inf
79 File .\target\winxp\xennet.inf
80 File .\target\winxp\xenvbd.inf
81 File .\target\winxp\xenscsi.inf
82 File .\target\winxp\xenstub.inf
83 File /nonfatal .\target\winxp\xengplpv.cat
84 SetOutPath $INSTDIR\drivers\i386
85 File .\target\winxp\i386\xenpci.sys
86 File .\target\winxp\i386\xenhide.sys
87 File .\target\winxp\i386\xennet.sys
88 File .\target\winxp\i386\xenvbd.sys
89 File .\target\winxp\i386\xenscsi.sys
90 File .\target\winxp\i386\xenstub.sys
91 File .\target\winxp\i386\xenconfig.sys
92 SectionEnd
94 Section "Windows 2003 x32" win2k3x32
95 SetOutPath $INSTDIR
96 File /nonfatal .\ca.cer
97 File .\target\i386\copyconfig.exe
98 SetOutPath $INSTDIR\drivers
99 File .\target\winnet\xenpci.inf
100 File .\target\winnet\xennet.inf
101 File .\target\winnet\xenvbd.inf
102 File .\target\winnet\xenscsi.inf
103 File .\target\winnet\xenstub.inf
104 File /nonfatal .\target\winnet\xengplpv.cat
105 SetOutPath $INSTDIR\drivers\i386
106 File .\target\winnet\i386\xenpci.sys
107 File .\target\winnet\i386\xenhide.sys
108 File .\target\winnet\i386\xennet.sys
109 File .\target\winnet\i386\xenvbd.sys
110 File .\target\winnet\i386\xenscsi.sys
111 File .\target\winnet\i386\xenstub.sys
112 File .\target\winnet\i386\xenconfig.sys
113 SectionEnd
115 Section "Windows 2003 x64" win2k3x64
116 SetOutPath $INSTDIR
117 File /nonfatal .\ca.cer
118 File .\target\i386\copyconfig.exe
119 SetOutPath $INSTDIR\drivers
120 File .\target\winnet\xenpci.inf
121 File .\target\winnet\xennet.inf
122 File .\target\winnet\xenvbd.inf
123 File .\target\winnet\xenscsi.inf
124 File .\target\winnet\xenstub.inf
125 File /nonfatal .\target\winnet\xengplpv.cat
126 SetOutPath $INSTDIR\drivers\amd64
127 File .\target\winnet\amd64\xenpci.sys
128 File .\target\winnet\amd64\xenhide.sys
129 File .\target\winnet\amd64\xennet.sys
130 File .\target\winnet\amd64\xenvbd.sys
131 File .\target\winnet\amd64\xenscsi.sys
132 File .\target\winnet\amd64\xenstub.sys
133 File .\target\winnet\amd64\xenconfig.sys
134 SectionEnd
136 Section "Windows 2008 x32" win2k8x32
137 SetOutPath $INSTDIR
138 File /nonfatal .\ca.cer
139 File .\target\i386\copyconfig.exe
140 SetOutPath $INSTDIR\drivers
141 File .\target\winlh\xenpci.inf
142 File .\target\winlh\xennet.inf
143 File .\target\winlh\xenvbd.inf
144 File .\target\winlh\xenscsi.inf
145 File .\target\winlh\xenstub.inf
146 File /nonfatal .\target\winlh\xengplpv.cat
147 SetOutPath $INSTDIR\drivers\i386
148 File .\target\winlh\i386\xenpci.sys
149 File .\target\winlh\i386\xenhide.sys
150 File .\target\winlh\i386\xennet.sys
151 File .\target\winlh\i386\xenvbd.sys
152 File .\target\winlh\i386\xenscsi.sys
153 File .\target\winlh\i386\xenstub.sys
154 File .\target\winlh\i386\xenconfig.sys
155 SectionEnd
157 Section "Windows 2008 x64" win2k8x64
158 SetOutPath $INSTDIR
159 File /nonfatal .\ca.cer
160 File .\target\i386\copyconfig.exe
161 SetOutPath $INSTDIR\drivers
162 File .\target\winlh\xenpci.inf
163 File .\target\winlh\xennet.inf
164 File .\target\winlh\xenvbd.inf
165 File .\target\winlh\xenscsi.inf
166 File .\target\winlh\xenstub.inf
167 File /nonfatal .\target\winlh\xengplpv.cat
168 SetOutPath $INSTDIR\drivers\amd64
169 File .\target\winlh\amd64\xenpci.sys
170 File .\target\winlh\amd64\xenhide.sys
171 File .\target\winlh\amd64\xennet.sys
172 File .\target\winlh\amd64\xenvbd.sys
173 File .\target\winlh\amd64\xenscsi.sys
174 File .\target\winlh\amd64\xenstub.sys
175 File .\target\winlh\amd64\xenconfig.sys
176 SectionEnd
178 Section /o "Install Cert" installcert
179 ExecWait 'rundll32.exe cryptext.dll,CryptExtAddCER $INSTDIR\ca.cer'
180 SectionEnd
182 Section "Install Drivers" installdrivers
183 Push "$INSTDIR\drivers"
184 Push "$INSTDIR\drivers\xennet.inf"
185 Push "XEN\VIF"
186 Call InstallUpgradeDriver
188 Push "$INSTDIR\drivers"
189 Push "$INSTDIR\drivers\xenvbd.inf"
190 Push "XEN\VBD"
191 Call InstallUpgradeDriver
193 Push "$INSTDIR\drivers"
194 Push "$INSTDIR\drivers\xenscsi.inf"
195 Push "XEN\VSCSI"
196 Call InstallUpgradeDriver
198 Push "$INSTDIR\drivers"
199 Push "$INSTDIR\drivers\xenstub.inf"
200 Push "XEN\CONSOLE"
201 Call InstallUpgradeDriver
203 Push "$INSTDIR\drivers"
204 Push "$INSTDIR\drivers\xenstub.inf"
205 Push "XEN\VFB"
206 Call InstallUpgradeDriver
208 Push "$INSTDIR\drivers"
209 Push "$INSTDIR\drivers\xenstub.inf"
210 Push "XEN\VKBD"
211 Call InstallUpgradeDriver
213 Push "$INSTDIR\drivers"
214 Push "$INSTDIR\drivers\xenpci.inf"
215 Push "PCI\VEN_5853&DEV_0001"
216 Call InstallUpgradeDriver
217 SectionEnd
219 Section "Copy Network Config" copynetworkconfig
220 MessageBox MB_OKCANCEL "This will copy the network IP configuration from the qemu network adapter to the gplpv xennet network adapter. Ensure that all the drivers are loaded for all the network adapters before clicking OK" IDCANCEL done
221 ExecWait '"$INSTDIR\copyconfig.exe"'
222 done:
223 SectionEnd
225 Var arch
227 Function .onInit
228 Push $0
230 ReadRegStr $0 HKLM SYSTEM\CurrentControlSet\Control SystemStartOptions
231 Push $0
232 Push "GPLPV"
233 Call StrContains
234 Pop $0
235 StrCmp $0 "" no_GPLPV
237 ReadRegStr $0 HKLM SYSTEM\CurrentControlSet\Services\XenHide DisplayName
238 StrCmp $0 "" 0 no_GPLPV
240 MessageBox MB_OK "Warning - GPLPV specified on boot but drivers not installed yet. You should cancel now and boot without GPLPV"
241 no_GPLPV:
243 Call GetWindowsVersion
244 Pop $R0
246 StrCmp $R0 "2000" 0 check_XP
247 StrCpy $arch "win2k"
248 Goto version_done
249 check_XP:
250 StrCmp $R0 "XP" 0 check_2k3
251 StrCpy $arch "winxp"
252 Goto version_done
253 check_2k3:
254 StrCmp $R0 "2003" 0 check_2k8
255 ReadRegStr $0 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" PROCESSOR_ARCHITECTURE
256 StrCmp $0 "AMD64" version_2k3x64
257 StrCpy $arch "win2k3x32"
258 Goto version_done
259 version_2k3x64:
260 StrCpy $arch "win2k3x64"
261 Goto version_done
262 check_2k8:
263 StrCmp $R0 "Vista" 0 version_error
264 ReadRegStr $0 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" PROCESSOR_ARCHITECTURE
265 StrCmp $0 "AMD64" version_2k8x64
266 StrCpy $arch "win2k8x32"
267 Goto version_done
268 version_2k8x64:
269 StrCpy $arch "win2k8x64"
270 Goto version_done
271 version_error:
272 MessageBox MB_OK "Unable to detect windows version - proceed with caution"
273 StrCpy $arch ""
275 version_done:
276 Call SelectSection
278 # SectionGetFlags ${sec1} $0
279 # IntOp $0 $0 | ${SF_SELECTED}
280 # SectionSetFlags ${sec1} $0
282 Pop $0
283 FunctionEnd
285 Var NewArch
287 Function .onSelChange
288 Push $0
290 StrCpy $newarch $arch
291 StrCmp $arch "win2k" check_xp
292 SectionGetFlags ${win2k} $0
293 IntOp $0 $0 & ${SF_SELECTED}
294 IntCmp $0 ${SF_SELECTED} 0 check_xp check_xp
295 StrCpy $newarch "win2k"
296 check_xp:
297 StrCmp $arch "winxp" check_2k3x32
298 SectionGetFlags ${winxp} $0
299 IntOp $0 $0 & ${SF_SELECTED}
300 IntCmp $0 ${SF_SELECTED} 0 check_2k3x32 check_2k3x32
301 StrCpy $newarch "winxp"
302 check_2k3x32:
303 StrCmp $arch "win2k3x32" check_2k3x64
304 SectionGetFlags ${win2k3x32} $0
305 IntOp $0 $0 & ${SF_SELECTED}
306 IntCmp $0 ${SF_SELECTED} 0 check_2k3x64 check_2k3x64
307 StrCpy $newarch "win2k3x32"
308 check_2k3x64:
309 StrCmp $arch "win2k3x64" check_2k8x32
310 SectionGetFlags ${win2k3x64} $0
311 IntOp $0 $0 & ${SF_SELECTED}
312 IntCmp $0 ${SF_SELECTED} 0 check_2k8x32 check_2k8x32
313 StrCpy $newarch "win2k3x64"
314 check_2k8x32:
315 StrCmp $arch "win2k8x32" check_2k8x64
316 SectionGetFlags ${win2k8x32} $0
317 IntOp $0 $0 & ${SF_SELECTED}
318 IntCmp $0 ${SF_SELECTED} 0 check_2k8x64 check_2k8x64
319 StrCpy $newarch "win2k8x32"
320 check_2k8x64:
321 StrCmp $arch "win2k8x64" done
322 SectionGetFlags ${win2k8x64} $0
323 IntOp $0 $0 & ${SF_SELECTED}
324 IntCmp $0 ${SF_SELECTED} 0 done done
325 StrCpy $newarch "win2k8x64"
326 done:
327 StrCpy $arch $newarch
328 Call SelectSection
330 Pop $0
331 FunctionEnd
333 Function SelectSection
334 Push $0
336 StrCmp $arch "win2k" set_win2k
337 SectionGetFlags ${win2k} $0
338 IntOp $0 $0 & ${SECTION_OFF}
339 SectionSetFlags ${win2k} $0
340 goto check_xp
341 set_win2k:
342 SectionGetFlags ${win2k} $0
343 IntOp $0 $0 | ${SF_SELECTED}
344 SectionSetFlags ${win2k} $0
345 check_xp:
346 StrCmp $arch "winxp" set_winxp
347 SectionGetFlags ${winxp} $0
348 IntOp $0 $0 & ${SECTION_OFF}
349 SectionSetFlags ${winxp} $0
350 goto check_2k3x32
351 set_winxp:
352 SectionGetFlags ${winxp} $0
353 IntOp $0 $0 | ${SF_SELECTED}
354 SectionSetFlags ${winxp} $0
355 check_2k3x32:
356 StrCmp $arch "win2k3x32" set_2k3x32
357 SectionGetFlags ${win2k3x32} $0
358 IntOp $0 $0 & ${SECTION_OFF}
359 SectionSetFlags ${win2k3x32} $0
360 goto check_2k3x64
361 set_2k3x32:
362 SectionGetFlags ${win2k3x32} $0
363 IntOp $0 $0 | ${SF_SELECTED}
364 SectionSetFlags ${win2k3x32} $0
365 check_2k3x64:
366 StrCmp $arch "win2k3x64" set_2k3x64
367 SectionGetFlags ${win2k3x64} $0
368 IntOp $0 $0 & ${SECTION_OFF}
369 SectionSetFlags ${win2k3x64} $0
370 goto check_2k8x32
371 set_2k3x64:
372 SectionGetFlags ${win2k3x64} $0
373 IntOp $0 $0 | ${SF_SELECTED}
374 SectionSetFlags ${win2k3x64} $0
375 check_2k8x32:
376 StrCmp $arch "win2k8x32" set_2k8x32
377 SectionGetFlags ${win2k8x32} $0
378 IntOp $0 $0 & ${SECTION_OFF}
379 SectionSetFlags ${win2k8x32} $0
380 goto check_2k8x64
381 set_2k8x32:
382 SectionGetFlags ${win2k8x32} $0
383 IntOp $0 $0 | ${SF_SELECTED}
384 SectionSetFlags ${win2k8x32} $0
385 check_2k8x64:
386 StrCmp $arch "win2k8x64" set_2k8x64
387 SectionGetFlags ${win2k8x64} $0
388 IntOp $0 $0 & ${SECTION_OFF}
389 SectionSetFlags ${win2k8x64} $0
390 goto done
391 set_2k8x64:
392 SectionGetFlags ${win2k8x64} $0
393 IntOp $0 $0 | ${SF_SELECTED}
394 SectionSetFlags ${win2k8x64} $0
395 done:
396 Pop $0
398 FunctionEnd
400 Section "Uninstall"
401 Delete "${StartMenu}\Uninstall.lnk"
402 RMDir "${StartMenu}\"
403 Delete $INSTDIR\uninstall.exe
404 RMDir $INSTDIR
405 SectionEnd
407 Var STR_HAYSTACK
408 Var STR_NEEDLE
409 Var STR_CONTAINS_VAR_1
410 Var STR_CONTAINS_VAR_2
411 Var STR_CONTAINS_VAR_3
412 Var STR_CONTAINS_VAR_4
413 Var STR_RETURN_VAR
415 Function StrContains
416 Exch $STR_NEEDLE
417 Exch 1
418 Exch $STR_HAYSTACK
419 ; Uncomment to debug
420 ;MessageBox MB_OK 'STR_NEEDLE = $STR_NEEDLE STR_HAYSTACK = $STR_HAYSTACK '
421 StrCpy $STR_RETURN_VAR ""
422 StrCpy $STR_CONTAINS_VAR_1 -1
423 StrLen $STR_CONTAINS_VAR_2 $STR_NEEDLE
424 StrLen $STR_CONTAINS_VAR_4 $STR_HAYSTACK
425 loop:
426 IntOp $STR_CONTAINS_VAR_1 $STR_CONTAINS_VAR_1 + 1
427 StrCpy $STR_CONTAINS_VAR_3 $STR_HAYSTACK $STR_CONTAINS_VAR_2 $STR_CONTAINS_VAR_1
428 StrCmp $STR_CONTAINS_VAR_3 $STR_NEEDLE found
429 StrCmp $STR_CONTAINS_VAR_1 $STR_CONTAINS_VAR_4 done
430 Goto loop
431 found:
432 StrCpy $STR_RETURN_VAR $STR_NEEDLE
433 Goto done
434 done:
435 Pop $STR_NEEDLE ;Prevent "invalid opcode" errors and keep the
436 Exch $STR_RETURN_VAR
437 FunctionEnd