Combined the Agents in the repo
This commit is contained in:
parent
15a457cbef
commit
e1859e5d73
465 changed files with 77467 additions and 0 deletions
BIN
Agent-Windows/Install/Cygwin-Terminal.ico
Normal file
BIN
Agent-Windows/Install/Cygwin-Terminal.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 52 KiB |
4
Agent-Windows/Install/Cygwin.bat
Normal file
4
Agent-Windows/Install/Cygwin.bat
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
@echo off
|
||||
setlocal enableextensions
|
||||
set TERM=
|
||||
cd /d "%~dp0bin" && .\bash --login -i
|
||||
BIN
Agent-Windows/Install/Cygwin.ico
Normal file
BIN
Agent-Windows/Install/Cygwin.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 153 KiB |
41
Agent-Windows/Install/agent_start.bat
Normal file
41
Agent-Windows/Install/agent_start.bat
Normal 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 gameserver 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%" == "gameserver" set runAgentNormally=yes
|
||||
|
||||
net user gameserver
|
||||
if %ERRORLEVEL% EQU 0 (
|
||||
if %runAgentNormally% == yes (
|
||||
bash ogp_agent -pidfile /OGP/ogp_agent_run.pid
|
||||
) else (
|
||||
cygstart mintty /c "runas /profile /user:gameserver \"%WD%\bin\bash.exe %WD%\bin\ogp_agent -pidfile /OGP/ogp_agent_run.pid\""
|
||||
)
|
||||
) else (
|
||||
bash ogp_agent -pidfile /OGP/ogp_agent_run.pid
|
||||
)
|
||||
21
Agent-Windows/Install/agent_stop.bat
Normal file
21
Agent-Windows/Install/agent_stop.bat
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
@echo off
|
||||
@title Stop OGP Agent
|
||||
net session >nul 2>&1
|
||||
if NOT %errorLevel% == 0 (
|
||||
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
|
||||
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%
|
||||
BIN
Agent-Windows/Install/grant.exe
Normal file
BIN
Agent-Windows/Install/grant.exe
Normal file
Binary file not shown.
5
Agent-Windows/Install/install_apache.sh
Normal file
5
Agent-Windows/Install/install_apache.sh
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
#!/bin/bash
|
||||
# Installs Apache for Windows on Cygwin
|
||||
/etc/rc.d/init.d/httpd install
|
||||
cygrunsrv -S httpd
|
||||
/etc/rc.d/init.d/httpd reload
|
||||
107
Agent-Windows/Install/onceinstall_agent.bat
Normal file
107
Agent-Windows/Install/onceinstall_agent.bat
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
@echo off
|
||||
net session >nul 2>&1
|
||||
IF %ERRORLEVEL% neq 0 (
|
||||
echo Failure: Current permissions inadequate.
|
||||
echo[
|
||||
echo Run this script by using "Run as administrator" in the context menu.
|
||||
pause >nul
|
||||
exit
|
||||
)
|
||||
REM Remove the trailing \ in the path or else Cygwin will flip when it's enclosed in double quotes (http://stackoverflow.com/questions/3160058/how-to-get-the-path-of-a-batch-script-without-the-trailing-backslash-in-a-single && https://cygwin.com/ml/cygwin/2016-11/msg00178.html)
|
||||
set WD=%~dp0
|
||||
pushd %WD%
|
||||
set WD=%WD:~0,-1%
|
||||
REM Set the needed enviroment variables to run Cygwin executables without writing the full path
|
||||
set CYGWIN=server ntsec
|
||||
REM PATH CANNOT BE DOUBLE QUOTED (http://serverfault.com/questions/349179/path-variable-and-quotation-marks-windows)
|
||||
set path=%WD%\bin;%WD%\usr\sbin;%path%
|
||||
set SHELL=/bin/bash
|
||||
REM Advice
|
||||
echo DO NOT CLOSE THIS WINDOW YET.
|
||||
echo The setup process will continue once cygwin installation ends.
|
||||
REM Download latest Cygwin
|
||||
tools\wget.exe -N "https://cygwin.com/setup-x86_64.exe" -O "setup-x86_64.exe" --no-check-certificate
|
||||
REM start the setup for cygwin with the requiered repositories, paths and packages
|
||||
REM OLD WAY:
|
||||
REM setup-x86_64.exe --local-install --quiet-mode --root %WD% --local-package-dir %WD%cygTemp --packages "screen,perl,perl-HTTP-Daemon,perl-Path-Class,perl-XML-Parser,perl-Archive-Zip,perl-XML-Simple,wget,unzip,rsync,curl,bzip2,zip,cygrunsrv,dos2unix,mutt,ssmtp,nano,git,subversion" > Cygwin64_Agent_Setup.log
|
||||
IF EXIST "setup-x86_64.exe" setup-x86_64.exe --site "http://cygwin.mirror.constant.com/" --quiet-mode --root "%WD%" --local-package-dir "%WD%\cygTemp" --packages "screen,perl,perl-HTTP-Daemon,perl_vendor,perl-Path-Class,perl-XML-Parser,perl-Archive-Zip,perl-XML-Simple,wget,unzip,gawk,rsync,curl,bzip2,zip,cygrunsrv,dos2unix,mutt,ssmtp,nano,git,subversion,perl-Archive-Extract" > Cygwin64_Agent_Setup.log
|
||||
IF NOT EXIST "setup-x86_64.exe" setup-x86_64_local.exe --site "http://cygwin.mirror.constant.com/" --quiet-mode --root "%WD%" --local-package-dir "%WD%\cygTemp" --packages "screen,perl,perl-HTTP-Daemon,perl_vendor,perl-Path-Class,perl-XML-Parser,perl-Archive-Zip,perl-XML-Simple,wget,unzip,gawk,rsync,curl,bzip2,zip,cygrunsrv,dos2unix,mutt,ssmtp,nano,git,subversion,perl-Archive-Extract" > Cygwin64_Agent_Setup.log
|
||||
IF EXIST "setup-x86_64.exe" DEL setup-x86_64_local.exe
|
||||
cls
|
||||
REM Creating administrator account
|
||||
:gameserver_exists
|
||||
cls
|
||||
NET USER | FINDSTR gameserver >nul
|
||||
IF %ERRORLEVEL% neq 0 (
|
||||
echo In order to run the agent on boot,
|
||||
echo we need an administrator account named 'gameserver'.
|
||||
echo Please, create a new administrator account named 'gameserver'
|
||||
echo from the control panel of Windows and press any key to continue.
|
||||
pause >nul
|
||||
goto :gameserver_exists
|
||||
)
|
||||
cls
|
||||
color C
|
||||
echo Please, make sure the user 'gameserver' is an administrator account
|
||||
echo and press any key to continue.
|
||||
pause >nul
|
||||
cls
|
||||
color 7
|
||||
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
|
||||
set alpha=MNOPQRSTUVW
|
||||
set DRIVE=M
|
||||
:set_free_drive
|
||||
IF EXIST %DRIVE%: (
|
||||
call set beta=%%alpha:*%DRIVE%=%%
|
||||
set DRIVE=%beta:~,1%
|
||||
goto :set_free_drive
|
||||
)
|
||||
:gameserver_pass_ok
|
||||
set /p PASS=Please, enter the password for user 'gameserver':
|
||||
IF %VER% LSS 6 (
|
||||
grant del SeDenyNetworkLogonRight %USERDOMAIN%\gameserver
|
||||
net use %DRIVE%: \\%USERDOMAIN%\c$ %PASS% /user:gameserver >nul
|
||||
) ELSE (
|
||||
schtasks /Create /RU "gameserver" /SC ONSTART /TN "testtask" /TR "calc.exe" /F /RL highest /RP %PASS% >nul
|
||||
)
|
||||
IF %ERRORLEVEL% NEQ 0 (
|
||||
goto :gameserver_pass_ok
|
||||
) ELSE (
|
||||
IF %VER% LSS 6 (
|
||||
net use %DRIVE%: /DELETE >nul
|
||||
grant add SeDenyNetworkLogonRight %USERDOMAIN%\gameserver
|
||||
) ELSE (
|
||||
schtasks /Delete /TN "testtask" /f >nul
|
||||
)
|
||||
)
|
||||
cls
|
||||
REM Old way from SVN
|
||||
REM tools\wget.exe -N "http://master.dl.sourceforge.net/project/ogpextras/Installer-Snapshot/latest_win_agent_files.zip" -O "agent_files.zip"
|
||||
tools\wget.exe -N "https://github.com/OpenGamePanel/OGP-Agent-Windows/archive/master.zip" -O "agent_files.zip" --no-check-certificate
|
||||
unzip -q agent_files_old.zip
|
||||
unzip -q -o agent_files.zip
|
||||
IF NOT EXIST "OGP-Agent-Windows-master" unzip -q agent_files_local_copy.zip
|
||||
cd "OGP-Agent-Windows-master"
|
||||
IF EXIST OGP/COPYING xcopy /Y /E * ..\
|
||||
IF EXIST OGP/COPYING cd ..
|
||||
rm -rf "OGP-Agent-Windows-master"
|
||||
rm -f agent_files.zip
|
||||
rm -f agent_files_old.zip
|
||||
rm -f agent_files_local_copy.zip
|
||||
chmod +x /OGP/agent_conf.sh
|
||||
chmod +x /bin/ogp_agent
|
||||
REM Run OGP Agent configuration script
|
||||
bash /OGP/agent_conf.sh -p %PASS%
|
||||
REM adding OGP Agent to the system startup
|
||||
tools\fart.exe "%WD%\service_settings.xml" "{COMMAND}" "%WD%\agent_start.bat"
|
||||
tools\fart.exe "%WD%\service_settings.xml" "{COMMAND_WORK_DIR}" "%WD%"
|
||||
schtasks /create /tn "OGP agent start on boot" /XML "%WD%\service_settings.xml" /ru "gameserver" /rp "%PASS%"
|
||||
REM Rebase files
|
||||
call "%WD%\rebase_post_ins.bat"
|
||||
echo.
|
||||
REM Start OGP Agent
|
||||
schtasks /Run /tn "OGP agent start on boot"
|
||||
REM Grant logon as a service for FTP / other cyg_win services... needed for FileZilla for sure in x64 installer... not sure about here, but why not put it in.
|
||||
tools\ntrights.exe +r SeServiceLogonRight -u gameserver -m \\%COMPUTERNAME%
|
||||
exit 0
|
||||
1
Agent-Windows/Install/open_home_path.bat
Normal file
1
Agent-Windows/Install/open_home_path.bat
Normal file
|
|
@ -0,0 +1 @@
|
|||
explorer .\home\%USERNAME%
|
||||
13
Agent-Windows/Install/preuninstall_agent.bat
Normal file
13
Agent-Windows/Install/preuninstall_agent.bat
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
@echo off
|
||||
set WD=%~dp0
|
||||
pushd %WD%
|
||||
net session >nul 2>&1
|
||||
if NOT %errorLevel% == 0 (
|
||||
echo Failure: Current permissions inadequate.
|
||||
echo[
|
||||
echo Run this script by using "Run as administrator" in the context menu.
|
||||
pause >nul
|
||||
exit
|
||||
)
|
||||
net stop ogp_agent
|
||||
sc delete ogp_agent
|
||||
20
Agent-Windows/Install/rebase_post_ins.bat
Normal file
20
Agent-Windows/Install/rebase_post_ins.bat
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
@echo off
|
||||
echo.
|
||||
echo Stopping OGP Agent if exists...
|
||||
SET mypath=%~dp0
|
||||
IF EXIST "%mypath%\agent_stop.bat" call "%mypath%\agent_stop.bat"
|
||||
echo.
|
||||
echo Stopping CygWin Services...
|
||||
echo.
|
||||
net stop mysqld
|
||||
net stop cygserver
|
||||
net stop httpd
|
||||
net stop cron
|
||||
echo.
|
||||
echo Running CygWin rebaseall command to prevent errors...
|
||||
echo .
|
||||
C:
|
||||
cd "%mypath%\bin"
|
||||
ash.exe /bin/rebaseall
|
||||
echo.
|
||||
|
||||
37
Agent-Windows/Install/service_settings.xml
Normal file
37
Agent-Windows/Install/service_settings.xml
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<?xml version="1.0" encoding="UTF-16"?>
|
||||
<Task version="1.1" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
|
||||
<RegistrationInfo>
|
||||
<Author></Author>
|
||||
<URI>\OGP agent start on boot</URI>
|
||||
</RegistrationInfo>
|
||||
<Triggers>
|
||||
<BootTrigger>
|
||||
<Enabled>true</Enabled>
|
||||
</BootTrigger>
|
||||
</Triggers>
|
||||
<Principals>
|
||||
<Principal id="Author">
|
||||
<RunLevel>HighestAvailable</RunLevel>
|
||||
</Principal>
|
||||
</Principals>
|
||||
<Settings>
|
||||
<DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
|
||||
<StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>
|
||||
<IdleSettings>
|
||||
<StopOnIdleEnd>false</StopOnIdleEnd>
|
||||
<RestartOnIdle>false</RestartOnIdle>
|
||||
</IdleSettings>
|
||||
<Enabled>true</Enabled>
|
||||
<Hidden>false</Hidden>
|
||||
<RunOnlyIfIdle>false</RunOnlyIfIdle>
|
||||
<WakeToRun>false</WakeToRun>
|
||||
<ExecutionTimeLimit>PT0S</ExecutionTimeLimit>
|
||||
<Priority>5</Priority>
|
||||
</Settings>
|
||||
<Actions Context="Author">
|
||||
<Exec>
|
||||
<Command>C:\OGP64\agent_start.bat</Command>
|
||||
<WorkingDirectory>C:\OGP64</WorkingDirectory>
|
||||
</Exec>
|
||||
</Actions>
|
||||
</Task>
|
||||
BIN
Agent-Windows/Install/setup-x86_64.exe
Normal file
BIN
Agent-Windows/Install/setup-x86_64.exe
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue