agent start fix

This commit is contained in:
Frank Harris 2026-06-07 17:21:32 -05:00
parent 6a15b114e6
commit f2dbfe5e4e
10 changed files with 110 additions and 62 deletions

View file

@ -7,33 +7,63 @@ if not "%errorLevel%" == "0" (
echo Failure: current permissions are inadequate.
echo.
echo Run this script with "Run as administrator".
pause
call :pause_on_error
exit /b 1
)
set "WD=%~dp0"
pushd "%WD%" >nul 2>&1
set "CYGWIN_ROOT=%WD%"
if not exist "%CYGWIN_ROOT%OGP\ogp_agent.pl" (
if exist "%WD%..\OGP\ogp_agent.pl" (
for %%I in ("%WD%..") do set "CYGWIN_ROOT=%%~fI\"
)
)
set "BASH_EXE="
if exist "%CYGWIN_ROOT%bin\bash.exe" set "BASH_EXE=%CYGWIN_ROOT%bin\bash.exe"
if not defined BASH_EXE if exist "C:\cygwin64\bin\bash.exe" set "BASH_EXE=C:\cygwin64\bin\bash.exe"
if not defined BASH_EXE if exist "C:\cygwin\bin\bash.exe" set "BASH_EXE=C:\cygwin\bin\bash.exe"
set "CYGWIN_ROOT="
if exist "%WD%bin\bash.exe" (
set "BASH_EXE=%WD%bin\bash.exe"
set "CYGWIN_ROOT=%WD%"
)
if not defined BASH_EXE if exist "%WD%..\bin\bash.exe" (
set "BASH_EXE=%WD%..\bin\bash.exe"
for %%I in ("%WD%..") do set "CYGWIN_ROOT=%%~fI\"
)
if not defined BASH_EXE if exist "%WD%..\..\bin\bash.exe" (
set "BASH_EXE=%WD%..\..\bin\bash.exe"
for %%I in ("%WD%..\..") do set "CYGWIN_ROOT=%%~fI\"
)
if not defined BASH_EXE if exist "C:\OGP64\bin\bash.exe" (
set "BASH_EXE=C:\OGP64\bin\bash.exe"
set "CYGWIN_ROOT=C:\OGP64\"
)
if not defined BASH_EXE if exist "C:\cygwin64\bin\bash.exe" (
set "BASH_EXE=C:\cygwin64\bin\bash.exe"
set "CYGWIN_ROOT=C:\cygwin64\"
)
if not defined BASH_EXE if exist "C:\cygwin\bin\bash.exe" (
set "BASH_EXE=C:\cygwin\bin\bash.exe"
set "CYGWIN_ROOT=C:\cygwin\"
)
if not defined BASH_EXE (
echo Failure: Cygwin bash.exe was not found.
echo.
echo Checked:
echo %CYGWIN_ROOT%bin\bash.exe
echo %WD%bin\bash.exe
echo %WD%..\bin\bash.exe
echo %WD%..\..\bin\bash.exe
echo C:\OGP64\bin\bash.exe
echo C:\cygwin64\bin\bash.exe
echo C:\cygwin\bin\bash.exe
pause
call :pause_on_error
exit /b 1
)
if not exist "%CYGWIN_ROOT%OGP\ogp_agent.pl" (
echo Failure: OGP agent root was not found for detected Cygwin root.
echo.
echo Detected Cygwin root:
echo %CYGWIN_ROOT%
echo Expected agent file:
echo %CYGWIN_ROOT%OGP\ogp_agent.pl
call :pause_on_error
exit /b 1
)
@ -49,7 +79,7 @@ if not exist "%CYGWIN_ROOT%Install\agent_start_cygwin.sh" if not exist "%CYGWIN_
echo Expected one of:
echo %CYGWIN_ROOT%Install\agent_start_cygwin.sh
echo %CYGWIN_ROOT%OGP\Install\agent_start_cygwin.sh
pause
call :pause_on_error
exit /b 1
)
@ -71,9 +101,13 @@ if not "%AGENT_EXIT%" == "0" (
echo.
echo GSP Windows Agent exited with error code %AGENT_EXIT%.
echo Review the messages above. The window is staying open so the failure is visible.
pause
call :pause_on_error
exit /b %AGENT_EXIT%
)
popd >nul 2>&1
exit /b 0
:pause_on_error
if /I not "%GSP_AGENT_NO_PAUSE%"=="1" pause
exit /b 0