diff --git a/Agent-Windows/OGP64/OGP/ogp_agent.pl b/Agent-Windows/OGP64/OGP/ogp_agent.pl index 55677208..111f5533 100644 --- a/Agent-Windows/OGP64/OGP/ogp_agent.pl +++ b/Agent-Windows/OGP64/OGP/ogp_agent.pl @@ -23,8 +23,9 @@ use warnings; use strict; -use Cwd; # Fast way to get the current directory -use lib getcwd(); +use Cwd qw(getcwd); # Fast way to get the current directory +use FindBin qw($Bin); +use lib $Bin; use Frontier::Daemon::OGP::Forking; # Forking XML-RPC server use File::Copy; # Simple file copy functions use File::Copy::Recursive diff --git a/Agent-Windows/OGP64/agent_start.bat b/Agent-Windows/OGP64/agent_start.bat index 55b799d1..d5214d39 100644 --- a/Agent-Windows/OGP64/agent_start.bat +++ b/Agent-Windows/OGP64/agent_start.bat @@ -29,6 +29,19 @@ if not exist "%WD%OGP\ogp_agent.pl" ( exit /b 1 ) +if not exist "%WD%OGP\Cfg\Config.pm" ( + echo Creating default Cfg\Config.pm from Config.pm.default... + copy /Y "%WD%OGP\Cfg\Config.pm.default" "%WD%OGP\Cfg\Config.pm" >nul +) +if not exist "%WD%OGP\Cfg\Preferences.pm" ( + echo Creating default Cfg\Preferences.pm from Preferences.pm.default... + copy /Y "%WD%OGP\Cfg\Preferences.pm.default" "%WD%OGP\Cfg\Preferences.pm" >nul +) +if not exist "%WD%OGP\Cfg\bash_prefs.cfg" ( + echo Creating default Cfg\bash_prefs.cfg from bash_prefs.cfg.default... + copy /Y "%WD%OGP\Cfg\bash_prefs.cfg.default" "%WD%OGP\Cfg\bash_prefs.cfg" >nul +) + REM Verify gameserver user exists net user %AGENT_USER% if errorlevel 1 ( diff --git a/docs/features/INSTALLERS.md b/docs/features/INSTALLERS.md index e2e6108c..eceaaa75 100644 --- a/docs/features/INSTALLERS.md +++ b/docs/features/INSTALLERS.md @@ -39,6 +39,6 @@ Common installed layout: The launcher checks `%~dp0bin\bash.exe`, `C:\OGP64\bin\bash.exe`, `C:\cygwin64\bin\bash.exe`, and `C:\cygwin\bin\bash.exe`. Missing-bash errors should print every checked path and pause in manual use. -Generated config files under `/OGP/Cfg` are production state. Installer/startup may create them from `.default` templates if missing, but update logic must preserve them. Restart-time auto-update may replace only `/OGP/ogp_agent.pl`; it must not overwrite `Cfg/Config.pm`, `Cfg/Preferences.pm`, `Cfg/bash_prefs.cfg`, service settings, passwords, server data, or logs. +Generated config files under `/OGP/Cfg` are production state. `C:\OGP64\agent_start.bat` may create them from `.default` templates if missing, but update logic must preserve them. Restart-time auto-update may replace only `/OGP/ogp_agent.pl`; it must not overwrite `Cfg/Config.pm`, `Cfg/Preferences.pm`, `Cfg/bash_prefs.cfg`, service settings, passwords, server data, or logs. When the Windows agent starts, `C:\OGP64\agent_start.bat` should be launched from the Cygwin root itself. It verifies the `gameserver` account, normalizes text files, validates `OGP\ogp_agent.pl`, and then launches the agent in the same console window. It should not call an installer wrapper from the start script.