VirtualBox

source: vbox/trunk/src/VBox/Installer/win/Scripts/Single-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: 9.3 KB
Line 
1@echo off
2rem $Id: Single-3-Repack.cmd 104863 2024-06-06 14:29:21Z vboxsync $
3rem rem @file
4rem Windows NT batch script for repacking signed amd64 or 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=
52set _MY_OPT_NOEXTPACK=
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" == ".-n" goto opt_n
68if ".%1" == ".--no-extpack" goto opt_n
69if ".%1" == ".-o" goto opt_o
70if ".%1" == ".--outdir" goto opt_o
71if ".%1" == ".-s" goto opt_s
72if ".%1" == ".--extpack-enterprise" goto opt_s
73if ".%1" == ".--signed" goto opt_signed
74if ".%1" == ".-t" goto opt_t
75if ".%1" == ".--build-type" goto opt_t
76if ".%1" == ".-u" goto opt_u
77if ".%1" == ".--vboxall-untar-dir" goto opt_u
78echo syntax error: Unknown option: %1
79echo Try --help to list valid options.
80goto end_failed
81
82:argument_loop_next_with_value
83shift
84shift
85goto argument_loop
86
87:opt_e
88if ".%~2" == "." goto syntax_error_missing_value
89set _MY_OPT_EXTPACK=%~f2
90goto argument_loop_next_with_value
91
92:opt_h
93echo Toplevel combined package: Repack the installer and extpacks.
94echo .
95echo Usage: Combined-3-Repack.cmd [-o output-dir] [-e/--extpack puel.vbox-extpack]
96echo [-s/--extpack-enterprise puel-enterprise.vbox-extpack]
97echo [-u/--vboxall-dir unpacked-vboxall-dir] [-t build-type]
98echo [--signed signed.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_n
110set _MY_OPT_NOEXTPACK=1
111shift
112goto argument_loop
113
114:opt_o
115if ".%~2" == "." goto syntax_error_missing_value
116set _MY_OPT_OUTDIR=%~f2
117goto argument_loop_next_with_value
118
119:opt_s
120if ".%~2" == "." goto syntax_error_missing_value
121set _MY_OPT_EXTPACK_ENTERPRISE=%~f2
122goto argument_loop_next_with_value
123
124:opt_signed
125if ".%~2" == "." goto syntax_error_missing_value
126set _MY_OPT_SIGNED=%~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_bindir_not_found
150echo syntax error: The bin directory was not found: "%_MY_BINDIR%"
151goto end_failed
152
153:error_repack_dir_not_found
154echo syntax error: The repack directory was not found: "%_MY_REPACK_DIR%"
155goto end_failed
156
157:error_extpack_not_found
158echo syntax error: Specified extension pack not found: "%_MY_OPT_EXTPACK%"
159goto end_failed
160
161:error_enterprise_extpack_not_found
162echo syntax error: Specified enterprise extension pack not found: "%_MY_OPT_EXTPACK_ENTERPRISE%"
163goto end_failed
164
165:error_signed_not_found
166echo syntax error: Zip with signed drivers not found: "%_MY_OPT_SIGNED%"
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=%_MY_OPT_UNTAR_DIR%\bin
178if not exist "%_MY_BINDIR%" goto error_bindir_not_found
179
180set _MY_REPACK_DIR=%_MY_OPT_UNTAR_DIR%\repack
181if not exist "%_MY_REPACK_DIR%" goto error_repack_dir_not_found
182
183if ".%_MY_OPT_NOEXTPACK%" == ".1" goto no_enterprise_check
184if not exist "%_MY_OPT_EXTPACK%" goto error_extpack_not_found
185if not ".%_MY_OPT_EXTPACK_ENTERPRISE%" == "." if not exist "%_MY_OPT_EXTPACK_ENTERPRISE%" goto error_enterprise_extpack_not_found
186:no_enterprise_check
187
188if not exist "%_MY_OPT_SIGNED%" goto error_signed_not_found
189
190rem Make sure the output dir exists.
191if not exist "%_MY_OPT_OUTDIR%" (mkdir "%_MY_OPT_OUTDIR%" || goto end_failed)
192
193rem
194rem Unpacking the driver zip.
195rem
196echo **************************************************************************
197echo * Unpacking signed drivers...
198echo **************************************************************************
199cd /d "%_MY_REPACK_DIR%" || goto end_failed
200call "%_MY_REPACK_DIR%\UnpackBlessedDrivers.cmd" -n -b "%_MY_BINDIR%" -i "%_MY_OPT_SIGNED%" || goto end_failed
201echo .
202
203
204rem
205rem Do the work.
206rem
207echo **************************************************************************
208echo * Repackaging installers
209echo **************************************************************************
210echo * Compiling WIX...
211cd /d "%_MY_REPACK_DIR%" || goto end_failed
212for %%i in (1-*.cmd) do (call %%i || goto end_failed)
213echo .
214
215echo * Linking WIX...
216for %%i in (2-*.cmd) do (call %%i || goto end_failed)
217echo .
218
219echo * Applying language patches to MSI...
220for %%i in (3-*.cmd) do (call %%i || goto end_failed)
221echo .
222
223echo * Creating multi arch installer...
224for %%i in (4-*.cmd) do (call %%i || goto end_failed)
225echo .
226
227
228set _MY_OUT_FILES=
229cd /d "%_MY_REPACK_DIR%" || goto end_failed
230for %%i in (VBoxMerge*msm) do (
231 copy /y "%%i" "%_MY_OPT_OUTDIR%" || goto end_failed
232 call set _MY_OUT_FILES=%%_MY_OUT_FILES%% %%~nxi
233)
234for %%i in (VirtualBox-*MultiArch*exe) do (
235 copy /y "%%i" "%_MY_OPT_OUTDIR%" || goto end_failed
236 call set _MY_OUT_FILES=%%_MY_OUT_FILES%% %%~nxi
237)
238
239
240if ".%_MY_OPT_NOEXTPACK%" == ".1" goto no_enterprise_repacking
241rem
242rem Repack the extension packs.
243rem
244echo **************************************************************************
245echo * Repacking extension packs.
246echo **************************************************************************
247cd /d "%_MY_REPACK_DIR%" || goto end_failed
248
249echo * Regular PUEL...
250set _MY_TMP_OUT=%_MY_OPT_EXTPACK%
251for %%i in (%_MY_TMP_OUT%) do (
252 set _MY_TMP_OUT=%_MY_OPT_OUTDIR%\%%~nxi
253 call set _MY_OUT_FILES=%%_MY_OUT_FILES%% %%~nxi
254)
255call "%_MY_REPACK_DIR%\RepackExtPack.cmd" --bindir-amd64 "%_MY_BINDIR%" --bindir-x86 "%_MY_BINDIR%" ^
256 --input "%_MY_OPT_EXTPACK%" --output "%_MY_TMP_OUT%" || goto end_failed
257
258if ".%_MY_OPT_EXTPACK_ENTERPRISE%" == "." goto no_enterprise_repacking
259echo * Enterprise PUEL...
260set _MY_TMP_OUT=%_MY_OPT_EXTPACK_ENTERPRISE%
261for %%i in (%_MY_TMP_OUT%) do (
262 set _MY_TMP_OUT=%_MY_OPT_OUTDIR%\%%~nxi
263 call set _MY_OUT_FILES=%%_MY_OUT_FILES%% %%~nxi
264)
265call "%_MY_REPACK_DIR%\RepackExtPack.cmd" --bindir-amd64 "%_MY_BINDIR%" --bindir-x86 "%_MY_BINDIR%" ^
266 --input "%_MY_OPT_EXTPACK_ENTERPRISE%" --output "%_MY_TMP_OUT%" || goto end_failed
267:no_enterprise_repacking
268@cd /d "%_MY_SAVED_CD%"
269
270rem
271rem That's that.
272rem
273echo **************************************************************************
274echo * The third and final step is done.
275echo *
276echo * Successfully created:
277for %%i in (%_MY_OUT_FILES%) do echo * "%_MY_OPT_OUTDIR%\%%i"
278goto end
279
280
281:end_failed
282@cd /d "%_MY_SAVED_CD%"
283@endlocal
284@endlocal
285@echo * Failed!
286@exit /b 1
287
288:end
289@cd /d "%_MY_SAVED_CD%"
290@endlocal
291@endlocal
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