VirtualBox

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

Last change on this file since 84909 was 83532, checked in by vboxsync, 5 years ago

repack scripts: fixing hard-coded file name

  • Property svn:eol-style set to CRLF
  • Property svn:keywords set to Author Date Id Revision
File size: 14.8 KB
Line 
1@echo off
2rem $Id: PackDriversForSubmission.cmd 83532 2020-04-03 14:25:39Z vboxsync $
3rem rem @file
4rem Windows NT batch script for preparing for signing submission.
5rem
6
7rem
8rem Copyright (C) 2018-2020 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_GADIR=
29set _MY_OPT_WITH_MAIN=1
30set _MY_OPT_WITH_PDB=1
31set _MY_OPT_EXTPACK=
32set _MY_OPT_WITH_EXTPACK=1
33set _MY_OPT_WITH_GA=0
34set _MY_OPT_OUTPUT=
35set _MY_OPT_DDF_FILE=
36set _MY_OPT_ARCH=amd64
37
38:argument_loop
39if ".%1" == "." goto no_more_arguments
40
41if ".%1" == ".-h" goto opt_h
42if ".%1" == ".-?" goto opt_h
43if ".%1" == "./h" goto opt_h
44if ".%1" == "./H" goto opt_h
45if ".%1" == "./?" goto opt_h
46if ".%1" == ".-help" goto opt_h
47if ".%1" == ".--help" goto opt_h
48
49if ".%1" == ".-a" goto opt_a
50if ".%1" == ".--arch" goto opt_a
51if ".%1" == ".-b" goto opt_b
52if ".%1" == ".--bindir" goto opt_b
53if ".%1" == ".-d" goto opt_d
54if ".%1" == ".--ddf" goto opt_d
55if ".%1" == ".-e" goto opt_e
56if ".%1" == ".--extpack" goto opt_e
57if ".%1" == ".--no-main" goto opt_m
58if ".%1" == ".-n" goto opt_n
59if ".%1" == ".--no-pdb" goto opt_n
60if ".%1" == ".-o" goto opt_o
61if ".%1" == ".--output" goto opt_o
62if ".%1" == ".-p" goto opt_p
63if ".%1" == ".--pdb" goto opt_p
64if ".%1" == ".-x" goto opt_x
65if ".%1" == ".--no-extpack" goto opt_x
66if ".%1" == ".-g" goto opt_g
67if ".%1" == ".--ga" goto opt_g
68if ".%1" == ".--additions" goto opt_g
69echo syntax error: Unknown option: %1
70echo Try --help to list valid options.
71goto end_failed
72
73:argument_loop_next_with_value
74shift
75shift
76goto argument_loop
77
78:opt_a
79if ".%~2" == "." goto syntax_error_missing_value
80if not "%2" == "x86" if not "%2" == "amd64" goto syntax_error_unknown_arch
81set _MY_OPT_ARCH=%~2
82goto argument_loop_next_with_value
83
84:opt_b
85if ".%~2" == "." goto syntax_error_missing_value
86set _MY_OPT_BINDIR=%~2
87goto argument_loop_next_with_value
88
89:opt_d
90if ".%~2" == "." goto syntax_error_missing_value
91set _MY_OPT_DDF_FILE=%~2
92goto argument_loop_next_with_value
93
94:opt_e
95if ".%~2" == "." goto syntax_error_missing_value
96set _MY_OPT_EXTPACK=%~2
97goto argument_loop_next_with_value
98
99:opt_h
100echo This script creates a .cab file containing all drivers needing blessing from
101echo Microsoft to run on recent Windows 10 installations.
102echo .
103echo Usage: PackDriversForSubmission.cmd [-b bindir] [-p pdbdir] [--no-main] [-n/--no-pdb] [-e expack]
104echo [-x/--no-extpack] [-g/--ga/--additions] [-o output.cab] [-p output.ddf] [-a x86/amd64]
105echo .
106echo Warning! This script should normally be invoked from the repack directory w/o any parameters.
107goto end_failed
108
109:opt_m
110set _MY_OPT_WITH_MAIN=0
111shift
112goto argument_loop
113
114:opt_n
115set _MY_OPT_WITH_PDB=0
116shift
117goto argument_loop
118
119:opt_p
120if ".%~2" == "." goto syntax_error_missing_value
121set _MY_OPT_PDBDIR=%~2
122goto argument_loop_next_with_value
123
124:opt_o
125if ".%~2" == "." goto syntax_error_missing_value
126set _MY_OPT_OUTPUT=%~2
127goto argument_loop_next_with_value
128
129:opt_x
130set _MY_OPT_WITH_EXTPACK=0
131shift
132goto argument_loop
133
134:opt_g
135set _MY_OPT_WITH_GA=1
136shift
137goto argument_loop
138
139
140:syntax_error_missing_value
141echo syntax error: missing or empty option value after %1
142goto end_failed
143
144:syntax_error_unknown_arch
145echo syntax error: Unknown architecture: %2
146goto end_failed
147
148:error_bindir_does_not_exist
149echo syntax error: Specified BIN directory does not exist: "%_MY_OPT_BINDIR%"
150goto end_failed
151
152:error_pdbdir_does_not_exist
153echo syntax error: Specified PDB directory does not exist: "%_MY_OPT_PDBDIR%"
154goto end_failed
155
156:error_extpack_does_not_exist
157echo syntax error: Specified extension pack does not exist: "%_MY_OPT_EXTPACK%"
158goto end_failed
159
160:error_additions_does_not_exist
161echo syntax error: Specified guest additions does not exist: "%_MY_OPT_GADIR%"
162goto end_failed
163
164
165:error_output_exists
166echo error: The output file already exist: "%_MY_OPT_OUTPUT%"
167goto end_failed
168
169:error_ddf_exists
170echo error: The DDF file already exist: "%_MY_OPT_DDF_FILE%"
171goto end_failed
172
173:no_more_arguments
174rem validate specified options
175if not exist "%_MY_OPT_BINDIR%" goto error_bindir_does_not_exist
176
177if "%_MY_OPT_WITH_PDB%" == "0" goto no_pdbdir_validation
178if ".%_MY_OPT_PDBDIR%" == "." set _MY_OPT_PDBDIR=%_MY_OPT_BINDIR%\..\stage\debug\bin
179if not exist "%_MY_OPT_PDBDIR%" goto error_pdbdir_does_not_exist
180:no_pdbdir_validation
181
182if "%_MY_OPT_WITH_EXTPACK%" == "0" goto no_extpack_validation
183if ".%_MY_OPT_EXTPACK%" == "." set _MY_OPT_EXTPACK=%_MY_OPT_BINDIR%\Oracle_VM_VirtualBox_Extension_Pack.vbox-extpack
184if not exist "%_MY_OPT_EXTPACK%" goto error_extpack_does_not_exist
185:no_extpack_validation
186
187if "%_MY_OPT_WITH_GA%" == "0" goto no_additions_validation
188if ".%_MY_OPT_GADIR%" == "." set _MY_OPT_GADIR=%_MY_OPT_BINDIR%\additions
189if not exist "%_MY_OPT_GADIR%" goto error_additions_does_not_exist
190:no_additions_validation
191
192if ".%_MY_OPT_OUTPUT%" == "." set _MY_OPT_OUTPUT=VBoxDrivers-@VBOX_VERSION_STRING@r@VBOX_SVN_REV@-%_MY_OPT_ARCH%.cab
193if exist "%_MY_OPT_OUTPUT%" goto error_output_exists
194
195if ".%_MY_OPT_DDF_FILE%" == "." set _MY_OPT_DDF_FILE=%_MY_OPT_OUTPUT%.ddf
196if exist "%_MY_OPT_DDF_FILE%" goto error_ddf_exists
197
198
199rem
200rem Unpack the extension pack.
201rem We unpack it into the bin directory in the usual location.
202rem
203rem Note! Modify the path a little to ensure windows utilities are used before
204rem cygwin ones, and that we can use stuff from bin\tools if we like.
205rem
206set PATH=%SystemRoot%\System32;%PATH%;%_MY_OPT_BINDIR%
207if "%_MY_OPT_WITH_EXTPACK%" == "0" goto no_extpack_unpack
208set _MY_EXTPACK_DIR=%_MY_OPT_BINDIR%\ExtensionPacks\Oracle_VM_VirtualBox_Extension_Pack
209if not exist "%_MY_OPT_BINDIR%\ExtensionPacks" ( mkdir "%_MY_OPT_BINDIR%\ExtensionPacks" || goto end_failed )
210if not exist "%_MY_EXTPACK_DIR%" ( mkdir "%_MY_EXTPACK_DIR%" || goto end_failed )
211"%_MY_OPT_BINDIR%\tools\RTTar.exe" -xzf "%_MY_OPT_EXTPACK%" -C "%_MY_EXTPACK_DIR%" || goto end_failed
212:no_extpack_unpack
213
214rem
215rem Create the DDF file for makecab.
216rem
217echo .OPTION EXPLICIT> "%_MY_OPT_DDF_FILE%" || goto end_failed
218echo .Set CabinetFileCountThreshold=0 >> "%_MY_OPT_DDF_FILE%"
219echo .Set FolderFileCountThreshold=0 >> "%_MY_OPT_DDF_FILE%"
220echo .Set FolderSizeThreshold=0 >> "%_MY_OPT_DDF_FILE%"
221echo .Set MaxCabinetSize=0 >> "%_MY_OPT_DDF_FILE%"
222echo .Set MaxDiskFileCount=0 >> "%_MY_OPT_DDF_FILE%"
223echo .Set MaxDiskSize=0 >> "%_MY_OPT_DDF_FILE%"
224echo .Set Cabinet=on>> "%_MY_OPT_DDF_FILE%"
225echo .Set CompressionType=MSZIP>> "%_MY_OPT_DDF_FILE%"
226echo .Set Compress=on>> "%_MY_OPT_DDF_FILE%"
227echo .Set DiskDirectoryTemplate= >> "%_MY_OPT_DDF_FILE%"
228echo .Set CabinetNameTemplate=%_MY_OPT_OUTPUT%>> "%_MY_OPT_DDF_FILE%"
229echo .Set InfFileName=%_MY_OPT_OUTPUT%.inf>> "%_MY_OPT_DDF_FILE%"
230echo .Set RptFileName=%_MY_OPT_OUTPUT%.rpt>> "%_MY_OPT_DDF_FILE%"
231
232if %_MY_OPT_WITH_MAIN% == 0 goto skip_main_package
233echo .Set DestinationDir=VBoxDrv>> "%_MY_OPT_DDF_FILE%"
234echo %_MY_OPT_BINDIR%\VBoxDrv.inf VBoxDrv.inf>> "%_MY_OPT_DDF_FILE%"
235echo %_MY_OPT_BINDIR%\VBoxDrv.sys VBoxDrv.sys>> "%_MY_OPT_DDF_FILE%"
236if "%_MY_OPT_WITH_PDB%" == "1" echo %_MY_OPT_PDBDIR%\VBoxDrv.pdb VBoxDrv.pdb>> "%_MY_OPT_DDF_FILE%"
237
238echo .Set DestinationDir=VBoxNetAdp6>> "%_MY_OPT_DDF_FILE%"
239echo %_MY_OPT_BINDIR%\VBoxNetAdp6.inf VBoxNetAdp6.inf>> "%_MY_OPT_DDF_FILE%"
240echo %_MY_OPT_BINDIR%\VBoxNetAdp6.sys VBoxNetAdp6.sys>> "%_MY_OPT_DDF_FILE%"
241if "%_MY_OPT_WITH_PDB%" == "1" echo %_MY_OPT_PDBDIR%\VBoxNetAdp6.pdb VBoxNetAdp6.pdb>> "%_MY_OPT_DDF_FILE%"
242
243echo .Set DestinationDir=VBoxNetLwf>> "%_MY_OPT_DDF_FILE%"
244echo %_MY_OPT_BINDIR%\VBoxNetLwf.inf VBoxNetLwf.inf>> "%_MY_OPT_DDF_FILE%"
245echo %_MY_OPT_BINDIR%\VBoxNetLwf.sys VBoxNetLwf.sys>> "%_MY_OPT_DDF_FILE%"
246if "%_MY_OPT_WITH_PDB%" == "1" echo %_MY_OPT_PDBDIR%\VBoxNetLwf.pdb VBoxNetLwf.pdb>> "%_MY_OPT_DDF_FILE%"
247
248echo .Set DestinationDir=VBoxUSB>> "%_MY_OPT_DDF_FILE%"
249echo %_MY_OPT_BINDIR%\VBoxUSB.inf VBoxUSB.inf>> "%_MY_OPT_DDF_FILE%"
250echo %_MY_OPT_BINDIR%\VBoxUSB.sys VBoxUSB.sys>> "%_MY_OPT_DDF_FILE%"
251if "%_MY_OPT_WITH_PDB%" == "1" echo %_MY_OPT_PDBDIR%\VBoxUSB.pdb VBoxUSB.pdb>> "%_MY_OPT_DDF_FILE%"
252
253echo .Set DestinationDir=VBoxUSBMon>> "%_MY_OPT_DDF_FILE%"
254echo %_MY_OPT_BINDIR%\VBoxUSBMon.inf VBoxUSBMon.inf>> "%_MY_OPT_DDF_FILE%"
255echo %_MY_OPT_BINDIR%\VBoxUSBMon.sys VBoxUSBMon.sys>> "%_MY_OPT_DDF_FILE%"
256if "%_MY_OPT_WITH_PDB%" == "1" echo %_MY_OPT_PDBDIR%\VBoxUSBMon.pdb VBoxUSBMon.pdb>> "%_MY_OPT_DDF_FILE%"
257
258echo .Set DestinationDir=VMMR0>> "%_MY_OPT_DDF_FILE%"
259echo .\VMMR0.inf VMMR0.inf>> "%_MY_OPT_DDF_FILE%"
260echo %_MY_OPT_BINDIR%\VMMR0.r0 VMMR0.r0>> "%_MY_OPT_DDF_FILE%"
261if "%_MY_OPT_WITH_PDB%" == "1" echo %_MY_OPT_PDBDIR%\VMMR0.pdb VMMR0.pdb>> "%_MY_OPT_DDF_FILE%"
262echo %_MY_OPT_BINDIR%\VBoxDDR0.r0 VBoxDDR0.r0>> "%_MY_OPT_DDF_FILE%"
263:skip_main_package
264
265if "%_MY_OPT_WITH_PDB%" == "1" echo %_MY_OPT_PDBDIR%\VBoxDDR0.pdb VBoxDDR0.pdb>> "%_MY_OPT_DDF_FILE%"
266
267if "%_MY_OPT_WITH_EXTPACK%" == "0" goto no_extpack_ddf
268echo .Set DestinationDir=VBoxExtPackPuel>> "%_MY_OPT_DDF_FILE%"
269echo .\VBoxExtPackPuel.inf VBoxExtPackPuel.inf>> "%_MY_OPT_DDF_FILE%"
270echo %_MY_EXTPACK_DIR%\win.%_MY_OPT_ARCH%\VBoxEhciR0.r0 VBoxEhciR0.r0>> "%_MY_OPT_DDF_FILE%"
271echo %_MY_EXTPACK_DIR%\win.%_MY_OPT_ARCH%\VBoxNvmeR0.r0 VBoxNvmeR0.r0>> "%_MY_OPT_DDF_FILE%"
272rem echo %_MY_EXTPACK_DIR%\win.%_MY_OPT_ARCH%\VBoxPciRawR0.r0 VBoxPciRawR0.r0>> "%_MY_OPT_DDF_FILE%"
273:no_extpack_ddf
274
275if "%_MY_OPT_WITH_GA%" == "0" goto no_additions_ddf
276echo .Set DestinationDir=VBoxGuestAdditions>> "%_MY_OPT_DDF_FILE%"
277echo %_MY_OPT_GADIR%\VBoxGuest.inf>> "%_MY_OPT_DDF_FILE%"
278echo %_MY_OPT_GADIR%\VBoxGuest.sys>> "%_MY_OPT_DDF_FILE%"
279echo %_MY_OPT_GADIR%\VBoxTray.exe>> "%_MY_OPT_DDF_FILE%"
280echo %_MY_OPT_GADIR%\VBoxControl.exe>> "%_MY_OPT_DDF_FILE%"
281echo %_MY_OPT_GADIR%\VBoxMouse.inf>> "%_MY_OPT_DDF_FILE%"
282echo %_MY_OPT_GADIR%\VBoxMouse.sys>> "%_MY_OPT_DDF_FILE%"
283rem VBoxVideo files are excluded from attestation signing.
284rem echo %_MY_OPT_GADIR%\VBoxVideo.inf>> "%_MY_OPT_DDF_FILE%"
285rem echo %_MY_OPT_GADIR%\VBoxVideo.sys>> "%_MY_OPT_DDF_FILE%"
286echo %_MY_OPT_GADIR%\VBoxWddm.inf>> "%_MY_OPT_DDF_FILE%"
287echo %_MY_OPT_GADIR%\VBoxWddm.sys>> "%_MY_OPT_DDF_FILE%"
288echo %_MY_OPT_GADIR%\vboxdisp.dll>> "%_MY_OPT_DDF_FILE%"
289echo %_MY_OPT_GADIR%\vboxdispd3d.dll>> "%_MY_OPT_DDF_FILE%"
290echo %_MY_OPT_GADIR%\vboxnine.dll>> "%_MY_OPT_DDF_FILE%"
291echo %_MY_OPT_GADIR%\vboxsvga.dll>> "%_MY_OPT_DDF_FILE%"
292echo %_MY_OPT_GADIR%\vboxicd.dll>> "%_MY_OPT_DDF_FILE%"
293echo %_MY_OPT_GADIR%\vboxgl.dll>> "%_MY_OPT_DDF_FILE%"
294if ".%_MY_OPT_ARCH%" == ".x86" goto skip_amd64_files
295echo %_MY_OPT_GADIR%\vboxdispd3d-x86.dll>> "%_MY_OPT_DDF_FILE%"
296echo %_MY_OPT_GADIR%\vboxnine-x86.dll>> "%_MY_OPT_DDF_FILE%"
297echo %_MY_OPT_GADIR%\vboxsvga-x86.dll>> "%_MY_OPT_DDF_FILE%"
298echo %_MY_OPT_GADIR%\vboxicd-x86.dll>> "%_MY_OPT_DDF_FILE%"
299echo %_MY_OPT_GADIR%\vboxgl-x86.dll>> "%_MY_OPT_DDF_FILE%"
300:skip_amd64_files
301
302:no_additions_ddf
303
304rem
305rem Create the cabient file.
306rem Note! MakeCab is shipped on W10, so we ASSUME it's in the PATH.
307rem
308MakeCab.exe /v2 /F "%_MY_OPT_DDF_FILE%" || goto end_failed
309
310rem
311rem EV sign the cabient file.
312rem
313if not exist "sign-ev.cmd" goto end
314echo info: Now signing the created CAB file. Can take a few minutes...
315call sign-ev.cmd "%_MY_OPT_OUTPUT%" || goto end_failed
316
317goto end
318
319:end_failed
320@endlocal
321@endlocal
322@exit /b 1
323
324:end
325@endlocal
326@endlocal
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