VirtualBox

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

Last change on this file since 82866 was 80819, checked in by vboxsync, 5 years ago

Installer/win: Hopefully last fixes (the copying was still done, and step 4 used the full path of the MSI file instead of just the filename), plus a bit of grammar.

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