Skip to content

Commit cf17e63

Browse files
stephanosionashif
authored andcommitted
scripts: Add Windows setup script template
This commit adds a setup script template for the Windows host operating system to be distributed as a part of the Zephyr SDK distribution bundle archive. This setup script can be executed by the user to configure the Zephyr SDK on their local system. Signed-off-by: Stephanos Ioannidis <[email protected]>
1 parent ea0e096 commit cf17e63

File tree

1 file changed

+109
-0
lines changed

1 file changed

+109
-0
lines changed

scripts/template_setup_win

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
@echo off
2+
3+
REM # Automated setup script for Zephyr SDK distribution bundle archive
4+
REM # for Windows host operating system
5+
6+
pushd %~dp0
7+
setlocal ENABLEDELAYEDEXPANSION
8+
set EXITCODE=0
9+
10+
REM # Read bundle version from file
11+
set /p VERSION=<sdk_version
12+
13+
REM # Print banner
14+
echo Zephyr SDK %VERSION% Setup
15+
echo.
16+
17+
REM # Enable interactive mode if no argument is specified
18+
if [%1] equ [] (
19+
set INTERACTIVE=y
20+
)
21+
22+
REM # Check dependencies
23+
where cmake > nul 2>&1
24+
if [%ERRORLEVEL%] neq [0] (
25+
echo Zephyr SDK setup requires CMake to be installed and available in the PATH.
26+
echo Please install CMake and run this script again.
27+
28+
set EXITCODE=90
29+
goto end
30+
)
31+
32+
REM # Enter interactive mode if enabled
33+
if [%INTERACTIVE%] neq [] (
34+
goto interactive
35+
)
36+
37+
REM # Parse arguments if specified
38+
:parsearg
39+
if /i [%1] equ [/c] (
40+
set DO_CMAKE_PKG=y
41+
) else if /i [%1] equ [/t] (
42+
set DO_HOSTTOOLS=y
43+
) else (
44+
goto usage
45+
)
46+
47+
shift
48+
if [%1] neq [] (
49+
goto parsearg
50+
)
51+
52+
goto process
53+
54+
:interactive
55+
REM # Print interactive mode informational message
56+
echo ** NOTE **
57+
echo You only need to run this script once after extracting the Zephyr SDK
58+
echo distribution bundle archive.
59+
echo.
60+
61+
REM # Ask user for set-up choices
62+
choice /c:yn /m:"Register Zephyr SDK CMake package"
63+
if [%ERRORLEVEL%] equ [1] set DO_CMAKE_PKG=y
64+
65+
choice /c:yn /m:"Install host tools"
66+
if [%ERRORLEVEL%] equ [1] set DO_HOSTTOOLS=y
67+
68+
echo.
69+
70+
:process
71+
REM # Register Zephyr SDK CMake package
72+
if [%DO_CMAKE_PKG%] neq [] (
73+
echo Registering Zephyr SDK CMake package ...
74+
cmake -P cmake\zephyr_sdk_export.cmake
75+
echo.
76+
)
77+
78+
REM # Install host tools
79+
if [%DO_HOSTTOOLS%] neq [] (
80+
echo Installing host tools ...
81+
echo SKIPPED: Windows host tools are not available yet.
82+
echo.
83+
)
84+
85+
echo All done.
86+
goto end
87+
88+
REM # Print scripting mode usage
89+
:usage
90+
echo %~n0 [/c] [/t]
91+
echo.
92+
echo /c Register Zephyr SDK CMake package
93+
echo /t Install host tools
94+
echo.
95+
echo When no arguments are specified, the setup script runs in the interactive
96+
echo mode asking for user inputs.
97+
98+
set EXITCODE=1
99+
100+
:end
101+
if [%INTERACTIVE%] neq [] (
102+
echo.
103+
echo Press any key to exit ...
104+
pause > nul
105+
)
106+
107+
popd
108+
109+
exit /b %EXITCODE%

0 commit comments

Comments
 (0)