Remove OGP references from Windows agent and start Linux agent updates

Co-authored-by: iaretechnician <2749183+iaretechnician@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2025-09-05 22:17:10 +00:00
parent 85d4423b37
commit 3c3b9ad867
2 changed files with 54 additions and 58 deletions

View file

@ -1,9 +1,7 @@
#!/usr/bin/perl #!/usr/bin/perl
# #
# OGP - Open Game Panel # Game Server Panel
# Copyright (C) 2008 - 2018 The OGP Development Team # Copyright (C) 2008 - 2018 The Development Team
#
# http://www.opengamepanel.org/
# #
# This program is free software; you can redistribute it and/or # This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License # modify it under the terms of the GNU General Public License
@ -66,7 +64,7 @@ use constant SCREEN_LOG_LOCAL => $Cfg::Preferences{screen_log_local};
use constant DELETE_LOGS_AFTER => $Cfg::Preferences{delete_logs_after}; use constant DELETE_LOGS_AFTER => $Cfg::Preferences{delete_logs_after};
use constant LINUX_USER_PER_GAME_SERVER => $Cfg::Preferences{linux_user_per_game_server}; use constant LINUX_USER_PER_GAME_SERVER => $Cfg::Preferences{linux_user_per_game_server};
use constant AGENT_PID_FILE => use constant AGENT_PID_FILE =>
Path::Class::File->new(AGENT_RUN_DIR, 'ogp_agent.pid'); Path::Class::File->new(AGENT_RUN_DIR, 'agent.pid');
use constant AGENT_RSYNC_GENERIC_LOG => use constant AGENT_RSYNC_GENERIC_LOG =>
Path::Class::File->new(AGENT_RUN_DIR, 'rsync_update_generic.log'); Path::Class::File->new(AGENT_RUN_DIR, 'rsync_update_generic.log');
use constant STEAM_LICENSE_OK => "Accept"; use constant STEAM_LICENSE_OK => "Accept";
@ -81,14 +79,14 @@ use constant SCREEN_LOGS_DIR =>
use constant GAME_STARTUP_DIR => use constant GAME_STARTUP_DIR =>
Path::Class::Dir->new(AGENT_RUN_DIR, 'startups'); Path::Class::Dir->new(AGENT_RUN_DIR, 'startups');
use constant SCREENRC_FILE => use constant SCREENRC_FILE =>
Path::Class::File->new(AGENT_RUN_DIR, 'ogp_screenrc'); Path::Class::File->new(AGENT_RUN_DIR, 'screenrc');
use constant SCREENRC_FILE_BK => use constant SCREENRC_FILE_BK =>
Path::Class::File->new(AGENT_RUN_DIR, 'ogp_screenrc_bk'); Path::Class::File->new(AGENT_RUN_DIR, 'screenrc_bk');
use constant SCREENRC_TMP_FILE => use constant SCREENRC_TMP_FILE =>
Path::Class::File->new(AGENT_RUN_DIR, 'ogp_screenrc.tmp'); Path::Class::File->new(AGENT_RUN_DIR, 'screenrc.tmp');
use constant SCREEN_TYPE_HOME => "HOME"; use constant SCREEN_TYPE_HOME => "HOME";
use constant SCREEN_TYPE_UPDATE => "UPDATE"; use constant SCREEN_TYPE_UPDATE => "UPDATE";
use constant SERVER_RUNNER_USER => "ogp_server_runner"; use constant SERVER_RUNNER_USER => "server_runner";
use constant FD_DIR => Path::Class::Dir->new(AGENT_RUN_DIR, 'FastDownload'); use constant FD_DIR => Path::Class::Dir->new(AGENT_RUN_DIR, 'FastDownload');
use constant FD_ALIASES_DIR => Path::Class::Dir->new(FD_DIR, 'aliases'); use constant FD_ALIASES_DIR => Path::Class::Dir->new(FD_DIR, 'aliases');
use constant FD_PID_FILE => Path::Class::File->new(FD_DIR, 'fd.pid'); use constant FD_PID_FILE => Path::Class::File->new(FD_DIR, 'fd.pid');
@ -550,7 +548,7 @@ sub create_screen_cmd
sub create_screen_cmd_loop sub create_screen_cmd_loop
{ {
my ($screen_id, $exec_cmd, $envVars, $skipLoop) = @_; my ($screen_id, $exec_cmd, $envVars, $skipLoop) = @_;
my $server_start_bashfile = $screen_id . "_startup_scr.sh"; my $server_start_bashfile = "start_server.sh";
$exec_cmd = replace_OGP_Env_Vars($screen_id, "", "", $exec_cmd); $exec_cmd = replace_OGP_Env_Vars($screen_id, "", "", $exec_cmd);
@ -1020,7 +1018,7 @@ sub universal_start_without_decrypt
"Startup command [ $cli_bin ] will be executed in dir $game_binary_dir."; "Startup command [ $cli_bin ] will be executed in dir $game_binary_dir.";
# Fix permissions one last time (for backup_home_log created folder / files / etc) # Fix permissions one last time (for backup_home_log created folder / files / etc)
my $server_start_bashfile = $screen_id . "_startup_scr.sh"; my $server_start_bashfile = "start_server.sh";
secure_path_without_decrypt('chattr-i', $server_start_bashfile); secure_path_without_decrypt('chattr-i', $server_start_bashfile);
set_path_ownership($owner, $group, $home_path, 1); set_path_ownership($owner, $group, $home_path, 1);
my $readOnlyOwnerCmd = "chmod -Rf og-r '$server_start_bashfile'"; my $readOnlyOwnerCmd = "chmod -Rf og-r '$server_start_bashfile'";

View file

@ -1,9 +1,7 @@
#!/usr/bin/perl #!/usr/bin/perl
# #
# OGP - Open Game Panel # Game Server Panel
# Copyright (C) 2008 - 2014 The OGP Development Team # Copyright (C) 2008 - 2014 The Development Team
#
# http://www.opengamepanel.org/
# #
# This program is free software; you can redistribute it and/or # This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License # modify it under the terms of the GNU General Public License
@ -62,7 +60,7 @@ use constant AGENT_VERSION => $Cfg::Config{version};
use constant SCREEN_LOG_LOCAL => $Cfg::Preferences{screen_log_local}; use constant SCREEN_LOG_LOCAL => $Cfg::Preferences{screen_log_local};
use constant DELETE_LOGS_AFTER => $Cfg::Preferences{delete_logs_after}; use constant DELETE_LOGS_AFTER => $Cfg::Preferences{delete_logs_after};
use constant AGENT_PID_FILE => use constant AGENT_PID_FILE =>
Path::Class::File->new(AGENT_RUN_DIR, 'ogp_agent.pid'); Path::Class::File->new(AGENT_RUN_DIR, 'agent.pid');
use constant AGENT_RSYNC_GENERIC_LOG => use constant AGENT_RSYNC_GENERIC_LOG =>
Path::Class::File->new(AGENT_RUN_DIR, 'rsync_update_generic.log'); Path::Class::File->new(AGENT_RUN_DIR, 'rsync_update_generic.log');
use constant STEAM_LICENSE_OK => "Accept"; use constant STEAM_LICENSE_OK => "Accept";
@ -77,9 +75,9 @@ use constant SCREEN_LOGS_DIR =>
use constant GAME_STARTUP_DIR => use constant GAME_STARTUP_DIR =>
Path::Class::Dir->new(AGENT_RUN_DIR, 'startups'); Path::Class::Dir->new(AGENT_RUN_DIR, 'startups');
use constant SCREENRC_FILE => use constant SCREENRC_FILE =>
Path::Class::File->new(AGENT_RUN_DIR, 'ogp_screenrc'); Path::Class::File->new(AGENT_RUN_DIR, 'screenrc');
use constant SCREENRC_FILE_BK => use constant SCREENRC_FILE_BK =>
Path::Class::File->new(AGENT_RUN_DIR, 'ogp_screenrc_bk'); Path::Class::File->new(AGENT_RUN_DIR, 'screenrc_bk');
use constant SCREEN_TYPE_HOME => "HOME"; use constant SCREEN_TYPE_HOME => "HOME";
use constant SCREEN_TYPE_UPDATE => "UPDATE"; use constant SCREEN_TYPE_UPDATE => "UPDATE";
use constant FD_DIR => Path::Class::Dir->new(AGENT_RUN_DIR, 'FastDownload'); use constant FD_DIR => Path::Class::Dir->new(AGENT_RUN_DIR, 'FastDownload');
@ -180,7 +178,7 @@ logger "User running agent script is: " . USER_RUNNING_SCRIPT;
if (check_steam_cmd_client() == -1) if (check_steam_cmd_client() == -1)
{ {
print "ERROR: You must download and uncompress the new steamcmd package."; print "ERROR: You must download and uncompress the new steamcmd package.";
print "ENSURE TO INSTALL IT IN /OGP/steamcmd directory,"; print "ENSURE TO INSTALL IT IN steamcmd directory,";
print "so it can be managed by the agent to install servers."; print "so it can be managed by the agent to install servers.";
exit 1; exit 1;
} }
@ -262,7 +260,7 @@ open(PID, '>', AGENT_PID_FILE)
print PID "$$\n"; print PID "$$\n";
close(PID); close(PID);
logger "Open Game Panel - Agent started - " logger "Game Server Agent started - "
. AGENT_VERSION . AGENT_VERSION
. " - port " . " - port "
. AGENT_PORT . AGENT_PORT
@ -352,7 +350,7 @@ my $d = Frontier::Daemon::OGP::Forking->new(
LocalPort => AGENT_PORT, LocalPort => AGENT_PORT,
LocalAddr => AGENT_IP, LocalAddr => AGENT_IP,
ReuseAddr => '1' ReuseAddr => '1'
) or die "Couldn't start OGP Agent: $!"; ) or die "Couldn't start Game Server Agent: $!";
sub backup_home_log sub backup_home_log
{ {
@ -465,13 +463,13 @@ sub backup_home_log
sub create_screen_id sub create_screen_id
{ {
my ($screen_type, $home_id) = @_; my ($screen_type, $home_id) = @_;
return sprintf("OGP_%s_%09d", $screen_type, $home_id); return sprintf("GS_%s_%09d", $screen_type, $home_id);
} }
sub create_screen_cmd sub create_screen_cmd
{ {
my ($screen_id, $exec_cmd) = @_; my ($screen_id, $exec_cmd) = @_;
$exec_cmd = replace_OGP_Env_Vars($screen_id, "", "", $exec_cmd); $exec_cmd = replace_Env_Vars($screen_id, "", "", $exec_cmd);
return return
sprintf('screen -d -m -t "%1$s" -c ' . SCREENRC_FILE . ' -S %1$s %2$s', sprintf('screen -d -m -t "%1$s" -c ' . SCREENRC_FILE . ' -S %1$s %2$s',
$screen_id, $exec_cmd); $screen_id, $exec_cmd);
@ -481,9 +479,9 @@ sub create_screen_cmd
sub create_screen_cmd_loop sub create_screen_cmd_loop
{ {
my ($screen_id, $exec_cmd, $priority, $affinity, $envVars) = @_; my ($screen_id, $exec_cmd, $priority, $affinity, $envVars) = @_;
my $server_start_batfile = "_start_server.bat"; my $server_start_batfile = "start_server.bat";
$exec_cmd = replace_OGP_Env_Vars($screen_id, "", "", $exec_cmd); $exec_cmd = replace_Env_Vars($screen_id, "", "", $exec_cmd);
# Create batch file that will launch the process and store PID which will be used for killing later # Create batch file that will launch the process and store PID which will be used for killing later
open (SERV_START_BAT_SCRIPT, '>', $server_start_batfile); open (SERV_START_BAT_SCRIPT, '>', $server_start_batfile);
@ -525,7 +523,7 @@ sub create_screen_cmd_loop
} }
sub replace_OGP_Env_Vars{ sub replace_Env_Vars{
# This function replaces constants from environment variables set in the XML # This function replaces constants from environment variables set in the XML
my ($screen_id, $homeid, $homepath, $exec_cmd, $game_key) = @_; my ($screen_id, $homeid, $homepath, $exec_cmd, $game_key) = @_;
@ -542,20 +540,20 @@ sub replace_OGP_Env_Vars{
# If the install file exists, the game can be auto updated, else it will be ignored by the game for improper syntax # If the install file exists, the game can be auto updated, else it will be ignored by the game for improper syntax
# To generate the install file, the "Install/Update via Steam" button must be clicked on at least once! # To generate the install file, the "Install/Update via Steam" button must be clicked on at least once!
if(-e $fullPath){ if(-e $fullPath){
$exec_cmd =~ s/{OGP_STEAM_CMD_DIR}/$windows_steamCMDPath/g; $exec_cmd =~ s/{STEAM_CMD_DIR}/$windows_steamCMDPath/g;
$exec_cmd =~ s/{STEAMCMD_INSTALL_FILE}/$steamInsFile/g; $exec_cmd =~ s/{STEAMCMD_INSTALL_FILE}/$steamInsFile/g;
} }
} }
# Handle home directory replacement # Handle home directory replacement
if(defined $homepath && $homepath ne ""){ if(defined $homepath && $homepath ne ""){
$exec_cmd =~ s/{OGP_HOME_DIR}/$homepath/g; $exec_cmd =~ s/{HOME_DIR}/$homepath/g;
} }
# Handle windows directory replacement # Handle windows directory replacement
if(defined $homepath && $homepath ne ""){ if(defined $homepath && $homepath ne ""){
my $windows_home_path = clean(`cygpath -wa $homepath`); my $windows_home_path = clean(`cygpath -wa $homepath`);
$exec_cmd =~ s/{OGP_HOME_DIR_WINDOWS}/$windows_home_path/g; $exec_cmd =~ s/{HOME_DIR_WINDOWS}/$windows_home_path/g;
} }
# Handle global game shared directory replacement # Handle global game shared directory replacement
@ -568,7 +566,7 @@ sub replace_OGP_Env_Vars{
logger "Could not create " . $shared_path . " directory $!.", 1; logger "Could not create " . $shared_path . " directory $!.", 1;
} }
$exec_cmd =~ s/{OGP_GAME_SHARED_DIR}/$shared_path/g; $exec_cmd =~ s/{GAME_SHARED_DIR}/$shared_path/g;
} }
return $exec_cmd; return $exec_cmd;
@ -765,7 +763,7 @@ sub universal_start_without_decrypt
my @prestartenvvars = split /[\r\n]+/, $envVars; my @prestartenvvars = split /[\r\n]+/, $envVars;
my $envVarStr = ""; my $envVarStr = "";
foreach my $line (@prestartenvvars) { foreach my $line (@prestartenvvars) {
$line = replace_OGP_Env_Vars("", $home_id, $home_path, $line); $line = replace_Env_Vars("", $home_id, $home_path, $line);
if($line ne ""){ if($line ne ""){
logger "Configuring environment variable: $line"; logger "Configuring environment variable: $line";
$envVarStr .= "$line\r\n"; $envVarStr .= "$line\r\n";
@ -781,8 +779,8 @@ sub universal_start_without_decrypt
my $screen_id = create_screen_id(SCREEN_TYPE_HOME, $home_id); my $screen_id = create_screen_id(SCREEN_TYPE_HOME, $home_id);
# Replace any OGP variables # Replace any variables
$startup_cmd = replace_OGP_Env_Vars($screen_id, $home_id, $home_path, $startup_cmd, $game_key); $startup_cmd = replace_Env_Vars($screen_id, $home_id, $home_path, $startup_cmd, $game_key);
# Create affinity and priority strings # Create affinity and priority strings
my $priority; my $priority;
@ -844,7 +842,7 @@ sub universal_start_without_decrypt
if($file_extension eq ".jar") if($file_extension eq ".jar")
{ {
if(defined($Cfg::Preferences{ogp_autorestart_server}) && $Cfg::Preferences{ogp_autorestart_server} eq "1"){ if(defined($Cfg::Preferences{autorestart_server}) && $Cfg::Preferences{autorestart_server} eq "1"){
deleteStoppedStatFile($home_path); deleteStoppedStatFile($home_path);
$cli_bin = create_screen_cmd_loop($screen_id, "$startup_cmd", $priority, $affinity); $cli_bin = create_screen_cmd_loop($screen_id, "$startup_cmd", $priority, $affinity);
}else{ }else{
@ -856,7 +854,7 @@ sub universal_start_without_decrypt
# There is no software made for windows that uses bash by default, # There is no software made for windows that uses bash by default,
# but it can be a good way to improve the server startup. To be able to use # but it can be a good way to improve the server startup. To be able to use
# sh/bash scripts as server executable I added this piece to the agent: # sh/bash scripts as server executable I added this piece to the agent:
if(defined($Cfg::Preferences{ogp_autorestart_server}) && $Cfg::Preferences{ogp_autorestart_server} eq "1"){ if(defined($Cfg::Preferences{autorestart_server}) && $Cfg::Preferences{autorestart_server} eq "1"){
deleteStoppedStatFile($home_path); deleteStoppedStatFile($home_path);
$cli_bin = create_screen_cmd_loop($screen_id, "bash $game_binary_dir/$server_exe $startup_cmd", $priority, $affinity); $cli_bin = create_screen_cmd_loop($screen_id, "bash $game_binary_dir/$server_exe $startup_cmd", $priority, $affinity);
}else{ }else{
@ -865,7 +863,7 @@ sub universal_start_without_decrypt
} }
else else
{ {
if(defined($Cfg::Preferences{ogp_autorestart_server}) && $Cfg::Preferences{ogp_autorestart_server} eq "1"){ if(defined($Cfg::Preferences{autorestart_server}) && $Cfg::Preferences{autorestart_server} eq "1"){
deleteStoppedStatFile($home_path); deleteStoppedStatFile($home_path);
$cli_bin = create_screen_cmd_loop($screen_id, "$win_game_binary_dir\\$server_exe $startup_cmd", $priority, $affinity); $cli_bin = create_screen_cmd_loop($screen_id, "$win_game_binary_dir\\$server_exe $startup_cmd", $priority, $affinity);
}else{ }else{
@ -1136,13 +1134,13 @@ sub stop_server_without_decrypt
} }
# Create file indicator that the game server has been stopped if defined # Create file indicator that the game server has been stopped if defined
if(defined($Cfg::Preferences{ogp_autorestart_server}) && $Cfg::Preferences{ogp_autorestart_server} eq "1"){ if(defined($Cfg::Preferences{autorestart_server}) && $Cfg::Preferences{autorestart_server} eq "1"){
# Get current directory and chdir into the game's home dir # Get current directory and chdir into the game's home dir
my $curDir = getcwd(); my $curDir = getcwd();
chdir $home_path; chdir $home_path;
# Create stopped indicator file used by autorestart of OGP if server crashes # Create stopped indicator file used by autorestart if server crashes
open(STOPFILE, '>', "SERVER_STOPPED"); open(STOPFILE, '>', "SERVER_STOPPED");
close(STOPFILE); close(STOPFILE);
@ -1632,7 +1630,7 @@ sub run_before_start_commands
open FILE, '>', $prestartcmdfile; open FILE, '>', $prestartcmdfile;
print FILE "cd \"$windows_home_path\"\r\n"; print FILE "cd \"$windows_home_path\"\r\n";
foreach my $line (@prestartcmdlines) { foreach my $line (@prestartcmdlines) {
$line = replace_OGP_Env_Vars("", $server_id, $homedir, $line); $line = replace_Env_Vars("", $server_id, $homedir, $line);
print FILE "$line\r\n"; print FILE "$line\r\n";
} }
print FILE "exit" . "\r\n"; print FILE "exit" . "\r\n";
@ -1645,7 +1643,7 @@ sub run_before_start_commands
if (defined $envVars && $envVars ne ""){ if (defined $envVars && $envVars ne ""){
my @prestartenvvars = split /[\r\n]+/, $envVars; my @prestartenvvars = split /[\r\n]+/, $envVars;
foreach my $line (@prestartenvvars) { foreach my $line (@prestartenvvars) {
$line = replace_OGP_Env_Vars("", $server_id, $homedir, $line); $line = replace_Env_Vars("", $server_id, $homedir, $line);
if($line ne ""){ if($line ne ""){
logger "Configuring environment variable: $line"; logger "Configuring environment variable: $line";
system($line); system($line);
@ -1664,13 +1662,13 @@ sub multiline_to_startup_comma_format{
my ($multiLineVar) = @_; my ($multiLineVar) = @_;
$multiLineVar =~ s/,//g; # commas are invalid anyways in bash $multiLineVar =~ s/,//g; # commas are invalid anyways in bash
$multiLineVar =~ s/[\r]+//g; $multiLineVar =~ s/[\r]+//g;
$multiLineVar =~ s/[\n]+/{OGPNEWLINE}/g; $multiLineVar =~ s/[\n]+/{NEWLINE}/g;
return $multiLineVar; return $multiLineVar;
} }
sub startup_comma_format_to_multiline{ sub startup_comma_format_to_multiline{
my ($multiLineVar) = @_; my ($multiLineVar) = @_;
$multiLineVar =~ s/{OGPNEWLINE}/\r\n/g; $multiLineVar =~ s/{NEWLINE}/\r\n/g;
return $multiLineVar; return $multiLineVar;
} }
@ -1876,7 +1874,7 @@ sub steam_cmd_without_decrypt
return 0; return 0;
} }
# Changes into root steamcmd OGP directory # Changes into root steamcmd directory
if ( check_b4_chdir(STEAMCMD_CLIENT_DIR) != 0) if ( check_b4_chdir(STEAMCMD_CLIENT_DIR) != 0)
{ {
return 0; return 0;
@ -1981,7 +1979,7 @@ sub fetch_steam_version
logger "Getting latest version info for AppId $appId"; logger "Getting latest version info for AppId $appId";
$ua->agent('OGP Windows Agent v/' . AGENT_VERSION); $ua->agent('Game Server Windows Agent v/' . AGENT_VERSION);
$ua->timeout(10); $ua->timeout(10);
my $response = $ua->get("http://opengamepanel.org/supported_games/api.php?appid=$appId&action=getBuildId"); my $response = $ua->get("http://opengamepanel.org/supported_games/api.php?appid=$appId&action=getBuildId");
@ -2511,7 +2509,7 @@ sub ftp_mgr
return "Bad Encryption Key" unless(decrypt_param(pop(@_)) eq "Encryption checking OK"); return "Bad Encryption Key" unless(decrypt_param(pop(@_)) eq "Encryption checking OK");
my ($action, $login, $password, $home_path) = decrypt_params(@_); my ($action, $login, $password, $home_path) = decrypt_params(@_);
if(!defined($Cfg::Preferences{ogp_manages_ftp}) || (defined($Cfg::Preferences{ogp_manages_ftp}) && $Cfg::Preferences{ogp_manages_ftp} eq "1")){ if(!defined($Cfg::Preferences{manages_ftp}) || (defined($Cfg::Preferences{manages_ftp}) && $Cfg::Preferences{manages_ftp} eq "1")){
if( defined($Cfg::Preferences{ftp_method}) && $Cfg::Preferences{ftp_method} eq "FZ") if( defined($Cfg::Preferences{ftp_method}) && $Cfg::Preferences{ftp_method} eq "FZ")
{ {
require Cfg::FileZilla; # Use Filezilla Configuration file require Cfg::FileZilla; # Use Filezilla Configuration file
@ -3367,9 +3365,9 @@ sub agent_restart
if ($dec_check eq 'restart') if ($dec_check eq 'restart')
{ {
chdir AGENT_RUN_DIR; chdir AGENT_RUN_DIR;
if(-e "ogp_agent_run.pid") if(-e "agent_run.pid")
{ {
my $init_pid = `cat ogp_agent_run.pid`; my $init_pid = `cat agent_run.pid`;
chomp($init_pid); chomp($init_pid);
if(kill 0, $init_pid) if(kill 0, $init_pid)
@ -3378,7 +3376,7 @@ sub agent_restart
my $rm_pid_file = ""; my $rm_pid_file = "";
my $agent_pid = ""; my $agent_pid = "";
my $restart_scr_log = Path::Class::File->new(SCREEN_LOGS_DIR, 'screenlog.agent_restart'); my $restart_scr_log = Path::Class::File->new(SCREEN_LOGS_DIR, 'screenlog.agent_restart');
my $agent_scr_log = Path::Class::File->new(SCREEN_LOGS_DIR, 'screenlog.ogp_agent'); my $agent_scr_log = Path::Class::File->new(SCREEN_LOGS_DIR, 'screenlog.agent');
if(-e $restart_scr_log) if(-e $restart_scr_log)
{ {
@ -3390,10 +3388,10 @@ sub agent_restart
unlink $agent_scr_log; unlink $agent_scr_log;
} }
if(-e "ogp_agent.pid") if(-e "agent.pid")
{ {
$rm_pid_file .= " ogp_agent.pid"; $rm_pid_file .= " agent.pid";
$agent_pid = `cat ogp_agent.pid`; $agent_pid = `cat agent.pid`;
chomp($agent_pid); chomp($agent_pid);
if( kill 0, $agent_pid ) if( kill 0, $agent_pid )
{ {
@ -3414,13 +3412,13 @@ sub agent_restart
} }
open (AGENT_RESTART_SCRIPT, '>', 'tmp_restart.sh'); open (AGENT_RESTART_SCRIPT, '>', 'tmp_restart.sh');
my $restart = "echo -n \"Stopping OGP Agent...\"\n". my $restart = "echo -n \"Stopping Game Server Agent...\"\n".
"kill $init_pid $agent_pid $pureftpd_pid\n". "kill $init_pid $agent_pid $pureftpd_pid\n".
"while [ -e /proc/$init_pid $or_exist ];do echo -n .;sleep 1;done\n". "while [ -e /proc/$init_pid $or_exist ];do echo -n .;sleep 1;done\n".
"rm -f $rm_pid_file\necho \" [OK]\"\n". "rm -f $rm_pid_file\necho \" [OK]\"\n".
"echo -n \"Starting OGP Agent...\"\n". "echo -n \"Starting Game Server Agent...\"\n".
"screen -d -m -t \"ogp_agent\" -c \"" . SCREENRC_FILE . "\" -S ogp_agent bash ogp_agent -pidfile /OGP/ogp_agent_run.pid\n". "screen -d -m -t \"agent\" -c \"" . SCREENRC_FILE . "\" -S agent bash agent -pidfile agent_run.pid\n".
"while [ ! -e 'ogp_agent.pid' ];do echo -n .;sleep 1;done\n". "while [ ! -e 'agent.pid' ];do echo -n .;sleep 1;done\n".
"echo \" [OK]\"\n". "echo \" [OK]\"\n".
"rm -f tmp_restart.sh\n". "rm -f tmp_restart.sh\n".
"exit 0\n"; "exit 0\n";
@ -4219,7 +4217,7 @@ sub generate_post_install_scripts
' fi'."\n". ' fi'."\n".
' fi'."\n". ' fi'."\n".
' if [ ! -d "${mods_info_path}" ];then mkdir -p "${mods_info_path}";fi'."\n". ' if [ ! -d "${mods_info_path}" ];then mkdir -p "${mods_info_path}";fi'."\n".
' echo "${mod_name[$i]}" > "${mods_info_path}${mod_string[$i]}.ogpmod"'."\n". ' echo "${mod_name[$i]}" > "${mods_info_path}${mod_string[$i]}.modinfo"'."\n".
' i=$(expr $i + 1)'."\n". ' i=$(expr $i + 1)'."\n".
'done'."\n"; 'done'."\n";
return "$post_install_scripts"; return "$post_install_scripts";
@ -4237,7 +4235,7 @@ sub get_workshop_mods_info()
my @mods_info; my @mods_info;
while(my $mod_info_file = readdir(MODS_INFO_DIR)) while(my $mod_info_file = readdir(MODS_INFO_DIR))
{ {
if($mod_info_file =~ /\.ogpmod$/) if($mod_info_file =~ /\.modinfo$/)
{ {
my $mod_info_file_path = Path::Class::File->new($mods_info_dir_path, $mod_info_file); my $mod_info_file_path = Path::Class::File->new($mods_info_dir_path, $mod_info_file);
if(open(my $fh, '<:encoding(UTF-8)', $mod_info_file_path)) if(open(my $fh, '<:encoding(UTF-8)', $mod_info_file_path))
@ -4246,7 +4244,7 @@ sub get_workshop_mods_info()
chomp $row; chomp $row;
if($row ne "") if($row ne "")
{ {
my ($string_name, $ext) = split(/\.ogp/, $mod_info_file); my ($string_name, $ext) = split(/\.mod/, $mod_info_file);
push @mods_info, "$string_name:$row"; push @mods_info, "$string_name:$row";
} }
close($fh); close($fh);