VirtualBox

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

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