1 | @echo off
|
---|
2 | rem $Id: Combined-1-Prepare.cmd 72056 2018-04-27 11:38:50Z 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 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 |
|
---|
32 | rem
|
---|
33 | rem Parse arguments.
|
---|
34 | rem
|
---|
35 | set _MY_OPT_UNTAR_DIR=%_MY_SCRIPT_DIR%\..\..\..\
|
---|
36 | for %%i in (%_MY_OPT_UNTAR_DIR%) do set _MY_OPT_UNTAR_DIR=%%~fi
|
---|
37 | set _MY_OPT_EXTPACK=%_MY_OPT_UNTAR_DIR%\Oracle_VM_VirtualBox_Extension_Pack-%_MY_VER_REV%.vbox-extpack
|
---|
38 | set _MY_OPT_EXTPACK_ENTERPRISE=%_MY_OPT_UNTAR_DIR%\Oracle_VM_VirtualBox_Extension_Pack-%_MY_VER_REV%-ENTERPRISE.vbox-extpack
|
---|
39 | set _MY_OPT_BUILD_TYPE=@KBUILD_TYPE@
|
---|
40 | set _MY_OPT_OUTDIR=%_MY_OPT_UNTAR_DIR%\output
|
---|
41 |
|
---|
42 | :argument_loop
|
---|
43 | if ".%1" == "." goto no_more_arguments
|
---|
44 |
|
---|
45 | if ".%1" == ".-h" goto opt_h
|
---|
46 | if ".%1" == ".-?" goto opt_h
|
---|
47 | if ".%1" == "./h" goto opt_h
|
---|
48 | if ".%1" == "./H" goto opt_h
|
---|
49 | if ".%1" == "./?" goto opt_h
|
---|
50 | if ".%1" == ".-help" goto opt_h
|
---|
51 | if ".%1" == ".--help" goto opt_h
|
---|
52 |
|
---|
53 | if ".%1" == ".-e" goto opt_e
|
---|
54 | if ".%1" == ".--extpack" goto opt_e
|
---|
55 | if ".%1" == ".-o" goto opt_o
|
---|
56 | if ".%1" == ".--outdir" goto opt_o
|
---|
57 | if ".%1" == ".-s" goto opt_s
|
---|
58 | if ".%1" == ".--extpack-enterprise" goto opt_s
|
---|
59 | if ".%1" == ".-t" goto opt_t
|
---|
60 | if ".%1" == ".--build-type" goto opt_t
|
---|
61 | if ".%1" == ".-u" goto opt_u
|
---|
62 | if ".%1" == ".--vboxall-untar-dir" goto opt_u
|
---|
63 | echo syntax error: Unknown option: %1
|
---|
64 | echo Try --help to list valid options.
|
---|
65 | goto end_failed
|
---|
66 |
|
---|
67 | :argument_loop_next_with_value
|
---|
68 | shift
|
---|
69 | shift
|
---|
70 | goto argument_loop
|
---|
71 |
|
---|
72 | :opt_e
|
---|
73 | if ".%~2" == "." goto syntax_error_missing_value
|
---|
74 | set _MY_OPT_EXTPACK=%~f2
|
---|
75 | goto argument_loop_next_with_value
|
---|
76 |
|
---|
77 | :opt_h
|
---|
78 | echo Toplevel combined package: Prepare both x86 and amd64 for submission.
|
---|
79 | echo .
|
---|
80 | echo Usage: Combined-1-Prepare.cmd [-o output-dir] [-e/--extpack puel.vbox-extpack]
|
---|
81 | echo [-s/--extpack-enterprise puel-enterprise.vbox-extpack]
|
---|
82 | echo [-u/--vboxall-dir unpacked-vboxall-dir] [-t build-type]
|
---|
83 | echo .
|
---|
84 | echo Default -e/--extpack value: %_MY_OPT_EXTPACK%
|
---|
85 | echo Default -s/--extpack-enterprise value: %_MY_OPT_EXTPACK_ENTERPRISE%
|
---|
86 | echo Default -u/--vboxall-untar-dir value: %_MY_OPT_UNTAR_DIR%
|
---|
87 | echo Default -o/--outdir value: %_MY_OPT_OUTDIR%
|
---|
88 | echo Default -t/--build-type value: %_MY_OPT_BUILD_TYPE%
|
---|
89 | echo .
|
---|
90 | goto end_failed
|
---|
91 |
|
---|
92 | :opt_o
|
---|
93 | if ".%~2" == "." goto syntax_error_missing_value
|
---|
94 | set _MY_OPT_OUTDIR=%~f2
|
---|
95 | goto argument_loop_next_with_value
|
---|
96 |
|
---|
97 | :opt_s
|
---|
98 | if ".%~2" == "." goto syntax_error_missing_value
|
---|
99 | set _MY_OPT_EXTPACK_ENTERPRISE=%~f2
|
---|
100 | goto argument_loop_next_with_value
|
---|
101 |
|
---|
102 | :opt_t
|
---|
103 | if ".%~2" == "." goto syntax_error_missing_value
|
---|
104 | set _MY_OPT_BUILD_TYPE=%~2
|
---|
105 | goto argument_loop_next_with_value
|
---|
106 |
|
---|
107 | :opt_u
|
---|
108 | if ".%~2" == "." goto syntax_error_missing_value
|
---|
109 | set _MY_OPT_UNTAR_DIR=%~f2
|
---|
110 | goto argument_loop_next_with_value
|
---|
111 |
|
---|
112 |
|
---|
113 | :syntax_error_missing_value
|
---|
114 | echo syntax error: missing or empty option value after %1
|
---|
115 | goto end_failed
|
---|
116 |
|
---|
117 |
|
---|
118 | :error_vboxall_untar_dir_not_found
|
---|
119 | echo syntax error: The VBoxAll untar directory was not found: "%_MY_OPT_UNTAR_DIR%"
|
---|
120 | goto end_failed
|
---|
121 |
|
---|
122 | :error_amd64_bindir_not_found
|
---|
123 | echo syntax error: The AMD64 bin directory was not found: "%_MY_BINDIR_AMD64%"
|
---|
124 | goto end_failed
|
---|
125 |
|
---|
126 | :error_x86_bindir_not_found
|
---|
127 | echo syntax error: The AMD64 bin directory was not found: "%_MY_BINDIR_X86%"
|
---|
128 | goto end_failed
|
---|
129 |
|
---|
130 | :error_amd64_repack_dir_not_found
|
---|
131 | echo syntax error: The AMD64 bin directory was not found: "%_MY_REPACK_DIR_AMD64%"
|
---|
132 | goto end_failed
|
---|
133 |
|
---|
134 | :error_x86_repack_dir_not_found
|
---|
135 | echo syntax error: The AMD64 bin directory was not found: "%_MY_REPACK_DIR_X86%"
|
---|
136 | goto end_failed
|
---|
137 |
|
---|
138 | :error_extpack_not_found
|
---|
139 | echo syntax error: Specified extension pack not found: "%_MY_OPT_EXTPACK%"
|
---|
140 | goto end_failed
|
---|
141 |
|
---|
142 | :error_enterprise_extpack_not_found
|
---|
143 | echo syntax error: Specified enterprise extension pack not found: "%_MY_OPT_EXTPACK_ENTERPRISE%"
|
---|
144 | goto end_failed
|
---|
145 |
|
---|
146 |
|
---|
147 |
|
---|
148 | :no_more_arguments
|
---|
149 | rem
|
---|
150 | rem Validate and adjust specified options.
|
---|
151 | rem
|
---|
152 |
|
---|
153 | if not exist "%_MY_OPT_UNTAR_DIR%" goto error_vboxall_untar_dir_not_found
|
---|
154 |
|
---|
155 | set _MY_BINDIR_AMD64=%_MY_OPT_UNTAR_DIR%\win.amd64\%_MY_OPT_BUILD_TYPE%\bin
|
---|
156 | set _MY_BINDIR_X86=%_MY_OPT_UNTAR_DIR%\win.x86\%_MY_OPT_BUILD_TYPE%\bin
|
---|
157 | if not exist "%_MY_BINDIR_AMD64%" goto error_amd64_bindir_not_found
|
---|
158 | if not exist "%_MY_BINDIR_X86%" goto error_x86_bindir_not_found
|
---|
159 |
|
---|
160 | set _MY_REPACK_DIR_AMD64=%_MY_OPT_UNTAR_DIR%\win.amd64\%_MY_OPT_BUILD_TYPE%\repack
|
---|
161 | set _MY_REPACK_DIR_X86=%_MY_OPT_UNTAR_DIR%\win.x86\%_MY_OPT_BUILD_TYPE%\repack
|
---|
162 | if not exist "%_MY_REPACK_DIR_AMD64%" goto error_amd64_repack_dir_not_found
|
---|
163 | if not exist "%_MY_REPACK_DIR_X86%" goto error_x86_repack_dir_not_found
|
---|
164 |
|
---|
165 | if not exist "%_MY_OPT_EXTPACK%" goto error_extpack_not_found
|
---|
166 | if not ".%_MY_OPT_EXTPACK_ENTERPRISE%" == "." if not exist "%_MY_OPT_EXTPACK_ENTERPRISE%" goto error_enterprise_extpack_not_found
|
---|
167 |
|
---|
168 |
|
---|
169 | rem Make sure the output dir exists.
|
---|
170 | if not exist "%_MY_OPT_OUTDIR%" (mkdir "%_MY_OPT_OUTDIR%" || goto end_failed)
|
---|
171 |
|
---|
172 | rem
|
---|
173 | rem Install the extpack in the bin directories.
|
---|
174 | rem Note! Not really necessary, but whatever.
|
---|
175 | rem
|
---|
176 | echo on
|
---|
177 | copy /y "%_MY_OPT_EXTPACK%" "%_MY_BINDIR_AMD64%\Oracle_VM_VirtualBox_Extension_Pack.vbox-extpack" || goto end_failed
|
---|
178 | copy /y "%_MY_OPT_EXTPACK%" "%_MY_BINDIR_X86%\Oracle_VM_VirtualBox_Extension_Pack.vbox-extpack" || goto end_failed
|
---|
179 | @echo off
|
---|
180 |
|
---|
181 | rem
|
---|
182 | rem Do the packing.
|
---|
183 | rem
|
---|
184 | @echo **************************************************************************
|
---|
185 | @echo Packing AMD64 drivers
|
---|
186 | @echo **************************************************************************
|
---|
187 | cd /d "%_MY_REPACK_DIR_AMD64%" || goto end_failed
|
---|
188 | call "%_MY_REPACK_DIR_AMD64%\PackDriversForSubmission.cmd" -b "%_MY_BINDIR_AMD64%" -a amd64 -e "%_MY_OPT_EXTPACK%" ^
|
---|
189 | -o "%_MY_OPT_OUTDIR%\VBoxDrivers-%_MY_VER_REV%-amd64.cab" || goto end_failed
|
---|
190 | @echo .
|
---|
191 | @echo **************************************************************************
|
---|
192 | @echo Packing X86 drivers
|
---|
193 | @echo **************************************************************************
|
---|
194 | cd /d "%_MY_REPACK_DIR_X86%" || goto end_failed
|
---|
195 | call "%_MY_REPACK_DIR_X86%\PackDriversForSubmission.cmd" -b "%_MY_BINDIR_X86%" -a x86 -e "%_MY_OPT_EXTPACK%" ^
|
---|
196 | -o "%_MY_OPT_OUTDIR%\VBoxDrivers-%_MY_VER_REV%-x86.cab" || goto end_failed
|
---|
197 | @echo off
|
---|
198 | echo .
|
---|
199 | cd /d "%_MY_SAVED_CD%"
|
---|
200 |
|
---|
201 | rem
|
---|
202 | rem Generate script for taking the next step.
|
---|
203 | rem
|
---|
204 | set _MY_NEXT_SCRIPT=%_MY_OPT_OUTDIR%\Combined-3-Repack.cmd
|
---|
205 | echo cd /d "%cd%" > "%_MY_NEXT_SCRIPT%"
|
---|
206 | echo call "%_MY_SCRIPT_DIR%\Combined-3-Repack.cmd" --extpack "%_MY_OPT_EXTPACK%" ^
|
---|
207 | --extpack-enterprise "%_MY_OPT_EXTPACK_ENTERPRISE%" ^
|
---|
208 | --vboxall-untar-dir "%_MY_OPT_UNTAR_DIR%" ^
|
---|
209 | --outdir "%_MY_OPT_OUTDIR%" ^
|
---|
210 | --build-type "%_MY_OPT_BUILD_TYPE%" %%* >> "%_MY_NEXT_SCRIPT%"
|
---|
211 |
|
---|
212 | rem
|
---|
213 | rem Instructions on what to do next.
|
---|
214 | rem
|
---|
215 | echo **************************************************************************
|
---|
216 | echo * First step is done.
|
---|
217 | echo *
|
---|
218 | echo * Created:
|
---|
219 | echo * %_MY_OPT_OUTDIR%\VBoxDrivers-%_MY_VER_REV%-amd64.cab
|
---|
220 | echo * %_MY_OPT_OUTDIR%\VBoxDrivers-%_MY_VER_REV%-x86.cab
|
---|
221 | echo *
|
---|
222 | echo * Next steps:
|
---|
223 | echo * 1. Sign the two files using the Oracle EV certificate.
|
---|
224 | echo * 2. Submit the signed files to Microsoft for attestation signing.
|
---|
225 | echo * 3. Download the signed result.
|
---|
226 | echo * 4. "%_MY_NEXT_SCRIPT%" --signed-x86 {zip} --signed-amd64 {zip}
|
---|
227 |
|
---|
228 | goto end
|
---|
229 |
|
---|
230 |
|
---|
231 | :end_failed
|
---|
232 | @cd /d "%_MY_SAVED_CD%"
|
---|
233 | @endlocal
|
---|
234 | @endlocal
|
---|
235 | @echo * Failed!
|
---|
236 | @exit /b 1
|
---|
237 |
|
---|
238 | :end
|
---|
239 | @cd /d "%_MY_SAVED_CD%"
|
---|
240 | @endlocal
|
---|
241 | @endlocal
|
---|
242 |
|
---|