VirtualBox

source: vbox/trunk/src/VBox/Installer/win/Scripts/Single-1-Prepare.cmd@ 94237

Last change on this file since 94237 was 93115, checked in by vboxsync, 3 years ago

scm --update-copyright-year

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