VirtualBox

source: vbox/trunk/src/VBox/Installer/win/Scripts/Combined-1-Prepare.cmd@ 106199

Last change on this file since 106199 was 106061, checked in by vboxsync, 3 months ago

Copyright year updates by scm.

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