VirtualBox

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

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