Added Cyg-Win

This commit is contained in:
Frank Harris 2026-06-06 18:46:40 -04:00
parent 82cbc206eb
commit 413c315806
10586 changed files with 3806249 additions and 0 deletions

View file

@ -0,0 +1,41 @@
@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
)