VirtualBox

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

Last change on this file since 97405 was 96407, checked in by vboxsync, 2 years ago

scm copyright and license note update

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