1 | @echo off
|
---|
2 | rem $Id: Combined-1-Prepare.cmd 82968 2020-02-04 10:35:17Z vboxsync $
|
---|
3 | rem rem @file
|
---|
4 | rem Windows NT batch script for preparing both amd64 and x86 for signing submission.
|
---|
5 | rem
|
---|
6 |
|
---|
7 | rem
|
---|
8 | rem Copyright (C) 2018-2020 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 Globals and checks for required enviornment variables.
|
---|
25 | rem
|
---|
26 | if ".%KBUILD_DEVTOOLS%" == "." (echo KBUILD_DEVTOOLS is not set & goto end_failed)
|
---|
27 | if ".%KBUILD_BIN_PATH%" == "." (echo KBUILD_BIN_PATH is not set & goto end_failed)
|
---|
28 | set _MY_SCRIPT_DIR=%~dp0
|
---|
29 | set _MY_SAVED_CD=%CD%
|
---|
30 | set _MY_VER_REV=@VBOX_VERSION_STRING@r@VBOX_SVN_REV@
|
---|
31 | set _MY_PACK_EXTPACK=1
|
---|
32 | set _MY_PACK_ADDITIONS=0
|
---|
33 |
|
---|
34 | rem
|
---|
35 | rem Parse arguments.
|
---|
36 | rem
|
---|
37 | set _MY_OPT_UNTAR_DIR=%_MY_SCRIPT_DIR%\..\..\..
|
---|
38 | for %%i in (%_MY_OPT_UNTAR_DIR%) do set _MY_OPT_UNTAR_DIR=%%~fi
|
---|
39 | set _MY_OPT_EXTPACK=%_MY_OPT_UNTAR_DIR%\Oracle_VM_VirtualBox_Extension_Pack-%_MY_VER_REV%.vbox-extpack
|
---|
40 | set _MY_OPT_EXTPACK_ENTERPRISE=%_MY_OPT_UNTAR_DIR%\Oracle_VM_VirtualBox_Extension_Pack-%_MY_VER_REV%-ENTERPRISE.vbox-extpack
|
---|
41 | set _MY_OPT_BUILD_TYPE=@KBUILD_TYPE@
|
---|
42 | set _MY_OPT_OUTDIR=%_MY_OPT_UNTAR_DIR%\output
|
---|
43 |
|
---|
44 | :argument_loop
|
---|
45 | if ".%1" == "." goto no_more_arguments
|
---|
46 |
|
---|
47 | if ".%1" == ".-h" goto opt_h
|
---|
48 | if ".%1" == ".-?" goto opt_h
|
---|
49 | if ".%1" == "./h" goto opt_h
|
---|
50 | if ".%1" == "./H" goto opt_h
|
---|
51 | if ".%1" == "./?" goto opt_h
|
---|
52 | if ".%1" == ".-help" goto opt_h
|
---|
53 | if ".%1" == ".--help" goto opt_h
|
---|
54 |
|
---|
55 | if ".%1" == ".-g" goto opt_g
|
---|
56 | if ".%1" == ".--additions" goto opt_g
|
---|
57 | if ".%1" == ".-e" goto opt_e
|
---|
58 | if ".%1" == ".--extpack" goto opt_e
|
---|
59 | if ".%1" == ".--no-extpack" goto opt_ne
|
---|
60 | if ".%1" == ".-o" goto opt_o
|
---|
61 | if ".%1" == ".--outdir" goto opt_o
|
---|
62 | if ".%1" == ".-s" goto opt_s
|
---|
63 | if ".%1" == ".--extpack-enterprise" goto opt_s
|
---|
64 | if ".%1" == ".-t" goto opt_t
|
---|
65 | if ".%1" == ".--build-type" goto opt_t
|
---|
66 | if ".%1" == ".-u" goto opt_u
|
---|
67 | if ".%1" == ".--vboxall-untar-dir" goto opt_u
|
---|
68 | echo syntax error: Unknown option: %1
|
---|
69 | echo Try --help to list valid options.
|
---|
70 | goto end_failed
|
---|
71 |
|
---|
72 | :argument_loop_next_with_value
|
---|
73 | shift
|
---|
74 | shift
|
---|
75 | goto argument_loop
|
---|
76 |
|
---|
77 | :opt_g
|
---|
78 | set _MY_PACK_ADDITIONS=1
|
---|
79 | shift
|
---|
80 | goto argument_loop
|
---|
81 |
|
---|
82 | :opt_e
|
---|
83 | if ".%~2" == "." goto syntax_error_missing_value
|
---|
84 | set _MY_OPT_EXTPACK=%~f2
|
---|
85 | goto argument_loop_next_with_value
|
---|
86 |
|
---|
87 | :opt_ne
|
---|
88 | set _MY_PACK_EXTPACK=0
|
---|
89 | shift
|
---|
90 | goto argument_loop
|
---|
91 |
|
---|
92 | :opt_h
|
---|
93 | echo Toplevel combined package: Prepare both x86 and amd64 for submission.
|
---|
94 | echo .
|
---|
95 | echo Usage: Combined-1-Prepare.cmd [-o output-dir] [-e/--extpack puel.vbox-extpack]
|
---|
96 | echo [-s/--extpack-enterprise puel-enterprise.vbox-extpack]
|
---|
97 | echo [--no-extpack] [-g/--additions]
|
---|
98 | echo [-u/--vboxall-dir unpacked-vboxall-dir] [-t build-type]
|
---|
99 | echo .
|
---|
100 | echo Default -e/--extpack value: %_MY_OPT_EXTPACK%
|
---|
101 | echo Default -s/--extpack-enterprise value: %_MY_OPT_EXTPACK_ENTERPRISE%
|
---|
102 | echo Default -u/--vboxall-untar-dir value: %_MY_OPT_UNTAR_DIR%
|
---|
103 | echo Default -o/--outdir value: %_MY_OPT_OUTDIR%
|
---|
104 | echo Default -t/--build-type value: %_MY_OPT_BUILD_TYPE%
|
---|
105 | echo .
|
---|
106 | goto end_failed
|
---|
107 |
|
---|
108 | :opt_o
|
---|
109 | if ".%~2" == "." goto syntax_error_missing_value
|
---|
110 | set _MY_OPT_OUTDIR=%~f2
|
---|
111 | goto argument_loop_next_with_value
|
---|
112 |
|
---|
113 | :opt_s
|
---|
114 | if ".%~2" == "." goto syntax_error_missing_value
|
---|
115 | set _MY_OPT_EXTPACK_ENTERPRISE=%~f2
|
---|
116 | goto argument_loop_next_with_value
|
---|
117 |
|
---|
118 | :opt_t
|
---|
119 | if ".%~2" == "." goto syntax_error_missing_value
|
---|
120 | set _MY_OPT_BUILD_TYPE=%~2
|
---|
121 | goto argument_loop_next_with_value
|
---|
122 |
|
---|
123 | :opt_u
|
---|
124 | if ".%~2" == "." goto syntax_error_missing_value
|
---|
125 | set _MY_OPT_UNTAR_DIR=%~f2
|
---|
126 | goto argument_loop_next_with_value
|
---|
127 |
|
---|
128 |
|
---|
129 | :syntax_error_missing_value
|
---|
130 | echo syntax error: missing or empty option value after %1
|
---|
131 | goto end_failed
|
---|
132 |
|
---|
133 |
|
---|
134 | :error_vboxall_untar_dir_not_found
|
---|
135 | echo syntax error: The VBoxAll untar directory was not found: "%_MY_OPT_UNTAR_DIR%"
|
---|
136 | goto end_failed
|
---|
137 |
|
---|
138 | :error_amd64_bindir_not_found
|
---|
139 | echo syntax error: The AMD64 bin directory was not found: "%_MY_BINDIR_AMD64%"
|
---|
140 | goto end_failed
|
---|
141 |
|
---|
142 | :error_x86_bindir_not_found
|
---|
143 | echo syntax error: The X86 bin directory was not found: "%_MY_BINDIR_X86%"
|
---|
144 | goto end_failed
|
---|
145 |
|
---|
146 | :error_amd64_repack_dir_not_found
|
---|
147 | echo syntax error: The AMD64 repack directory was not found: "%_MY_REPACK_DIR_AMD64%"
|
---|
148 | goto end_failed
|
---|
149 |
|
---|
150 | :error_x86_repack_dir_not_found
|
---|
151 | echo syntax error: The X86 repack directory was not found: "%_MY_REPACK_DIR_X86%"
|
---|
152 | goto end_failed
|
---|
153 |
|
---|
154 | :error_extpack_not_found
|
---|
155 | echo syntax error: Specified extension pack not found: "%_MY_OPT_EXTPACK%"
|
---|
156 | goto end_failed
|
---|
157 |
|
---|
158 | :error_enterprise_extpack_not_found
|
---|
159 | echo syntax error: Specified enterprise extension pack not found: "%_MY_OPT_EXTPACK_ENTERPRISE%"
|
---|
160 | goto end_failed
|
---|
161 |
|
---|
162 | :error_extpack_and_additions_together
|
---|
163 | echo usage error: You can't prepare extPack and GuestAdditions in one call
|
---|
164 | goto end_failed
|
---|
165 |
|
---|
166 | :no_more_arguments
|
---|
167 | rem
|
---|
168 | rem Validate and adjust specified options.
|
---|
169 | rem
|
---|
170 |
|
---|
171 | if not exist "%_MY_OPT_UNTAR_DIR%" goto error_vboxall_untar_dir_not_found
|
---|
172 |
|
---|
173 | set _MY_BINDIR_AMD64=%_MY_OPT_UNTAR_DIR%\win.amd64\%_MY_OPT_BUILD_TYPE%\bin
|
---|
174 | set _MY_BINDIR_X86=%_MY_OPT_UNTAR_DIR%\win.x86\%_MY_OPT_BUILD_TYPE%\bin
|
---|
175 | if not exist "%_MY_BINDIR_AMD64%" goto error_amd64_bindir_not_found
|
---|
176 | if not exist "%_MY_BINDIR_X86%" goto error_x86_bindir_not_found
|
---|
177 |
|
---|
178 | if ".%_MY_PACK_EXTPACK%" == ".%_MY_PACK_ADDITIONS%" goto error_extpack_and_additions_together
|
---|
179 |
|
---|
180 | set _MY_REPACK_DIR_AMD64=%_MY_OPT_UNTAR_DIR%\win.amd64\%_MY_OPT_BUILD_TYPE%\repack
|
---|
181 | set _MY_REPACK_DIR_X86=%_MY_OPT_UNTAR_DIR%\win.x86\%_MY_OPT_BUILD_TYPE%\repack
|
---|
182 | if ".%_MY_PACK_ADDITIONS%" == ".0" goto skip_additions_packing_options
|
---|
183 | set _MY_REPACK_DIR_AMD64=%_MY_OPT_UNTAR_DIR%\win.amd64\%_MY_OPT_BUILD_TYPE%\repackadd
|
---|
184 | set _MY_REPACK_DIR_X86=%_MY_OPT_UNTAR_DIR%\win.x86\%_MY_OPT_BUILD_TYPE%\repackadd
|
---|
185 | :skip_additions_packing_options
|
---|
186 | if not exist "%_MY_REPACK_DIR_AMD64%" goto error_amd64_repack_dir_not_found
|
---|
187 | if not exist "%_MY_REPACK_DIR_X86%" goto error_x86_repack_dir_not_found
|
---|
188 |
|
---|
189 | rem Make sure the output dir exists.
|
---|
190 | if not exist "%_MY_OPT_OUTDIR%" (mkdir "%_MY_OPT_OUTDIR%" || goto end_failed)
|
---|
191 |
|
---|
192 | rem
|
---|
193 | rem ExtPack section
|
---|
194 | rem
|
---|
195 | if ".%_MY_PACK_EXTPACK%" == ".0" goto skip_extpack_packing
|
---|
196 |
|
---|
197 | if not exist "%_MY_OPT_EXTPACK%" goto error_extpack_not_found
|
---|
198 | if not ".%_MY_OPT_EXTPACK_ENTERPRISE%" == "." if not exist "%_MY_OPT_EXTPACK_ENTERPRISE%" goto error_enterprise_extpack_not_found
|
---|
199 |
|
---|
200 | rem
|
---|
201 | rem Install the extpack in the bin directories.
|
---|
202 | rem Note! Not really necessary, but whatever.
|
---|
203 | rem
|
---|
204 | echo on
|
---|
205 | copy /y "%_MY_OPT_EXTPACK%" "%_MY_BINDIR_AMD64%\Oracle_VM_VirtualBox_Extension_Pack.vbox-extpack" || goto end_failed
|
---|
206 | copy /y "%_MY_OPT_EXTPACK%" "%_MY_BINDIR_X86%\Oracle_VM_VirtualBox_Extension_Pack.vbox-extpack" || goto end_failed
|
---|
207 | @echo off
|
---|
208 |
|
---|
209 | rem
|
---|
210 | rem Do the packing of ExtPack
|
---|
211 | rem
|
---|
212 | echo **************************************************************************
|
---|
213 | echo Packing AMD64 drivers
|
---|
214 | echo **************************************************************************
|
---|
215 | cd /d "%_MY_REPACK_DIR_AMD64%" || goto end_failed
|
---|
216 | call "%_MY_REPACK_DIR_AMD64%\PackDriversForSubmission.cmd" -b "%_MY_BINDIR_AMD64%" -a amd64 -e "%_MY_OPT_EXTPACK%" ^
|
---|
217 | -o "%_MY_OPT_OUTDIR%\VBoxDrivers-%_MY_VER_REV%-amd64.cab" || goto end_failed
|
---|
218 | echo .
|
---|
219 | echo **************************************************************************
|
---|
220 | echo Packing X86 drivers
|
---|
221 | echo **************************************************************************
|
---|
222 | cd /d "%_MY_REPACK_DIR_X86%" || goto end_failed
|
---|
223 | call "%_MY_REPACK_DIR_X86%\PackDriversForSubmission.cmd" -b "%_MY_BINDIR_X86%" -a x86 -e "%_MY_OPT_EXTPACK%" ^
|
---|
224 | -o "%_MY_OPT_OUTDIR%\VBoxDrivers-%_MY_VER_REV%-x86.cab" || goto end_failed
|
---|
225 | echo .
|
---|
226 | cd /d "%_MY_SAVED_CD%"
|
---|
227 | :skip_extpack_packing
|
---|
228 |
|
---|
229 | rem
|
---|
230 | rem GuestAdditions section
|
---|
231 | rem
|
---|
232 | if ".%_MY_PACK_ADDITIONS%" == ".0" goto skip_additions_packing
|
---|
233 |
|
---|
234 | rem
|
---|
235 | rem Do the packing of GuestAdditions
|
---|
236 | rem
|
---|
237 | echo **************************************************************************
|
---|
238 | echo Packing AMD64 additions
|
---|
239 | echo **************************************************************************
|
---|
240 | cd /d "%_MY_REPACK_DIR_AMD64%" || goto end_failed
|
---|
241 | call "%_MY_REPACK_DIR_AMD64%\PackDriversForSubmission.cmd" -b "%_MY_BINDIR_AMD64%" -a amd64 -x -n --no-main --ga ^
|
---|
242 | -o "%_MY_OPT_OUTDIR%\VBoxDrivers-%_MY_VER_REV%-amd64.cab" || goto end_failed
|
---|
243 | echo .
|
---|
244 | echo **************************************************************************
|
---|
245 | echo Packing X86 drivers
|
---|
246 | echo **************************************************************************
|
---|
247 | cd /d "%_MY_REPACK_DIR_X86%" || goto end_failed
|
---|
248 | call "%_MY_REPACK_DIR_X86%\PackDriversForSubmission.cmd" -b "%_MY_BINDIR_X86%" -a x86 -x -n --no-main --ga ^
|
---|
249 | -o "%_MY_OPT_OUTDIR%\VBoxDrivers-%_MY_VER_REV%-x86.cab" || goto end_failed
|
---|
250 | echo .
|
---|
251 | cd /d "%_MY_SAVED_CD%"
|
---|
252 | :skip_additions_packing
|
---|
253 |
|
---|
254 | rem
|
---|
255 | rem Generate script for taking the next step.
|
---|
256 | rem
|
---|
257 | set _MY_NEXT_SCRIPT_SHORT_NAME=Combined-3-Repack.cmd
|
---|
258 | set _MY_NEXT_SCRIPT=%_MY_OPT_OUTDIR%\%_MY_NEXT_SCRIPT_SHORT_NAME%
|
---|
259 | if ".%_MY_PACK_ADDITIONS%" == ".0" goto generate_legacy_script
|
---|
260 | set _MY_NEXT_SCRIPT_SHORT_NAME=Combined-3-RepackAdditions.cmd
|
---|
261 | set _MY_NEXT_SCRIPT=%_MY_OPT_OUTDIR%\%_MY_NEXT_SCRIPT_SHORT_NAME%
|
---|
262 | echo cd /d "%cd%" > "%_MY_NEXT_SCRIPT%"
|
---|
263 | echo call "%_MY_SCRIPT_DIR%%_MY_NEXT_SCRIPT_SHORT_NAME%" ^
|
---|
264 | --vboxall-untar-dir "%_MY_OPT_UNTAR_DIR%" ^
|
---|
265 | --outdir "%_MY_OPT_OUTDIR%" ^
|
---|
266 | --build-type "%_MY_OPT_BUILD_TYPE%" %%* >> "%_MY_NEXT_SCRIPT%"
|
---|
267 | goto show_next_steps
|
---|
268 | :generate_legacy_script
|
---|
269 | echo cd /d "%cd%" > "%_MY_NEXT_SCRIPT%"
|
---|
270 | echo call "%_MY_SCRIPT_DIR%%_MY_NEXT_SCRIPT_SHORT_NAME%" --extpack "%_MY_OPT_EXTPACK%" ^
|
---|
271 | --extpack-enterprise "%_MY_OPT_EXTPACK_ENTERPRISE%" ^
|
---|
272 | --vboxall-untar-dir "%_MY_OPT_UNTAR_DIR%" ^
|
---|
273 | --outdir "%_MY_OPT_OUTDIR%" ^
|
---|
274 | %_MY_OPT_SCRIPT_SKIPEXTPACK_PARAM% %_MY_OPT_SCRIPT_ADDITIONS_PARAM% ^
|
---|
275 | --build-type "%_MY_OPT_BUILD_TYPE%" %%* >> "%_MY_NEXT_SCRIPT%"
|
---|
276 |
|
---|
277 | :show_next_steps
|
---|
278 | rem
|
---|
279 | rem Instructions on what to do next.
|
---|
280 | rem
|
---|
281 | echo **************************************************************************
|
---|
282 | echo * First step is done.
|
---|
283 | echo *
|
---|
284 | echo * Created:
|
---|
285 | echo * %_MY_OPT_OUTDIR%\VBoxDrivers-%_MY_VER_REV%-amd64.cab
|
---|
286 | echo * %_MY_OPT_OUTDIR%\VBoxDrivers-%_MY_VER_REV%-x86.cab
|
---|
287 | echo *
|
---|
288 | echo * Next steps:
|
---|
289 | echo * 1. Submit the files to Microsoft for attestation signing.
|
---|
290 | echo * 2. Download the signed result.
|
---|
291 | echo * 3. "%_MY_NEXT_SCRIPT%" --signed-x86 {zip} --signed-amd64 {zip} %_MY_OPT_SCRIPT_SKIPEXTPACK_PARAM% %_MY_OPT_SCRIPT_ADDITIONAL_PARAMS%
|
---|
292 | goto end
|
---|
293 | :end_failed
|
---|
294 | @cd /d "%_MY_SAVED_CD%"
|
---|
295 | @endlocal
|
---|
296 | @endlocal
|
---|
297 | @echo * Failed!
|
---|
298 | @exit /b 1
|
---|
299 |
|
---|
300 | :end
|
---|
301 | @cd /d "%_MY_SAVED_CD%"
|
---|
302 | @endlocal
|
---|
303 | @endlocal
|
---|
304 |
|
---|