win-pvdrivers

view installer.nsi @ 310:60372bd2582d

First cut of putting xenbus config details in the .inf file - xenvbd may yet pass WHQL
author James Harper <james.harper@bendigoit.com.au>
date Fri Jun 13 14:16:50 2008 +1000 (2008-06-13)
parents 279f5623f6c7
children c25d8b936290
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 File .\target\winlh\amd64\xenconfig.sys
147 SectionEnd
149 Section "Install Drivers" installdrivers
150 Push "$INSTDIR\drivers"
151 Push "$INSTDIR\drivers\xenpci.inf"
152 Push "PCI\VEN_5853&DEV_0001"
153 Call InstallUpgradeDriver
155 Push "$INSTDIR\drivers"
156 Push "$INSTDIR\drivers\xennet.inf"
157 Push "XEN\VIF"
158 Call InstallUpgradeDriver
160 Push "$INSTDIR\drivers"
161 Push "$INSTDIR\drivers\xenvbd.inf"
162 Push "XEN\VBD"
163 Call InstallUpgradeDriver
165 Push "$INSTDIR\drivers"
166 Push "$INSTDIR\drivers\xenscsi.inf"
167 Push "XEN\VSCSI"
168 Call InstallUpgradeDriver
170 Push "$INSTDIR\drivers"
171 Push "$INSTDIR\drivers\xenstub.inf"
172 Push "XEN\CONSOLE"
173 Call InstallUpgradeDriver
175 Push "$INSTDIR\drivers"
176 Push "$INSTDIR\drivers\xenstub.inf"
177 Push "XEN\VFB"
178 Call InstallUpgradeDriver
180 Push "$INSTDIR\drivers"
181 Push "$INSTDIR\drivers\xenstub.inf"
182 Push "XEN\VKBD"
183 Call InstallUpgradeDriver
184 SectionEnd
186 Var arch
188 Function .onInit
189 Push $0
191 ReadRegStr $0 HKLM SYSTEM\CurrentControlSet\Control SystemStartOptions
192 Push $0
193 Push "GPLPV"
194 Call StrContains
195 Pop $0
196 StrCmp $0 "" no_GPLPV
197 MessageBox MB_OK "Warning - GPLPV specified on boot. Upgrade may work but install may break things"
198 no_GPLPV:
200 Call GetWindowsVersion
201 Pop $R0
203 StrCmp $R0 "2000" 0 check_XP
204 StrCpy $arch "win2k"
205 Goto version_done
206 check_XP:
207 StrCmp $R0 "XP" 0 check_2k3
208 StrCpy $arch "winxp"
209 Goto version_done
210 check_2k3:
211 StrCmp $R0 "2003" 0 check_2k8
212 ReadRegStr $0 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" PROCESSOR_ARCHITECTURE
213 StrCmp $0 "AMD64" version_2k3x64
214 StrCpy $arch "win2k3x32"
215 Goto version_done
216 version_2k3x64:
217 StrCpy $arch "win2k3x64"
218 Goto version_done
219 check_2k8:
220 StrCmp $R0 "Vista" 0 version_error
221 ReadRegStr $0 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" PROCESSOR_ARCHITECTURE
222 StrCmp $0 "AMD64" version_2k8x64
223 StrCpy $arch "win2k8x32"
224 Goto version_done
225 version_2k8x64:
226 StrCpy $arch "win2k8x64"
227 Goto version_done
228 version_error:
229 MessageBox MB_OK "Unable to detect windows version - proceed with caution"
230 StrCpy $arch ""
232 version_done:
233 Call SelectSection
235 # SectionGetFlags ${sec1} $0
236 # IntOp $0 $0 | ${SF_SELECTED}
237 # SectionSetFlags ${sec1} $0
239 Pop $0
240 FunctionEnd
242 Var NewArch
244 Function .onSelChange
245 Push $0
247 StrCmp $arch "win2k" check_xp
248 SectionGetFlags ${win2k} $0
249 IntOp $0 $0 & ${SF_SELECTED}
250 IntCmp $0 ${SF_SELECTED} 0 check_xp check_xp
251 StrCpy $newarch "win2k"
252 check_xp:
253 StrCmp $arch "winxp" check_2k3x32
254 SectionGetFlags ${winxp} $0
255 IntOp $0 $0 & ${SF_SELECTED}
256 IntCmp $0 ${SF_SELECTED} 0 check_2k3x32 check_2k3x32
257 StrCpy $newarch "winxp"
258 check_2k3x32:
259 StrCmp $arch "win2k3x32" check_2k3x64
260 SectionGetFlags ${win2k3x32} $0
261 IntOp $0 $0 & ${SF_SELECTED}
262 IntCmp $0 ${SF_SELECTED} 0 check_2k3x64 check_2k3x64
263 StrCpy $newarch "win2k3x32"
264 check_2k3x64:
265 StrCmp $arch "win2k3x64" check_2k8x32
266 SectionGetFlags ${win2k3x64} $0
267 IntOp $0 $0 & ${SF_SELECTED}
268 IntCmp $0 ${SF_SELECTED} 0 check_2k8x32 check_2k8x32
269 StrCpy $newarch "win2k3x64"
270 check_2k8x32:
271 StrCmp $arch "win2k8x32" check_2k8x64
272 SectionGetFlags ${win2k8x32} $0
273 IntOp $0 $0 & ${SF_SELECTED}
274 IntCmp $0 ${SF_SELECTED} 0 check_2k8x64 check_2k8x64
275 StrCpy $newarch "win2k8x32"
276 check_2k8x64:
277 StrCmp $arch "win2k8x64" done
278 SectionGetFlags ${win2k8x64} $0
279 IntOp $0 $0 & ${SF_SELECTED}
280 IntCmp $0 ${SF_SELECTED} 0 done done
281 StrCpy $newarch "win2k8x64"
282 done:
283 StrCpy $arch $newarch
284 Call SelectSection
286 Pop $0
287 FunctionEnd
289 Function SelectSection
290 Push $0
292 StrCmp $arch "win2k" check_xp
293 SectionGetFlags ${win2k} $0
294 IntOp $0 $0 & ${SECTION_OFF}
295 SectionSetFlags ${win2k} $0
296 check_xp:
297 StrCmp $arch "winxp" check_2k3x32
298 SectionGetFlags ${winxp} $0
299 IntOp $0 $0 & ${SECTION_OFF}
300 SectionSetFlags ${winxp} $0
301 check_2k3x32:
302 StrCmp $arch "win2k3x32" check_2k3x64
303 SectionGetFlags ${win2k3x32} $0
304 IntOp $0 $0 & ${SECTION_OFF}
305 SectionSetFlags ${win2k3x32} $0
306 check_2k3x64:
307 StrCmp $arch "win2k3x64" check_2k8x32
308 SectionGetFlags ${win2k3x64} $0
309 IntOp $0 $0 & ${SECTION_OFF}
310 SectionSetFlags ${win2k3x64} $0
311 check_2k8x32:
312 StrCmp $arch "win2k8x32" check_2k8x64
313 SectionGetFlags ${win2k8x32} $0
314 IntOp $0 $0 & ${SECTION_OFF}
315 SectionSetFlags ${win2k8x32} $0
316 check_2k8x64:
317 StrCmp $arch "win2k8x64" done
318 SectionGetFlags ${win2k8x64} $0
319 IntOp $0 $0 & ${SECTION_OFF}
320 SectionSetFlags ${win2k8x64} $0
321 done:
322 Pop $0
324 FunctionEnd
326 Section "Uninstall"
327 Delete "${StartMenu}\Uninstall.lnk"
328 RMDir "${StartMenu}\"
329 Delete $INSTDIR\uninstall.exe
330 RMDir $INSTDIR
331 SectionEnd
333 Var STR_HAYSTACK
334 Var STR_NEEDLE
335 Var STR_CONTAINS_VAR_1
336 Var STR_CONTAINS_VAR_2
337 Var STR_CONTAINS_VAR_3
338 Var STR_CONTAINS_VAR_4
339 Var STR_RETURN_VAR
341 Function StrContains
342 Exch $STR_NEEDLE
343 Exch 1
344 Exch $STR_HAYSTACK
345 ; Uncomment to debug
346 ;MessageBox MB_OK 'STR_NEEDLE = $STR_NEEDLE STR_HAYSTACK = $STR_HAYSTACK '
347 StrCpy $STR_RETURN_VAR ""
348 StrCpy $STR_CONTAINS_VAR_1 -1
349 StrLen $STR_CONTAINS_VAR_2 $STR_NEEDLE
350 StrLen $STR_CONTAINS_VAR_4 $STR_HAYSTACK
351 loop:
352 IntOp $STR_CONTAINS_VAR_1 $STR_CONTAINS_VAR_1 + 1
353 StrCpy $STR_CONTAINS_VAR_3 $STR_HAYSTACK $STR_CONTAINS_VAR_2 $STR_CONTAINS_VAR_1
354 StrCmp $STR_CONTAINS_VAR_3 $STR_NEEDLE found
355 StrCmp $STR_CONTAINS_VAR_1 $STR_CONTAINS_VAR_4 done
356 Goto loop
357 found:
358 StrCpy $STR_RETURN_VAR $STR_NEEDLE
359 Goto done
360 done:
361 Pop $STR_NEEDLE ;Prevent "invalid opcode" errors and keep the
362 Exch $STR_RETURN_VAR
363 FunctionEnd