fixes
This commit is contained in:
parent
5ead40a761
commit
6a15b114e6
23 changed files with 269 additions and 87 deletions
|
|
@ -1,41 +1,20 @@
|
|||
@echo off
|
||||
@title OGP Agent
|
||||
FOR /f "tokens=2,3,4 delims=[.]" %%a IN ('ver') DO SET WVer=%%a
|
||||
FOR /f "tokens=2,3 delims= " %%a IN ('echo %WVer%') DO SET Ver=%%a
|
||||
whoami /groups | find "S-1-16-12288" >nul 2>&1
|
||||
if NOT %errorLevel% == 0 if %VER% GEQ 6 (
|
||||
echo Failure: Current permissions inadequate.
|
||||
echo[
|
||||
echo Run this script by using "Run as administrator" in the context menu.
|
||||
pause >nul
|
||||
exit
|
||||
)
|
||||
set WD=%~dp0
|
||||
pushd %WD%
|
||||
set path=%WD%bin;%WD%usr\sbin;%path%
|
||||
set CYGWIN=server ntsec
|
||||
set SHELL=/bin/bash
|
||||
set runAgentNormally=no
|
||||
|
||||
REM Stop any running agent
|
||||
if exist %WD%var\run\pure-ftpd.pid set /p PID1=<%WD%var\run\pure-ftpd.pid
|
||||
if exist %WD%OGP\ogp_agent.pid set /p PID2=<%WD%OGP\ogp_agent.pid
|
||||
if exist %WD%OGP\ogp_agent_run.pid set /p PID3=<%WD%OGP\ogp_agent_run.pid
|
||||
IF NOT [%PID1%] == [] kill -15 %PID1%
|
||||
IF NOT [%PID2%] == [] kill -15 %PID2%
|
||||
IF NOT [%PID3%] == [] kill -15 %PID3%
|
||||
|
||||
REM Check for cyg_server user and if it exists and the user running this script matches, run it the normal way, else prompt for elevation
|
||||
if "%username%" == "" set runAgentNormally=yes
|
||||
if "%username%" == "cyg_server" set runAgentNormally=yes
|
||||
|
||||
net user cyg_server
|
||||
if %ERRORLEVEL% EQU 0 (
|
||||
if %runAgentNormally% == yes (
|
||||
bash ogp_agent -pidfile /OGP/ogp_agent_run.pid
|
||||
) else (
|
||||
cygstart cmd /c "runas /profile /user:cyg_server \"%WD%\bin\bash.exe %WD%\bin\ogp_agent -pidfile /OGP/ogp_agent_run.pid\""
|
||||
)
|
||||
) else (
|
||||
bash ogp_agent -pidfile /OGP/ogp_agent_run.pid
|
||||
)
|
||||
@echo off
|
||||
setlocal EnableExtensions
|
||||
title GSP Windows Agent
|
||||
|
||||
set "ROOT=%~dp0"
|
||||
set "INNER_START=%ROOT%OGP\Install\agent_start.bat"
|
||||
|
||||
if not exist "%INNER_START%" (
|
||||
echo Failure: maintained agent launcher was not found.
|
||||
echo.
|
||||
echo Expected:
|
||||
echo %INNER_START%
|
||||
echo.
|
||||
echo This checkout should contain OGP\Install\agent_start.bat.
|
||||
pause
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
call "%INNER_START%"
|
||||
exit /b %ERRORLEVEL%
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue