VirtualBox

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

Last change on this file since 78264 was 77351, checked in by vboxsync, 6 years ago

Installer/win: Fix typos breaking the re-packing scripts. Include the target arch in the name of the MSM files (helps when copying them all to the output directory after repacking). Move most of the clean up out of the defines (where it needs eval) to normal OTHER_CLEAN. bugref:8691

  • Property svn:eol-style set to CRLF
  • Property svn:keywords set to Author Date Id Revision
File size: 11.1 KB
Line 
1@echo off
2rem $Id: Combined-3-Repack.cmd 77351 2019-02-18 18:46:41Z 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
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: Repack the installer and extpacks.
83echo .
84echo Usage: Combined-3-Repack.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 [--signed-amd64 signed-amd64.zip]
88echo [--signed-x86 signed-x86.zip]
89echo
90echo .
91echo Default -e/--extpack value: %_MY_OPT_EXTPACK%
92echo Default -s/--extpack-enterprise value: %_MY_OPT_EXTPACK_ENTERPRISE%
93echo Default -u/--vboxall-untar-dir value: %_MY_OPT_UNTAR_DIR%
94echo Default -o/--outdir value: %_MY_OPT_OUTDIR%
95echo Default -t/--build-type value: %_MY_OPT_BUILD_TYPE%
96echo .
97goto end_failed
98
99:opt_o
100if ".%~2" == "." goto syntax_error_missing_value
101set _MY_OPT_OUTDIR=%~f2
102goto argument_loop_next_with_value
103
104:opt_s
105if ".%~2" == "." goto syntax_error_missing_value
106set _MY_OPT_EXTPACK_ENTERPRISE=%~f2
107goto argument_loop_next_with_value
108
109:opt_signed_amd64
110if ".%~2" == "." goto syntax_error_missing_value
111set _MY_OPT_SIGNED_AMD64=%~f2
112goto argument_loop_next_with_value
113
114:opt_signed_x86
115if ".%~2" == "." goto syntax_error_missing_value
116set _MY_OPT_SIGNED_X86=%~f2
117goto argument_loop_next_with_value
118
119:opt_t
120if ".%~2" == "." goto syntax_error_missing_value
121set _MY_OPT_BUILD_TYPE=%~2
122goto argument_loop_next_with_value
123
124:opt_u
125if ".%~2" == "." goto syntax_error_missing_value
126set _MY_OPT_UNTAR_DIR=%~f2
127goto argument_loop_next_with_value
128
129
130:syntax_error_missing_value
131echo syntax error: missing or empty option value after %1
132goto end_failed
133
134
135:error_vboxall_untar_dir_not_found
136echo syntax error: The VBoxAll untar directory was not found: "%_MY_OPT_UNTAR_DIR%"
137goto end_failed
138
139:error_amd64_bindir_not_found
140echo syntax error: The AMD64 bin directory was not found: "%_MY_BINDIR_AMD64%"
141goto end_failed
142
143:error_x86_bindir_not_found
144echo syntax error: The AMD64 bin directory was not found: "%_MY_BINDIR_X86%"
145goto end_failed
146
147:error_amd64_repack_dir_not_found
148echo syntax error: The AMD64 bin directory was not found: "%_MY_REPACK_DIR_AMD64%"
149goto end_failed
150
151:error_x86_repack_dir_not_found
152echo syntax error: The AMD64 bin directory was not found: "%_MY_REPACK_DIR_X86%"
153goto end_failed
154
155:error_extpack_not_found
156echo syntax error: Specified extension pack not found: "%_MY_OPT_EXTPACK%"
157goto end_failed
158
159:error_enterprise_extpack_not_found
160echo syntax error: Specified enterprise extension pack not found: "%_MY_OPT_EXTPACK_ENTERPRISE%"
161goto end_failed
162
163:error_signed_amd64_not_found
164echo syntax error: Zip with signed AMD64 drivers not found: "%_MY_OPT_SIGNED_AMD64%"
165goto end_failed
166
167:error_signed_x86_not_found
168echo syntax error: Zip with signed X86 drivers not found: "%_MY_OPT_SIGNED_X86%"
169goto end_failed
170
171
172:no_more_arguments
173rem
174rem Validate and adjust specified options.
175rem
176
177if not exist "%_MY_OPT_UNTAR_DIR%" goto error_vboxall_untar_dir_not_found
178
179set _MY_BINDIR_AMD64=%_MY_OPT_UNTAR_DIR%\win.amd64\%_MY_OPT_BUILD_TYPE%\bin
180set _MY_BINDIR_X86=%_MY_OPT_UNTAR_DIR%\win.x86\%_MY_OPT_BUILD_TYPE%\bin
181if not exist "%_MY_BINDIR_AMD64%" goto error_amd64_bindir_not_found
182if not exist "%_MY_BINDIR_X86%" goto error_x86_bindir_not_found
183
184set _MY_REPACK_DIR_AMD64=%_MY_OPT_UNTAR_DIR%\win.amd64\%_MY_OPT_BUILD_TYPE%\repack
185set _MY_REPACK_DIR_X86=%_MY_OPT_UNTAR_DIR%\win.x86\%_MY_OPT_BUILD_TYPE%\repack
186if not exist "%_MY_REPACK_DIR_AMD64%" goto error_amd64_repack_dir_not_found
187if not exist "%_MY_REPACK_DIR_X86%" goto error_x86_repack_dir_not_found
188
189if not exist "%_MY_OPT_EXTPACK%" goto error_extpack_not_found
190if not ".%_MY_OPT_EXTPACK_ENTERPRISE%" == "." if not exist "%_MY_OPT_EXTPACK_ENTERPRISE%" goto error_enterprise_extpack_not_found
191
192if not exist "%_MY_OPT_SIGNED_AMD64%" goto error_signed_amd64_not_found
193if not exist "%_MY_OPT_SIGNED_X86%" goto error_signed_x86_not_found
194
195rem Make sure the output dir exists.
196if not exist "%_MY_OPT_OUTDIR%" (mkdir "%_MY_OPT_OUTDIR%" || goto end_failed)
197
198rem
199rem Unpacking the two driver zips.
200rem
201echo **************************************************************************
202echo * AMD64: Unpacking signed drivers...
203echo **************************************************************************
204cd /d "%_MY_REPACK_DIR_AMD64%" || goto end_failed
205call "%_MY_REPACK_DIR_AMD64%\UnpackBlessedDrivers.cmd" -b "%_MY_BINDIR_AMD64%" -i "%_MY_OPT_SIGNED_AMD64%" || goto end_failed
206echo .
207
208echo **************************************************************************
209echo * X86: Unpacking signed drivers...
210echo **************************************************************************
211cd /d "%_MY_REPACK_DIR_X86%" || goto end_failed
212call "%_MY_REPACK_DIR_X86%\UnpackBlessedDrivers.cmd" -b "%_MY_BINDIR_X86%" -i "%_MY_OPT_SIGNED_X86%" || goto end_failed
213echo .
214
215
216rem
217rem Do the AMD64 work.
218rem
219echo **************************************************************************
220echo * AMD64: Repackaging installers
221echo **************************************************************************
222echo * AMD64: Compiling WIX...
223cd /d "%_MY_REPACK_DIR_AMD64%" || goto end_failed
224for %%i in (1-*.cmd) do (call %%i || goto end_failed)
225echo .
226
227echo * AMD64: Linking WIX...
228for %%i in (2-*.cmd) do (call %%i || goto end_failed)
229echo .
230
231echo * AMD64: Applying language patches to MSI...
232for %%i in (3-*.cmd) do (call %%i || goto end_failed)
233echo .
234
235
236rem
237rem Do the X86 work.
238rem
239echo **************************************************************************
240echo * X86: Repackaging installers
241echo **************************************************************************
242echo * X86: Compiling WIX...
243cd /d "%_MY_REPACK_DIR_X86%" || goto end_failed
244for %%i in (1-*.cmd) do (call %%i || goto end_failed)
245echo .
246
247echo * X86: Linking WIX...
248for %%i in (2-*.cmd) do (call %%i || goto end_failed)
249echo .
250
251echo * X86: Applying language patches to MSI...
252for %%i in (3-*.cmd) do (call %%i || goto end_failed)
253echo .
254
255echo * X86: Creating multi arch installer...
256for %%i in (4-*.cmd) do (call %%i || goto end_failed)
257echo .
258
259set _MY_OUT_FILES=
260cd /d "%_MY_REPACK_DIR_AMD64%" || goto end_failed
261for %%i in (VBoxMerge*msm) do (
262 copy /y "%%i" "%_MY_OPT_OUTDIR%" || goto end_failed
263 call set _MY_OUT_FILES=%%_MY_OUT_FILES%% %%~nxi
264)
265cd /d "%_MY_REPACK_DIR_X86%" || goto end_failed
266for %%i in (VBoxMerge*msm) do (
267 copy /y "%%i" "%_MY_OPT_OUTDIR%" || goto end_failed
268 call set _MY_OUT_FILES=%%_MY_OUT_FILES%% %%~nxi
269)
270for %%i in (VirtualBox-*MultiArch*exe) do (
271 copy /y "%%i" "%_MY_OPT_OUTDIR%" || goto end_failed
272 call set _MY_OUT_FILES=%%_MY_OUT_FILES%% %%~nxi
273)
274
275
276rem
277rem Repack the extension packs.
278rem
279echo **************************************************************************
280echo * Repacking extension packs.
281echo **************************************************************************
282cd /d "%_MY_REPACK_DIR_X86%" || goto end_failed
283
284echo * Regular PUEL...
285set _MY_TMP_OUT=%_MY_OPT_EXTPACK%
286for %%i in (%_MY_TMP_OUT%) do (
287 set _MY_TMP_OUT=%_MY_OPT_OUTDIR%\%%~nxi
288 call set _MY_OUT_FILES=%%_MY_OUT_FILES%% %%~nxi
289)
290call "%_MY_REPACK_DIR_X86%\RepackExtPack.cmd" --bindir-amd64 "%_MY_BINDIR_AMD64%" --bindir-x86 "%_MY_BINDIR_X86%" ^
291 --input "%_MY_OPT_EXTPACK%" --output "%_MY_TMP_OUT%" || goto end_failed
292
293if ".%_MY_OPT_EXTPACK_ENTERPRISE%" == "." goto no_enterprise_repacking
294echo * Enterprise PUEL...
295set _MY_TMP_OUT=%_MY_OPT_EXTPACK_ENTERPRISE%
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_ENTERPRISE%" --output "%_MY_TMP_OUT%" || goto end_failed
302:no_enterprise_repacking
303@cd /d "%_MY_SAVED_CD%"
304
305rem
306rem That's that.
307rem
308echo **************************************************************************
309echo * The third and final step is done.
310echo *
311echo * Successfully created:
312for %%i in (%_MY_OUT_FILES%) do echo * "%_MY_OPT_OUTDIR%\%%i"
313goto end
314
315
316:end_failed
317@cd /d "%_MY_SAVED_CD%"
318@endlocal
319@endlocal
320@echo * Failed!
321@exit /b 1
322
323:end
324@cd /d "%_MY_SAVED_CD%"
325@endlocal
326@endlocal
327
328
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