@echo off setlocal enabledelayedexpansion echo OpenSSL 3.5.0 Upgrade Utility :: Check if zip file is provided as command line argument if "%~1"=="" ( echo Error: Please specify the zip file as command line argument! echo Usage: %~nx0 ^ pause exit /b 1 ) set ZIP_FILE=%~1 :: Set temporary extraction directory set TEMP_DIR=temp_extract :: Check if zip file exists if not exist "%ZIP_FILE%" ( echo Error: %ZIP_FILE% not found! pause exit /b 1 ) :: Check if target directories exist if not exist ".\components" ( echo Error: .\components directory does not exist! pause exit /b 1 ) if not exist ".\vxworks-6.9" ( echo Error: .\vxworks-6.9 directory does not exist! pause exit /b 1 ) :: Create temporary extraction directory if exist "%TEMP_DIR%" rmdir /s /q "%TEMP_DIR%" mkdir "%TEMP_DIR%" :: Unzip the file echo Unzipping %ZIP_FILE%... powershell -command "Expand-Archive -Force '%ZIP_FILE%' '%TEMP_DIR%'" if errorlevel 1 ( echo Error: Failed to unzip file! rmdir /s /q "%TEMP_DIR%" pause exit /b 1 ) echo Unzip completed successfully. :: Copy components directory to .\components echo Copying files to .\components... if exist "%TEMP_DIR%\components" ( xcopy "%TEMP_DIR%\components\*" ".\components\" /E /I /Y /Q echo - Copied components from zip ) :: Copy vxworks-6.9 directory to .\vxworks-6.9 echo Copying files to .\vxworks-6.9... if exist "%TEMP_DIR%\vxworks-6.9" ( xcopy "%TEMP_DIR%\vxworks-6.9\*" ".\vxworks-6.9\" /E /I /Y /Q echo - Copied vxworks-6.9 from zip ) :: Clean up temporary directory rmdir /s /q "%TEMP_DIR%" :: Clean up Old OpenSSL version source files echo Removing old OpenSSL source trees... if exist ".\components\ip_net2-6.9\ipcrypto\include" ( rmdir /s /q ".\components\ip_net2-6.9\ipcrypto\include" ) if exist ".\components\ip_net2-6.9\ipcrypto\openssl-0_9_8" ( rmdir /s /q ".\components\ip_net2-6.9\ipcrypto\openssl-0_9_8" ) if exist ".\components\ip_net2-6.9\ipcrypto\openssl-1_0_2" ( rmdir /s /q ".\components\ip_net2-6.9\ipcrypto\openssl-1_0_2" ) if exist ".\components\ip_net2-6.9\ipcrypto\src" ( rmdir /s /q ".\components\ip_net2-6.9\ipcrypto\src" ) if exist ".\components\ip_net2-6.9\ipssl2\include" ( rmdir /s /q ".\components\ip_net2-6.9\ipssl2\include" ) if exist ".\components\ip_net2-6.9\ipssl2\openssl-0_9_8" ( rmdir /s /q ".\components\ip_net2-6.9\ipssl2\openssl-0_9_8" ) if exist ".\components\ip_net2-6.9\ipssl2\openssl-1_0_2" ( rmdir /s /q ".\components\ip_net2-6.9\ipssl2\openssl-1_0_2" ) if exist ".\components\ip_net2-6.9\ipssl2\src" ( rmdir /s /q ".\components\ip_net2-6.9\ipssl2\src" ) if exist ".\vxworks-6.9\target\h\openssl" ( rmdir /s /q ".\vxworks-6.9\target\h\openssl" ) echo Cleanup completed. echo. echo Upgrade completed successfully! pause