From f21998266d971f8a931116e562c42ba936c3730d Mon Sep 17 00:00:00 2001 From: mwiegand Date: Mon, 11 Oct 2021 00:02:29 +0200 Subject: [PATCH] wip --- bundles/left4dead2/items.py | 23 ++++++++++++++++------- bundles/left4dead2/metadata.py | 2 +- bundles/steam/items.py | 15 +++++++++++---- 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/bundles/left4dead2/items.py b/bundles/left4dead2/items.py index 7913f66..64e2b14 100644 --- a/bundles/left4dead2/items.py +++ b/bundles/left4dead2/items.py @@ -5,11 +5,10 @@ directories = { '/opt/left4dead2/ems/admin system': { 'owner': 'steam', }, - '/opt/left4dead2/addons': { + '/opt/left4dead2/left4dead2/cfg': { 'owner': 'steam', - 'purge': True, }, - '/etc/left4dead2': { + '/opt/left4dead2/addons': { 'owner': 'steam', 'purge': True, }, @@ -42,11 +41,21 @@ for id in node.metadata.get('left4dead2/workshop'): server_units = set() for name, config in node.metadata.get('left4dead2/servers').items(): config.pop('port') - config['sv_steamgroup'] = name - config['hostname'] = name - config['sv_steamgroup'] = ','.join(str(gid) for gid in node.metadata.get('left4dead2/steamgroups')) + config.update({ + 'hostname': name, + 'sv_steamgroup': ','.join( + str(gid) for gid in node.metadata.get('left4dead2/steamgroups') + ), + 'log': 'on', + 'sv_logecho': 1, + 'sv_logfile': 1, + 'sv_log_onefile': 0, + 'sv_logbans': 1, + 'sv_logflush': 0, + 'sv_logsdir': 'logs', # /opt/left4dead2/left4dead2/logs + }) - files[f'/etc/left4dead2/{name}.cfg'] = { + files[f'/opt/left4dead2/left4dead2/cfg/server-{name}.cfg'] = { 'content': '\n'.join( f'{key} "{value}"' for key, value in sorted(config.items()) ) + '\n', diff --git a/bundles/left4dead2/metadata.py b/bundles/left4dead2/metadata.py index 8362658..2b5de70 100644 --- a/bundles/left4dead2/metadata.py +++ b/bundles/left4dead2/metadata.py @@ -74,7 +74,7 @@ def server_units(metadata): 'User': 'steam', 'Group': 'steam', 'WorkingDirectory': '/opt/left4dead2', - 'ExecStart': f'/opt/left4dead2/srcds_run -port {config["port"]} -secure +exec /etc/left4dead2/{name}.cfg', + 'ExecStart': f'/opt/left4dead2/srcds_run -port {config["port"]} -secure +exec server-{name}.cfg', 'Restart': 'on-failure', }, 'Install': { diff --git a/bundles/steam/items.py b/bundles/steam/items.py index e004419..ab5f7af 100644 --- a/bundles/steam/items.py +++ b/bundles/steam/items.py @@ -7,7 +7,9 @@ users = { directories = { '/opt/steam': { 'owner': 'steam', - 'group': 'steam', + }, + '/opt/steam/.steam': { + 'owner': 'steam', }, } @@ -16,17 +18,22 @@ files = { 'content_type': 'download', 'source': 'https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz', 'owner': 'steam', - 'group': 'steam', }, '/opt/steam-workshop-downloader': { 'content_type': 'download', 'source': 'https://github.com/SegoCode/swd/releases/download/1.1/swd-linux-amd64', 'owner': 'steam', - 'group': 'steam', 'mode': '750', }, } +symlinks = { + # /opt/steam/.steam/sdk32/steamclient.so: cannot open shared object file: No such file or directory + '/opt/steam/.steam/sdk32': { + 'target': '/opt/steam/linux32', + } +} + actions = { 'extract_steamcmd': { 'command': 'tar xfvz /opt/steam/steamcmd_linux.tar.gz --directory /opt/steam', @@ -36,7 +43,7 @@ actions = { ], }, 'chown_steamcmd': { - 'command': 'chown -R steam:steam /opt/steam', + 'command': 'chown -R steam /opt/steam', 'triggered': True, 'triggered_by': [ 'action:extract_steamcmd',