diff --git a/database/seeds/SourceServiceTableSeeder.php b/database/seeds/SourceServiceTableSeeder.php index 171aebecc..040421420 100644 --- a/database/seeds/SourceServiceTableSeeder.php +++ b/database/seeds/SourceServiceTableSeeder.php @@ -192,6 +192,50 @@ EOF; 'script_entry' => 'bash', '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() @@ -199,6 +243,7 @@ EOF; $this->addInsurgencyVariables(); $this->addTF2Variables(); $this->addArkVariables(); + $this->addCSGOVariables(); $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() { ServiceVariable::updateOrCreate([