VirtualBox

source: vbox/trunk/src/VBox/Installer/win/Scripts/PackDriversForSubmission.cmd@ 71980

Last change on this file since 71980 was 71980, checked in by vboxsync, 7 years ago

Installer/win: Submission packing fixes. bugref:8691

  • Property svn:eol-style set to CRLF
  • Property svn:keywords set to Author Date Id Revision
File size: 11.4 KB
Line 
1@echo off
2rem $Id: PackDriversForSubmission.cmd 71980 2018-04-23 11:57:16Z vboxsync $
3rem rem @file
4rem Windows NT batch script for preparing for signing submission.
5rem
6
7rem
8rem Copyright (C) 2018 Oracle Corporation
9rem
10rem This file is part of VirtualBox Open Source Edition (OSE), as
11rem available from http://www.virtualbox.org. This file is free software;
12rem you can redistribute it and/or modify it under the terms of the GNU
13rem General Public License (GPL) as published by the Free Software
14rem Foundation, in version 2 as it comes in the "COPYING" file of the
15rem VirtualBox OSE distribution. VirtualBox OSE is distributed in the
16rem hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
17rem
18
19
20setlocal ENABLEEXTENSIONS
21setlocal
22
23rem
24rem Parse arguments.
25rem
26set _MY_OPT_BINDIR=..\bin
27set _MY_OPT_PDBDIR=
28set _MY_OPT_WITH_PDB=1
29set _MY_OPT_EXTPACK=
30set _MY_OPT_WITH_EXTPACK=1
31set _MY_OPT_OUTPUT=
32set _MY_OPT_DDF_FILE=
33set _MY_OPT_ARCH=
34
35:argument_loop
36if ".%1" == "." goto no_more_arguments
37
38if ".%1" == ".-h" goto opt_h
39if ".%1" == ".-?" goto opt_h
40if ".%1" == "./h" goto opt_h
41if ".%1" == "./H" goto opt_h
42if ".%1" == "./?" goto opt_h
43if ".%1" == ".-help" goto opt_h
44if ".%1" == ".--help" goto opt_h
45
46if ".%1" == ".-a" goto opt_a
47if ".%1" == ".--arch" goto opt_a
48if ".%1" == ".-b" goto opt_b
49if ".%1" == ".--bindir" goto opt_b
50if ".%1" == ".-d" goto opt_d
51if ".%1" == ".--ddf" goto opt_d
52if ".%1" == ".-e" goto opt_e
53if ".%1" == ".--extpack" goto opt_e
54if ".%1" == ".-n" goto opt_n
55if ".%1" == ".--no-pdb" goto opt_n
56if ".%1" == ".-o" goto opt_o
57if ".%1" == ".--output" goto opt_o
58if ".%1" == ".-p" goto opt_p
59if ".%1" == ".--pdb" goto opt_p
60if ".%1" == ".-x" goto opt_x
61if ".%1" == ".--no-extpack" goto opt_x
62echo syntax error: Unknown option: %1
63echo Try --help to list valid options.
64goto end_failed
65
66:argument_loop_next_with_value
67shift
68shift
69goto argument_loop
70
71:opt_a
72if ".%2" == "." goto syntax_error_missing_value
73if not "%2" == "x86" if not "%2" == "amd64" goto syntax_error_unknown_arch
74set _MY_OPT_ARCH=%2
75goto argument_loop_next_with_value
76
77:opt_b
78if ".%2" == "." goto syntax_error_missing_value
79set _MY_OPT_BINDIR=%2
80goto argument_loop_next_with_value
81
82:opt_d
83if ".%2" == "." goto syntax_error_missing_value
84set _MY_OPT_DDF_FILE=%2
85goto argument_loop_next_with_value
86
87:opt_e
88if ".%2" == "." goto syntax_error_missing_value
89set _MY_OPT_EXTPACK=%2
90goto argument_loop_next_with_value
91
92:opt_h
93echo This script creates a .cab file containing all drivers needing blessing from
94echo Microsoft to run on recent Windows 10 installations.
95echo .
96echo Usage: PackDriversForSubmission.cmd [-b bindir] [-p pdbdir] [-n/--no-pdb]
97echo [-e expack] [-x/--no-extpack] [-o output.cab] [-p output.ddf] [-a x86/amd64]
98echo .
99echo Warning! This script should normally be invoked from the repack directory w/o any parameters.
100goto end_failed
101
102:opt_n
103set _MY_OPT_WITH_PDB=0
104shift
105goto argument_loop
106
107:opt_p
108if ".%2" == "." goto syntax_error_missing_value
109set _MY_OPT_PDBDIR=%2
110goto argument_loop_next_with_value
111
112:opt_o
113if ".%2" == "." goto syntax_error_missing_value
114set _MY_OPT_OUTPUT=%2
115goto argument_loop_next_with_value
116
117:opt_x
118set _MY_OPT_WITH_EXTPACK=0
119shift
120goto argument_loop
121
122:syntax_error_missing_value
123echo syntax error: missing or empty option value after %1
124goto end_failed
125
126:syntax_error_unknown_arch
127echo syntax error: Unknown architecture: %2
128goto end_failed
129
130:error_bindir_does_not_exist
131echo syntax error: Specified BIN directory does not exist: "%_MY_OPT_BINDIR%"
132goto end_failed
133
134:error_pdbdir_does_not_exist
135echo syntax error: Specified PDB directory does not exist: "%_MY_OPT_PDBDIR%"
136goto end_failed
137
138:error_extpack_does_not_exist
139echo syntax error: Specified extension pack does not exist: "%_MY_OPT_EXTPACK%"
140goto end_failed
141
142:error_output_exists
143echo error: The output file already exist: "%_MY_OPT_OUTPUT%"
144goto end_failed
145
146:error_ddf_exists
147echo error: The DDF file already exist: "%_MY_OPT_DDF_FILE%"
148goto end_failed
149
150:no_more_arguments
151rem validate specified options
152if not exist "%_MY_OPT_BINDIR%" goto error_bindir_does_not_exist
153
154if "%_MY_OPT_WITH_PDB" == "0" goto no_pdbdir_validation
155if ".%_MY_OPT_PDBDIR%" == "." set _MY_OPT_PDBDIR=%_MY_OPT_BINDIR%\..\stage\debug\bin
156if not exist "%_MY_OPT_PDBDIR%" goto error_pdbdir_does_not_exist
157:no_pdbdir_validation
158
159if "%_MY_OPT_WITH_EXTPACK" == "0" goto no_extpack_validation
160if ".%_MY_OPT_EXTPACK%" == "." set _MY_OPT_EXTPACK=%_MY_OPT_BINDIR%\Oracle_VM_VirtualBox_Extension_Pack.vbox-extpack
161if not exist "%_MY_OPT_EXTPACK%" goto error_extpack_does_not_exist
162:no_extack_validation
163
164if ".%_MY_OPT_ARCH%" == "." if exist "%_MY_OPT_BINDIR%\x86" set _MY_OPT_ARCH=amd64
165if ".%_MY_OPT_ARCH%" == "." set _MY_OPT_ARCH=x86
166
167if ".%_MY_OPT_OUTPUT%" == "." set _MY_OPT_OUTPUT=VBoxDrivers-%_MY_OPT_ARCH%.cab
168if exist "%_MY_OPT_OUTPUT%" goto error_output_exists
169
170if ".%_MY_OPT_DDF_FILE%" == "." set _MY_OPT_DDF_FILE=%_MY_OPT_OUTPUT%.ddf
171if exist "%_MY_OPT_DDF_FILE%" goto error_ddf_exists
172
173
174rem
175rem Unpack the extension pack.
176rem We unpack it into the bin directory in the usual location.
177rem
178if "%_MY_OPT_WITH_EXTPACK" == "0" goto no_extpack_unpack
179set _MY_EXTPACK_DIR=%_MY_OPT_BINDIR%\ExtensionPacks\Oracle_VM_VirtualBox_Extension_Pack
180if not exist "%_MY_OPT_BINDIR%\ExtensionPacks" ( mkdir "%_MY_OPT_BINDIR%\ExtensionPacks" || goto end_failed )
181if not exist "%_MY_EXTPACK_DIR%" ( mkdir "%_MY_EXTPACK_DIR%" || goto end_failed )
182"%_MY_OPT_BINDIR%\tools\RTTar.exe" -xzf "%_MY_OPT_EXTPACK%" -C "%_MY_EXTPACK_DIR%" || goto end_failed
183:no_extpack_unpack
184
185rem
186rem Create the DDF file for makecab.
187rem
188echo .OPTION EXPLICIT> "%_MY_OPT_DDF_FILE%" || goto end_failed
189echo .Set CabinetFileCountThreshold=0 >> "%_MY_OPT_DDF_FILE%"
190echo .Set FolderFileCountThreshold=0 >> "%_MY_OPT_DDF_FILE%"
191echo .Set FolderSizeThreshold=0 >> "%_MY_OPT_DDF_FILE%"
192echo .Set MaxCabinetSize=0 >> "%_MY_OPT_DDF_FILE%"
193echo .Set MaxDiskFileCount=0 >> "%_MY_OPT_DDF_FILE%"
194echo .Set MaxDiskSize=0 >> "%_MY_OPT_DDF_FILE%"
195echo .Set Cabinet=on>> "%_MY_OPT_DDF_FILE%"
196echo .Set CompressionType=MSZIP>> "%_MY_OPT_DDF_FILE%"
197echo .Set Compress=on>> "%_MY_OPT_DDF_FILE%"
198echo .Set DiskDirectoryTemplate= >> "%_MY_OPT_DDF_FILE%"
199echo .Set CabinetNameTemplate=%_MY_OPT_OUTPUT%>> "%_MY_OPT_DDF_FILE%"
200echo .Set InfFileName=%_MY_OPT_OUTPUT%.inf>> "%_MY_OPT_DDF_FILE%"
201echo .Set RptFileName=%_MY_OPT_OUTPUT%.rpt>> "%_MY_OPT_DDF_FILE%"
202
203echo .Set DestinationDir=VBoxDrv>> "%_MY_OPT_DDF_FILE%"
204echo %_MY_OPT_BINDIR%\VBoxDrv.inf VBoxDrv.inf>> "%_MY_OPT_DDF_FILE%"
205echo %_MY_OPT_BINDIR%\VBoxDrv.sys VBoxDrv.sys>> "%_MY_OPT_DDF_FILE%"
206if "%_MY_OPT_WITH_PDB%" == "1" echo %_MY_OPT_PDBDIR%\VBoxDrv.pdb VBoxDrv.pdb>> "%_MY_OPT_DDF_FILE%"
207
208echo .Set DestinationDir=VBoxNetAdp6>> "%_MY_OPT_DDF_FILE%"
209echo %_MY_OPT_BINDIR%\VBoxNetAdp6.inf VBoxNetAdp6.inf>> "%_MY_OPT_DDF_FILE%"
210echo %_MY_OPT_BINDIR%\VBoxNetAdp6.sys VBoxNetAdp6.sys>> "%_MY_OPT_DDF_FILE%"
211if "%_MY_OPT_WITH_PDB%" == "1" echo %_MY_OPT_PDBDIR%\VBoxNetAdp6.pdb VBoxNetAdp6.pdb>> "%_MY_OPT_DDF_FILE%"
212
213echo .Set DestinationDir=VBoxNetLwf>> "%_MY_OPT_DDF_FILE%"
214echo %_MY_OPT_BINDIR%\VBoxNetLwf.inf VBoxNetLwf.inf>> "%_MY_OPT_DDF_FILE%"
215echo %_MY_OPT_BINDIR%\VBoxNetLwf.sys VBoxNetLwf.sys>> "%_MY_OPT_DDF_FILE%"
216if "%_MY_OPT_WITH_PDB%" == "1" echo %_MY_OPT_PDBDIR%\VBoxNetLwf.pdb VBoxNetLwf.pdb>> "%_MY_OPT_DDF_FILE%"
217
218echo .Set DestinationDir=VBoxUSB>> "%_MY_OPT_DDF_FILE%"
219echo %_MY_OPT_BINDIR%\VBoxUSB.inf VBoxUSB.inf>> "%_MY_OPT_DDF_FILE%"
220echo %_MY_OPT_BINDIR%\VBoxUSB.sys VBoxUSB.sys>> "%_MY_OPT_DDF_FILE%"
221if "%_MY_OPT_WITH_PDB%" == "1" echo %_MY_OPT_PDBDIR%\VBoxUSB.pdb VBoxUSB.pdb>> "%_MY_OPT_DDF_FILE%"
222
223echo .Set DestinationDir=VBoxUSBMon>> "%_MY_OPT_DDF_FILE%"
224echo %_MY_OPT_BINDIR%\VBoxUSBMon.inf VBoxUSBMon.inf>> "%_MY_OPT_DDF_FILE%"
225echo %_MY_OPT_BINDIR%\VBoxUSBMon.sys VBoxUSBMon.sys>> "%_MY_OPT_DDF_FILE%"
226if "%_MY_OPT_WITH_PDB%" == "1" echo %_MY_OPT_PDBDIR%\VBoxUSBMon.pdb VBoxUSBMon.pdb>> "%_MY_OPT_DDF_FILE%"
227
228echo .Set DestinationDir=VMMR0>> "%_MY_OPT_DDF_FILE%"
229echo .\VMMR0.inf VMMR0.inf>> "%_MY_OPT_DDF_FILE%"
230echo %_MY_OPT_BINDIR%\VMMR0.r0 VMMR0.r0>> "%_MY_OPT_DDF_FILE%"
231if "%_MY_OPT_WITH_PDB%" == "1" echo %_MY_OPT_PDBDIR%\VMMR0.pdb VMMR0.pdb>> "%_MY_OPT_DDF_FILE%"
232echo %_MY_OPT_BINDIR%\VBoxDDR0.r0 VBoxDDR0.r0>> "%_MY_OPT_DDF_FILE%"
233if "%_MY_OPT_WITH_PDB%" == "1" echo %_MY_OPT_PDBDIR%\VBoxDDR0.pdb VBoxDDR0.pdb>> "%_MY_OPT_DDF_FILE%"
234if not exist %_MY_OPT_BINDIR%\VBoxDD2R0.r0 goto no_vboxdd2r0
235echo %_MY_OPT_BINDIR%\VBoxDD2R0.r0 VBoxDD2R0.r0>> "%_MY_OPT_DDF_FILE%"
236if "%_MY_OPT_WITH_PDB%" == "1" echo %_MY_OPT_PDBDIR%\VBoxDD2R0.pdb VBoxDD2R0.pdb>> "%_MY_OPT_DDF_FILE%"
237:no_vboxdd2r0
238
239if "%_MY_OPT_WITH_EXTPACK" == "0" goto no_extpack_ddf
240echo .Set DestinationDir=VBoxExtPackPuel>> "%_MY_OPT_DDF_FILE%"
241echo .\VBoxExtPackPuel.inf VBoxExtPackPuel.inf>> "%_MY_OPT_DDF_FILE%"
242echo %_MY_EXTPACK_DIR%\win.%_MY_OPT_ARCH%\VBoxEhciR0.r0 VBoxEhciR0.r0>> "%_MY_OPT_DDF_FILE%"
243echo %_MY_EXTPACK_DIR%\win.%_MY_OPT_ARCH%\VBoxNvmeR0.r0 VBoxNvmeR0.r0>> "%_MY_OPT_DDF_FILE%"
244rem echo %_MY_EXTPACK_DIR%\win.%_MY_OPT_ARCH%\VBoxPciRawR0.r0 VBoxPciRawR0.r0>> "%_MY_OPT_DDF_FILE%"
245:no_extpack_ddf
246
247rem
248rem Create the cabient file.
249rem Note! MakeCab is shipped on W10, so we ASSUME it's in the PATH.
250rem
251MakeCab.exe /v2 /F "%_MY_OPT_DDF_FILE%"
252
253goto end
254
255:end_failed
256@endlocal
257@endlocal
258@exit /b 1
259
260:end
261@endlocal
262@endlocal
263
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette