Update setup_win.bat

more copy error checking. remove trailing whitespace.
This commit is contained in:
gojimmypi
2022-03-29 12:52:50 -07:00
committed by GitHub
parent b203726623
commit d287863a35

View File

@ -4,7 +4,7 @@ REM Expect the script at /path/to/wolfssl/IDE/Espressif/ESP-IDF/
::******************************************************************************************************
::******************************************************************************************************
echo;
echo wolfSSL Windows Setup.
echo wolfSSL Windows Setup. Version 1.0a
echo;
echo This utility will copy a static snapshot of wolfSSL files to the ESP32-IDF component directory.
echo;
@ -145,6 +145,14 @@ if exist %WOLFSSLLIB_TRG_DIR% (
echo;
echo Removing %WOLFSSLLIB_TRG_DIR%
rmdir %WOLFSSLLIB_TRG_DIR% /S /Q
if exist %WOLFSSLLIB_TRG_DIR% (
echo;
echo ERROR: Failed to remove %WOLFSSLLIB_TRG_DIR%
echo;
echo Check permissions, open files, read-only attributes, etc.
echo;
GOTO :ERR
)
echo;
) else (
echo;
@ -173,38 +181,47 @@ if %errorlevel% NEQ 0 GOTO :COPYERR
echo;
echo Copying src\*.c files to %WOLFSSLLIB_TRG_DIR%\wolfcrypt\src
xcopy %BASEDIR%\wolfcrypt\src\*.c %WOLFSSLLIB_TRG_DIR%\wolfcrypt\src /S /E /Q /Y
if %errorlevel% NEQ 0 GOTO :COPYERR
echo;
echo Copying src\*.i files to %WOLFSSLLIB_TRG_DIR%\wolfcrypt\src
xcopy %BASEDIR%\wolfcrypt\src\*.i %WOLFSSLLIB_TRG_DIR%\wolfcrypt\src /S /E /Q /Y
if %errorlevel% NEQ 0 GOTO :COPYERR
echo;
echo Copying files to %WOLFSSLLIB_TRG_DIR%\wolfcrypt\src\port\
xcopy %BASEDIR%\wolfcrypt\src\port %WOLFSSLLIB_TRG_DIR%\wolfcrypt\src\port\ /S /E /Q /Y
if %errorlevel% NEQ 0 GOTO :COPYERR
echo;
echo Copying files to %WOLFSSLLIB_TRG_DIR%\wolfcrypt\test\
xcopy %BASEDIR%\wolfcrypt\test %WOLFSSLLIB_TRG_DIR%\wolfcrypt\test\ /S /E /Q /Y
if %errorlevel% NEQ 0 GOTO :COPYERR
rem Copy dummy test_paths.h to handle the case configure hasn't yet executed
echo F |xcopy %WOLFSSL_ESPIDFDIR%\dummy_test_paths.h %WOLFSSLLIB_TRG_DIR%\wolfcrypt\test\test_paths.h /S /E /Y
xcopy %WOLFSSL_ESPIDFDIR%\dummy_test_paths.h %WOLFSSLIB_TRG_DIR%\wolfcrypt\test\test_paths.h /S /E /Y
if %errorlevel% NEQ 0 GOTO :COPYERR
echo;
echo Copying files to %WOLFSSLLIB_TRG_DIR%\wolfcrypt\benchmark\
xcopy %BASEDIR%\wolfcrypt\benchmark %WOLFSSLLIB_TRG_DIR%\wolfcrypt\benchmark\ /S /E /Q /Y
if %errorlevel% NEQ 0 GOTO :COPYERR
echo;
echo Copying files to %WOLFSSLLIB_TRG_DIR%\wolfssl\
xcopy %BASEDIR%\wolfssl\*.h %WOLFSSLLIB_TRG_DIR%\wolfssl\ /S /E /Q /Y
if %errorlevel% NEQ 0 GOTO :COPYERR
echo;
echo Copying files to%WOLFSSLLIB_TRG_DIR%\wolfssl\openssl\
xcopy %BASEDIR%\wolfssl\openssl\*.h %WOLFSSLLIB_TRG_DIR%\wolfssl\openssl\ /S /E /Q /Y
if %errorlevel% NEQ 0 GOTO :COPYERR
echo;
echo Copying files to %WOLFSSLLIB_TRG_DIR%\wolfssl\wolfcrypt\
xcopy %BASEDIR%\wolfssl\wolfcrypt %WOLFSSLLIB_TRG_DIR%\wolfssl\wolfcrypt\ /S /E /Q /Y
if %errorlevel% NEQ 0 GOTO :COPYERR
::******************************************************************************************************
@ -214,10 +231,12 @@ xcopy %BASEDIR%\wolfssl\wolfcrypt %WOLFSSLLIB_TRG_DIR
echo;
echo Copying default user_settings.h to %WOLFSSLLIB_TRG_DIR%\include\
xcopy %WOLFSSL_ESPIDFDIR%\user_settings.h %WOLFSSLLIB_TRG_DIR%\include\ /F
if %errorlevel% NEQ 0 GOTO :COPYERR
:: echo Creating new config file: %WOLFSSLLIB_TRG_DIR%\include\config.h (default, may be overwritten by prior file)
echo new config > %WOLFSSLLIB_TRG_DIR%\include\config.h
xcopy %WOLFSSL_ESPIDFDIR%\dummy_config_h. %WOLFSSLLIB_TRG_DIR%\include\config.h /F /Y
if %errorlevel% NEQ 0 GOTO :COPYERR
:: Check if operator wants to keep prior config.h
@ -228,6 +247,7 @@ if EXIST config_h_%FileStamp%.bak (
choice /c YN /m "Use your prior config.h "
if errorlevel 2 GOTO :NO_CONFIG_RESTORE
xcopy config_h_%FileStamp%.bak %WOLFSSLLIB_TRG_DIR%\include\config.h /Y
if %errorlevel% NEQ 0 GOTO :COPYERR
) else (
echo;
@ -245,6 +265,7 @@ if EXIST user_settings_h_%FileStamp%.bak (
choice /c YN /m "User your prior user_settings.h "
if errorlevel 2 GOTO :NO_USER_SETTINGS_RESTORE
xcopy user_settings_h_%FileStamp%.bak %WOLFSSLLIB_TRG_DIR%\include\user_settings.h /Y
if %errorlevel% NEQ 0 GOTO :COPYERR
) else (
echo;
@ -260,28 +281,38 @@ if EXIST user_settings_h_%FileStamp%.bak (
echo;
echo Copying unit files to %WOLFSSLLIB_TRG_DIR%\test\
xcopy %WOLFSSL_ESPIDFDIR%\test %WOLFSSLLIB_TRG_DIR%\test\ /S /E /Q /Y
if %errorlevel% NEQ 0 GOTO :COPYERR
echo;
echo Copying CMakeLists.txt to %WOLFSSLLIB_TRG_DIR%\
xcopy %WOLFSSL_ESPIDFDIR%\libs\CMakeLists.txt %WOLFSSLLIB_TRG_DIR%\ /F
if %errorlevel% NEQ 0 GOTO :COPYERR
echo;
echo Copying component.mk to %WOLFSSLLIB_TRG_DIR%\
xcopy %WOLFSSL_ESPIDFDIR%\libs\component.mk %WOLFSSLLIB_TRG_DIR%\ /F
if %errorlevel% NEQ 0 GOTO :COPYERR
:: Benchmark program
echo;
echo Removing %WOLFSSLEXP_TRG_DIR%\wolfssl_benchmark\
rmdir %WOLFSSLEXP_TRG_DIR%\wolfssl_benchmark\ /S /Q
if %errorlevel% NEQ 0 GOTO :COPYERR
echo;
echo Copying %WOLFSSLEXP_TRG_DIR%\wolfssl_benchmark\main\
mkdir %WOLFSSLEXP_TRG_DIR%\wolfssl_benchmark\main\
xcopy %BASEDIR%\wolfcrypt\benchmark\benchmark.h %BASEDIR%\IDE\Espressif\ESP-IDF\examples\wolfssl_benchmark\main\benchmark.h /F /Y
if %errorlevel% NEQ 0 GOTO :COPYERR
xcopy %BASEDIR%\wolfcrypt\benchmark\benchmark.c %BASEDIR%\IDE\Espressif\ESP-IDF\examples\wolfssl_benchmark\main\benchmark.c /F /Y
if %errorlevel% NEQ 0 GOTO :COPYERR
xcopy %BASEDIR%\wolfcrypt\benchmark\benchmark.c %WOLFSSLEXP_TRG_DIR%\wolfssl_benchmark\main\ /F /Y
if %errorlevel% NEQ 0 GOTO :COPYERR
xcopy %WOLFSSL_ESPIDFDIR%\examples\wolfssl_benchmark %WOLFSSLEXP_TRG_DIR%\wolfssl_benchmark\ /Q /Y
if %errorlevel% NEQ 0 GOTO :COPYERR
:: Crypt Test program
echo;
@ -290,7 +321,10 @@ rmdir %WOLFSSLEXP_TRG_DIR%\wolfssl_test\ /S /Q
mkdir %WOLFSSLEXP_TRG_DIR%\wolfssl_test\main\
xcopy %BASEDIR%\wolfcrypt\test\test.c %WOLFSSLEXP_TRG_DIR%\wolfssl_test\main\ /S /E /Q /Y
if %errorlevel% NEQ 0 GOTO :COPYERR
xcopy %WOLFSSL_ESPIDFDIR%\examples\wolfssl_test %WOLFSSLEXP_TRG_DIR%\wolfssl_test\ /S /E /Q /Y
if %errorlevel% NEQ 0 GOTO :COPYERR
:: TLS Client program
echo;
@ -299,6 +333,7 @@ rmdir %WOLFSSLEXP_TRG_DIR%\wolfssl_client\ /S /Q
mkdir %WOLFSSLEXP_TRG_DIR%\wolfssl_client\main\
xcopy %WOLFSSL_ESPIDFDIR%\examples\wolfssl_client %WOLFSSLEXP_TRG_DIR%\wolfssl_client\ /S /E /Q /Y
if %errorlevel% NEQ 0 GOTO :COPYERR
:: TLS Server program
echo;
@ -307,6 +342,7 @@ rmdir %WOLFSSLEXP_TRG_DIR%\wolfssl_server\ /S /Q
mkdir %WOLFSSLEXP_TRG_DIR%\wolfssl_server\main\
xcopy %WOLFSSL_ESPIDFDIR%\examples\wolfssl_server %WOLFSSLEXP_TRG_DIR%\wolfssl_server\ /S /E /Q /Y
if %errorlevel% NEQ 0 GOTO :COPYERR
goto :DONE
@ -316,6 +352,8 @@ goto :DONE
::******************************************************************************************************
echo;
echo Error during copy.
echo
echo Please ensure none of the target files are flagged as read-only, open, etc.
goto :ERR
:: abort at user request