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