VirtualBox

source: vbox/trunk/src/VBox/Installer/win/Scripts/Combined-3-Repack.cmd@ 82274

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

scm fix for copyright

  • Property svn:eol-style set to CRLF
  • Property svn:keywords set to Author Date Id Revision
File size: 10.6 KB
Line 
1@echo off
2rem $Id: Combined-3-Repack.cmd 82274 2019-11-28 19:20:19Z vboxsync $
3rem rem @file
4rem Windows NT batch script for repacking signed amd64 and x86 drivers.
5rem
6
7rem
8rem Copyright (C) 2018-2019 Oracle Corporation
9rem All rights reserved
10rem
11
12
13setlocal ENABLEEXTENSIONS
14setlocal
15
16rem
17rem Globals and checks for required enviornment variables.
18rem
19if ".%KBUILD_DEVTOOLS%" == "." (echo KBUILD_DEVTOOLS is not set & goto end_failed)
20if ".%KBUILD_BIN_PATH%" == "." (echo KBUILD_BIN_PATH is not set & goto end_failed)
21set _MY_SCRIPT_DIR=%~dp0
22set _MY_SAVED_CD=%CD%
23set _MY_VER_REV=@VBOX_VERSION_STRING@r@VBOX_SVN_REV@
24
25rem
26rem Parse arguments.
27rem
28set _MY_OPT_UNTAR_DIR=%_MY_SCRIPT_DIR%\..\..\..\
29for %%i in (%_MY_OPT_UNTAR_DIR%) do set _MY_OPT_UNTAR_DIR=%%~fi
30set _MY_OPT_EXTPACK=%_MY_OPT_UNTAR_DIR%\Oracle_VM_VirtualBox_Extension_Pack-%_MY_VER_REV%.vbox-extpack
31set _MY_OPT_EXTPACK_ENTERPRISE=%_MY_OPT_UNTAR_DIR%\Oracle_VM_VirtualBox_Extension_Pack-%_MY_VER_REV%-ENTERPRISE.vbox-extpack
32set _MY_OPT_BUILD_TYPE=@KBUILD_TYPE@
33set _MY_OPT_OUTDIR=%_MY_OPT_UNTAR_DIR%\output
34set _MY_OPT_SIGNED_AMD64=
35set _MY_OPT_SIGNED_X86=
36
37:argument_loop
38if ".%1" == "." goto no_more_arguments
39
40if ".%1" == ".-h" goto opt_h
41if ".%1" == ".-?" goto opt_h
42if ".%1" == "./h" goto opt_h
43if ".%1" == "./H" goto opt_h
44if ".%1" == "./?" goto opt_h
45if ".%1" == ".-help" goto opt_h
46if ".%1" == ".--help" goto opt_h
47
48if ".%1" == ".-e" goto opt_e
49if ".%1" == ".--extpack" goto opt_e
50if ".%1" == ".-o" goto opt_o
51if ".%1" == ".--outdir" goto opt_o
52if ".%1" == ".-s" goto opt_s
53if ".%1" == ".--extpack-enterprise" goto opt_s
54if ".%1" == ".--signed-amd64" goto opt_signed_amd64
55if ".%1" == ".--signed-x86" goto opt_signed_x86
56if ".%1" == ".-t" goto opt_t
57if ".%1" == ".--build-type" goto opt_t
58if ".%1" == ".-u" goto opt_u
59if ".%1" == ".--vboxall-untar-dir" goto opt_u
60echo syntax error: Unknown option: %1
61echo Try --help to list valid options.
62goto end_failed
63
64:argument_loop_next_with_value
65shift
66shift
67goto argument_loop
68
69:opt_e
70if ".%~2" == "." goto syntax_error_missing_value
71set _MY_OPT_EXTPACK=%~f2
72goto argument_loop_next_with_value
73
74:opt_h
75echo Toplevel combined package: Repack the installer and extpacks.
76echo .
77echo Usage: Combined-3-Repack.cmd [-o output-dir] [-e/--extpack puel.vbox-extpack]
78echo [-s/--extpack-enterprise puel-enterprise.vbox-extpack]
79echo [-u/--vboxall-dir unpacked-vboxall-dir] [-t build-type]
80echo [--signed-amd64 signed-amd64.zip]
81echo [--signed-x86 signed-x86.zip]
82echo
83echo .
84echo Default -e/--extpack value: %_MY_OPT_EXTPACK%
85echo Default -s/--extpack-enterprise value: %_MY_OPT_EXTPACK_ENTERPRISE%
86echo Default -u/--vboxall-untar-dir value: %_MY_OPT_UNTAR_DIR%
87echo Default -o/--outdir value: %_MY_OPT_OUTDIR%
88echo Default -t/--build-type value: %_MY_OPT_BUILD_TYPE%
89echo .
90goto end_failed
91
92:opt_o
93if ".%~2" == "." goto syntax_error_missing_value
94set _MY_OPT_OUTDIR=%~f2
95goto argument_loop_next_with_value
96
97:opt_s
98if ".%~2" == "." goto syntax_error_missing_value
99set _MY_OPT_EXTPACK_ENTERPRISE=%~f2
100goto argument_loop_next_with_value
101
102:opt_signed_amd64
103if ".%~2" == "." goto syntax_error_missing_value
104set _MY_OPT_SIGNED_AMD64=%~f2
105goto argument_loop_next_with_value
106
107:opt_signed_x86
108if ".%~2" == "." goto syntax_error_missing_value
109set _MY_OPT_SIGNED_X86=%~f2
110goto argument_loop_next_with_value
111
112:opt_t
113if ".%~2" == "." goto syntax_error_missing_value
114set _MY_OPT_BUILD_TYPE=%~2
115goto argument_loop_next_with_value
116
117:opt_u
118if ".%~2" == "." goto syntax_error_missing_value
119set _MY_OPT_UNTAR_DIR=%~f2
120goto argument_loop_next_with_value
121
122
123:syntax_error_missing_value
124echo syntax error: missing or empty option value after %1
125goto end_failed
126
127
128:error_vboxall_untar_dir_not_found
129echo syntax error: The VBoxAll untar directory was not found: "%_MY_OPT_UNTAR_DIR%"
130goto end_failed
131
132:error_amd64_bindir_not_found
133echo syntax error: The AMD64 bin directory was not found: "%_MY_BINDIR_AMD64%"
134goto end_failed
135
136:error_x86_bindir_not_found
137echo syntax error: The X86 bin directory was not found: "%_MY_BINDIR_X86%"
138goto end_failed
139
140:error_amd64_repack_dir_not_found
141echo syntax error: The AMD64 repack directory was not found: "%_MY_REPACK_DIR_AMD64%"
142goto end_failed
143
144:error_x86_repack_dir_not_found
145echo syntax error: The X86 repack directory was not found: "%_MY_REPACK_DIR_X86%"
146goto end_failed
147
148:error_extpack_not_found
149echo syntax error: Specified extension pack not found: "%_MY_OPT_EXTPACK%"
150goto end_failed
151
152:error_enterprise_extpack_not_found
153echo syntax error: Specified enterprise extension pack not found: "%_MY_OPT_EXTPACK_ENTERPRISE%"
154goto end_failed
155
156:error_signed_amd64_not_found
157echo syntax error: Zip with signed AMD64 drivers not found: "%_MY_OPT_SIGNED_AMD64%"
158goto end_failed
159
160:error_signed_x86_not_found
161echo syntax error: Zip with signed X86 drivers not found: "%_MY_OPT_SIGNED_X86%"
162goto end_failed
163
164
165:no_more_arguments
166rem
167rem Validate and adjust specified options.
168rem
169
170if not exist "%_MY_OPT_UNTAR_DIR%" goto error_vboxall_untar_dir_not_found
171
172set _MY_BINDIR_AMD64=%_MY_OPT_UNTAR_DIR%\win.amd64\%_MY_OPT_BUILD_TYPE%\bin
173set _MY_BINDIR_X86=%_MY_OPT_UNTAR_DIR%\win.x86\%_MY_OPT_BUILD_TYPE%\bin
174if not exist "%_MY_BINDIR_AMD64%" goto error_amd64_bindir_not_found
175if not exist "%_MY_BINDIR_X86%" goto error_x86_bindir_not_found
176
177set _MY_REPACK_DIR_AMD64=%_MY_OPT_UNTAR_DIR%\win.amd64\%_MY_OPT_BUILD_TYPE%\repack
178set _MY_REPACK_DIR_X86=%_MY_OPT_UNTAR_DIR%\win.x86\%_MY_OPT_BUILD_TYPE%\repack
179if not exist "%_MY_REPACK_DIR_AMD64%" goto error_amd64_repack_dir_not_found
180if not exist "%_MY_REPACK_DIR_X86%" goto error_x86_repack_dir_not_found
181
182if not exist "%_MY_OPT_EXTPACK%" goto error_extpack_not_found
183if not ".%_MY_OPT_EXTPACK_ENTERPRISE%" == "." if not exist "%_MY_OPT_EXTPACK_ENTERPRISE%" goto error_enterprise_extpack_not_found
184
185if not exist "%_MY_OPT_SIGNED_AMD64%" goto error_signed_amd64_not_found
186if not exist "%_MY_OPT_SIGNED_X86%" goto error_signed_x86_not_found
187
188rem Make sure the output dir exists.
189if not exist "%_MY_OPT_OUTDIR%" (mkdir "%_MY_OPT_OUTDIR%" || goto end_failed)
190
191rem
192rem Unpacking the two driver zips.
193rem
194echo **************************************************************************
195echo * AMD64: Unpacking signed drivers...
196echo **************************************************************************
197cd /d "%_MY_REPACK_DIR_AMD64%" || goto end_failed
198call "%_MY_REPACK_DIR_AMD64%\UnpackBlessedDrivers.cmd" -b "%_MY_BINDIR_AMD64%" -i "%_MY_OPT_SIGNED_AMD64%" || goto end_failed
199echo .
200
201echo **************************************************************************
202echo * X86: Unpacking signed drivers...
203echo **************************************************************************
204cd /d "%_MY_REPACK_DIR_X86%" || goto end_failed
205call "%_MY_REPACK_DIR_X86%\UnpackBlessedDrivers.cmd" -b "%_MY_BINDIR_X86%" -i "%_MY_OPT_SIGNED_X86%" || goto end_failed
206echo .
207
208
209rem
210rem Do the AMD64 work.
211rem
212echo **************************************************************************
213echo * AMD64: Repackaging installers
214echo **************************************************************************
215echo * AMD64: Compiling WIX...
216cd /d "%_MY_REPACK_DIR_AMD64%" || goto end_failed
217for %%i in (1-*.cmd) do (call %%i || goto end_failed)
218echo .
219
220echo * AMD64: Linking WIX...
221for %%i in (2-*.cmd) do (call %%i || goto end_failed)
222echo .
223
224echo * AMD64: Applying language patches to MSI...
225for %%i in (3-*.cmd) do (call %%i || goto end_failed)
226echo .
227
228
229rem
230rem Do the X86 work.
231rem
232echo **************************************************************************
233echo * X86: Repackaging installers
234echo **************************************************************************
235echo * X86: Compiling WIX...
236cd /d "%_MY_REPACK_DIR_X86%" || goto end_failed
237for %%i in (1-*.cmd) do (call %%i || goto end_failed)
238echo .
239
240echo * X86: Linking WIX...
241for %%i in (2-*.cmd) do (call %%i || goto end_failed)
242echo .
243
244echo * X86: Applying language patches to MSI...
245for %%i in (3-*.cmd) do (call %%i || goto end_failed)
246echo .
247
248echo * X86: Creating multi arch installer...
249for %%i in (4-*.cmd) do (call %%i || goto end_failed)
250echo .
251
252set _MY_OUT_FILES=
253cd /d "%_MY_REPACK_DIR_AMD64%" || goto end_failed
254for %%i in (VBoxMerge*msm) do (
255 copy /y "%%i" "%_MY_OPT_OUTDIR%" || goto end_failed
256 call set _MY_OUT_FILES=%%_MY_OUT_FILES%% %%~nxi
257)
258cd /d "%_MY_REPACK_DIR_X86%" || goto end_failed
259for %%i in (VBoxMerge*msm) do (
260 copy /y "%%i" "%_MY_OPT_OUTDIR%" || goto end_failed
261 call set _MY_OUT_FILES=%%_MY_OUT_FILES%% %%~nxi
262)
263for %%i in (VirtualBox-*MultiArch*exe) do (
264 copy /y "%%i" "%_MY_OPT_OUTDIR%" || goto end_failed
265 call set _MY_OUT_FILES=%%_MY_OUT_FILES%% %%~nxi
266)
267
268
269rem
270rem Repack the extension packs.
271rem
272echo **************************************************************************
273echo * Repacking extension packs.
274echo **************************************************************************
275cd /d "%_MY_REPACK_DIR_X86%" || goto end_failed
276
277echo * Regular PUEL...
278set _MY_TMP_OUT=%_MY_OPT_EXTPACK%
279for %%i in (%_MY_TMP_OUT%) do (
280 set _MY_TMP_OUT=%_MY_OPT_OUTDIR%\%%~nxi
281 call set _MY_OUT_FILES=%%_MY_OUT_FILES%% %%~nxi
282)
283call "%_MY_REPACK_DIR_X86%\RepackExtPack.cmd" --bindir-amd64 "%_MY_BINDIR_AMD64%" --bindir-x86 "%_MY_BINDIR_X86%" ^
284 --input "%_MY_OPT_EXTPACK%" --output "%_MY_TMP_OUT%" || goto end_failed
285
286if ".%_MY_OPT_EXTPACK_ENTERPRISE%" == "." goto no_enterprise_repacking
287echo * Enterprise PUEL...
288set _MY_TMP_OUT=%_MY_OPT_EXTPACK_ENTERPRISE%
289for %%i in (%_MY_TMP_OUT%) do (
290 set _MY_TMP_OUT=%_MY_OPT_OUTDIR%\%%~nxi
291 call set _MY_OUT_FILES=%%_MY_OUT_FILES%% %%~nxi
292)
293call "%_MY_REPACK_DIR_X86%\RepackExtPack.cmd" --bindir-amd64 "%_MY_BINDIR_AMD64%" --bindir-x86 "%_MY_BINDIR_X86%" ^
294 --input "%_MY_OPT_EXTPACK_ENTERPRISE%" --output "%_MY_TMP_OUT%" || goto end_failed
295:no_enterprise_repacking
296@cd /d "%_MY_SAVED_CD%"
297
298rem
299rem That's that.
300rem
301echo **************************************************************************
302echo * The third and final step is done.
303echo *
304echo * Successfully created:
305for %%i in (%_MY_OUT_FILES%) do echo * "%_MY_OPT_OUTDIR%\%%i"
306goto end
307
308
309:end_failed
310@cd /d "%_MY_SAVED_CD%"
311@endlocal
312@endlocal
313@echo * Failed!
314@exit /b 1
315
316:end
317@cd /d "%_MY_SAVED_CD%"
318@endlocal
319@endlocal
320
321
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette