VirtualBox

source: vbox/trunk/src/VBox/Installer/win/Scripts/Single-1-Prepare.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.1 KB
Line 
1@echo off
2rem $Id: Single-1-Prepare.cmd 96407 2022-08-22 17:43:14Z vboxsync $
3rem rem @file
4rem Windows NT batch script for preparing single build (either amd64 and x86) for signing submission.
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_ARCH=@KBUILD_TARGET_ARCH@
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" == ".-a" goto opt_a
65if ".%1" == ".--arch" goto opt_a
66if ".%1" == ".-e" goto opt_e
67if ".%1" == ".--extpack" goto opt_e
68if ".%1" == ".-o" goto opt_o
69if ".%1" == ".--outdir" goto opt_o
70if ".%1" == ".-s" goto opt_s
71if ".%1" == ".--extpack-enterprise" goto opt_s
72if ".%1" == ".-t" goto opt_t
73if ".%1" == ".--build-type" goto opt_t
74if ".%1" == ".-u" goto opt_u
75if ".%1" == ".--vboxall-untar-dir" goto opt_u
76echo syntax error: Unknown option: %1
77echo Try --help to list valid options.
78goto end_failed
79
80:argument_loop_next_with_value
81shift
82shift
83goto argument_loop
84
85:opt_a
86if ".%~2" == "." goto syntax_error_missing_value
87if not "%2" == "x86" if not "%2" == "amd64" goto syntax_error_unknown_arch
88set _MY_OPT_ARCH=%~2
89goto argument_loop_next_with_value
90
91:opt_e
92if ".%~2" == "." goto syntax_error_missing_value
93set _MY_OPT_EXTPACK=%~f2
94goto argument_loop_next_with_value
95
96:opt_h
97echo Toplevel single package: Prepare either x86 and amd64 for submission.
98echo .
99echo Usage: Single-1-Prepare.cmd [-o output-dir] [-e/--extpack puel.vbox-extpack]
100echo [-s/--extpack-enterprise puel-enterprise.vbox-extpack]
101echo [-u/--vboxall-dir unpacked-vboxall-dir] [-t build-type]
102echo [-a x86/amd64]
103echo .
104echo Default -a/--arch value: %_MY_OPT_ARCH%
105echo Default -e/--extpack value: %_MY_OPT_EXTPACK%
106echo Default -s/--extpack-enterprise value: %_MY_OPT_EXTPACK_ENTERPRISE%
107echo Default -u/--vboxall-untar-dir value: %_MY_OPT_UNTAR_DIR%
108echo Default -o/--outdir value: %_MY_OPT_OUTDIR%
109echo Default -t/--build-type value: %_MY_OPT_BUILD_TYPE%
110echo .
111goto end_failed
112
113:opt_o
114if ".%~2" == "." goto syntax_error_missing_value
115set _MY_OPT_OUTDIR=%~f2
116goto argument_loop_next_with_value
117
118:opt_s
119if ".%~2" == "." goto syntax_error_missing_value
120set _MY_OPT_EXTPACK_ENTERPRISE=%~f2
121goto argument_loop_next_with_value
122
123:opt_t
124if ".%~2" == "." goto syntax_error_missing_value
125set _MY_OPT_BUILD_TYPE=%~2
126goto argument_loop_next_with_value
127
128:opt_u
129if ".%~2" == "." goto syntax_error_missing_value
130set _MY_OPT_UNTAR_DIR=%~f2
131goto argument_loop_next_with_value
132
133
134:syntax_error_missing_value
135echo syntax error: missing or empty option value after %1
136goto end_failed
137
138:syntax_error_unknown_arch
139echo syntax error: Unknown architecture: %2
140goto end_failed
141
142
143:error_vboxall_untar_dir_not_found
144echo syntax error: The VBoxAll untar directory was not found: "%_MY_OPT_UNTAR_DIR%"
145goto end_failed
146
147:error_bindir_not_found
148echo syntax error: The bin directory was not found: "%_MY_BINDIR%"
149goto end_failed
150
151:error_repack_dir_not_found
152echo syntax error: The repack directory was not found: "%_MY_REPACK_DIR%"
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
164
165:no_more_arguments
166rem
167rem Validate and adjust specified options.
168rem
169
170if not exist "%_MY_OPT_UNTAR_DIR%" goto error_vboxall_untar_dir_not_found
171
172set _MY_BINDIR=%_MY_OPT_UNTAR_DIR%\bin
173if not exist "%_MY_BINDIR%" goto error_bindir_not_found
174
175set _MY_REPACK_DIR=%_MY_OPT_UNTAR_DIR%\repack
176if not exist "%_MY_REPACK_DIR%" goto error_repack_dir_not_found
177
178if not exist "%_MY_OPT_EXTPACK%" goto error_extpack_not_found
179if not ".%_MY_OPT_EXTPACK_ENTERPRISE%" == "." if not exist "%_MY_OPT_EXTPACK_ENTERPRISE%" goto error_enterprise_extpack_not_found
180
181
182rem Make sure the output dir exists.
183if not exist "%_MY_OPT_OUTDIR%" (mkdir "%_MY_OPT_OUTDIR%" || goto end_failed)
184
185rem
186rem Install the extpack in the bin directories.
187rem Note! Not really necessary, but whatever.
188rem
189echo on
190copy /y "%_MY_OPT_EXTPACK%" "%_MY_BINDIR%\Oracle_VM_VirtualBox_Extension_Pack.vbox-extpack" || goto end_failed
191@echo off
192
193rem
194rem Do the packing.
195rem
196echo **************************************************************************
197echo Packing drivers
198echo **************************************************************************
199cd /d "%_MY_REPACK_DIR%" || goto end_failed
200call "%_MY_REPACK_DIR%\PackDriversForSubmission.cmd" -b "%_MY_BINDIR%" -a %_MY_OPT_ARCH% -e "%_MY_OPT_EXTPACK%" ^
201 -o "%_MY_OPT_OUTDIR%\VBoxDrivers-%_MY_VER_REV%-%_MY_OPT_ARCH%.cab" || goto end_failed
202echo .
203cd /d "%_MY_SAVED_CD%"
204
205rem
206rem Generate script for taking the next step.
207rem
208set _MY_NEXT_SCRIPT=%_MY_OPT_OUTDIR%\Single-3-Repack.cmd
209rem If out dir is the same as repack dir this would erase original repack script
210if not exist "%_MY_NEXT_SCRIPT%" goto generate_next_script
211set _MY_NEXT_SCRIPT=%_MY_OPT_OUTDIR%\Single-3-Repack-Gen.cmd
212:generate_next_script
213echo cd /d "%cd%" > "%_MY_NEXT_SCRIPT%"
214echo call "%_MY_SCRIPT_DIR%\Single-3-Repack.cmd" --extpack "%_MY_OPT_EXTPACK%" ^
215 --extpack-enterprise "%_MY_OPT_EXTPACK_ENTERPRISE%" ^
216 --vboxall-untar-dir "%_MY_OPT_UNTAR_DIR%" ^
217 --outdir "%_MY_OPT_OUTDIR%" ^
218 --build-type "%_MY_OPT_BUILD_TYPE%" %%* >> "%_MY_NEXT_SCRIPT%"
219
220rem
221rem Instructions on what to do next.
222rem
223echo **************************************************************************
224echo * First step is done.
225echo *
226echo * Created:
227echo * %_MY_OPT_OUTDIR%\VBoxDrivers-%_MY_VER_REV%-%_MY_OPT_ARCH%.cab
228echo *
229echo * Next steps:
230echo * 1. Submit the files to Microsoft for attestation signing.
231echo * 2. Download the signed result.
232echo * 3. "%_MY_NEXT_SCRIPT%" --signed {zip}
233
234goto end
235
236
237:end_failed
238@cd /d "%_MY_SAVED_CD%"
239@endlocal
240@endlocal
241@echo * Failed!
242@exit /b 1
243
244:end
245@cd /d "%_MY_SAVED_CD%"
246@endlocal
247@endlocal
248
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