Add CS:GO to Source Service Option (#538)
* Added CS:GO This allows users to select rather or not to use cs:go for a server. * Removed debugging outputs * Replace tabs with spaces to pass StyleCI * Remove more pesky tabs I apparently missed them the first time. * Fix pesky issues with starts This fix is to repair the startup for csgo and remove the required accounts. * Better explanation for STEAM_ACC * Removed dupe ips * Added and fixed lines * Set a default map to be loaded in. * Set the variables rules to match what they would need to be * Removed a pesky space
This commit is contained in:
parent
3e3da89990
commit
4c639906b4
|
@ -192,6 +192,50 @@ EOF;
|
||||||
'script_entry' => 'bash',
|
'script_entry' => 'bash',
|
||||||
'script_container' => 'ubuntu:16.04',
|
'script_container' => 'ubuntu:16.04',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$script = <<<'EOF'
|
||||||
|
#!/bin/bash
|
||||||
|
# CSGO Installation Script
|
||||||
|
#
|
||||||
|
# Server Files: /mnt/server
|
||||||
|
apt -y update
|
||||||
|
apt -y --no-install-recommends install curl lib32gcc1 ca-certificates
|
||||||
|
|
||||||
|
cd /tmp
|
||||||
|
curl -sSL -o steamcmd.tar.gz http://media.steampowered.com/installer/steamcmd_linux.tar.gz
|
||||||
|
|
||||||
|
mkdir -p /mnt/server/steamcmd
|
||||||
|
tar -xzvf steamcmd.tar.gz -C /mnt/server/steamcmd
|
||||||
|
cd /mnt/server/steamcmd
|
||||||
|
|
||||||
|
# SteamCMD fails otherwise for some reason, even running as root.
|
||||||
|
# This is changed at the end of the install process anyways.
|
||||||
|
chown -R root:root /mnt
|
||||||
|
|
||||||
|
export HOME=/mnt/server
|
||||||
|
./steamcmd.sh +login anonymous +force_install_dir /mnt/server +app_update 740 +quit
|
||||||
|
|
||||||
|
mkdir -p /mnt/server/.steam/sdk32
|
||||||
|
cp -v linux32/steamclient.so ../.steam/sdk32/steamclient.so
|
||||||
|
EOF;
|
||||||
|
|
||||||
|
$this->option['csgo'] = ServiceOption::updateOrCreate([
|
||||||
|
'service_id' => $this->service->id,
|
||||||
|
'tag' => 'csgo',
|
||||||
|
], [
|
||||||
|
'name' => 'Counter-Strike: Global Offensive',
|
||||||
|
'description' => 'Counter-Strike: Global Offensive is a multiplayer first-person shooter video game developed by Hidden Path Entertainment and Valve Corporation.',
|
||||||
|
'docker_image' => 'quay.io/pterodactyl/core:source',
|
||||||
|
'config_startup' => '{"done": "VAC secure mode is activated.", "userInteraction": []}',
|
||||||
|
'config_files' => null,
|
||||||
|
'config_logs' => '{"custom": true, "location": "logs/latest.log"}',
|
||||||
|
'config_stop' => 'quit',
|
||||||
|
'config_from' => $this->option['source']->id,
|
||||||
|
'startup' => './srcds_run -game csgo -console -port {{SERVER_PORT}} +ip 0.0.0.0 +map {{SRCDS_MAP}} -strictportbind -norestart +sv_setsteamaccount {{STEAM_ACC}}',
|
||||||
|
'script_install' => $script,
|
||||||
|
'script_entry' => 'bash',
|
||||||
|
'script_container' => 'ubuntu:16.04',
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function addVariables()
|
private function addVariables()
|
||||||
|
@ -199,6 +243,7 @@ EOF;
|
||||||
$this->addInsurgencyVariables();
|
$this->addInsurgencyVariables();
|
||||||
$this->addTF2Variables();
|
$this->addTF2Variables();
|
||||||
$this->addArkVariables();
|
$this->addArkVariables();
|
||||||
|
$this->addCSGOVariables();
|
||||||
$this->addCustomVariables();
|
$this->addCustomVariables();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -319,6 +364,33 @@ EOF;
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function addCSGOVariables()
|
||||||
|
{
|
||||||
|
ServiceVariable::updateOrCreate([
|
||||||
|
'option_id' => $this->option['csgo']->id,
|
||||||
|
'env_variable' => 'SRCDS_MAP',
|
||||||
|
], [
|
||||||
|
'name' => 'Map',
|
||||||
|
'description' => 'The default map for the server.',
|
||||||
|
'default_value' => 'de_dust2',
|
||||||
|
'user_viewable' => 1,
|
||||||
|
'user_editable' => 1,
|
||||||
|
'rules' => 'required|string|alpha_dash',
|
||||||
|
]);
|
||||||
|
|
||||||
|
ServiceVariable::updateOrCreate([
|
||||||
|
'option_id' => $this->option['csgo']->id,
|
||||||
|
'env_variable' => 'STEAM_ACC',
|
||||||
|
], [
|
||||||
|
'name' => 'Steam Account Token',
|
||||||
|
'description' => 'The Steam Account Token required for the server to be displayed publicly.',
|
||||||
|
'default_value' => '',
|
||||||
|
'user_viewable' => 1,
|
||||||
|
'user_editable' => 1,
|
||||||
|
'rules' => 'required|string|alpha_num|size:32',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
private function addCustomVariables()
|
private function addCustomVariables()
|
||||||
{
|
{
|
||||||
ServiceVariable::updateOrCreate([
|
ServiceVariable::updateOrCreate([
|
||||||
|
|
Loading…
Reference in New Issue