VirtualBox

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

Last change on this file since 72050 was 72050, checked in by vboxsync, 7 years ago

Installer/win: Some repacking script fixes. bugref:8691

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