VirtualBox

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

Last change on this file since 106031 was 104863, checked in by vboxsync, 6 months ago

Config.kmk, ExtPacks/Puel, Installer/win, ValidationKit, tools/bin: bugref:10690: Rebranding ExtPack; No webtools, they will go as separate commit.

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