left4dead: only individual server workshop downloads

This commit is contained in:
cronekorkn 2022-12-03 19:51:13 +01:00
parent 9f8a64a653
commit 801a8bcf5f
Signed by: cronekorkn
SSH key fingerprint: SHA256:v0410ZKfuO1QHdgKBsdQNF64xmTxOF8osF1LIqwTcVw
7 changed files with 48 additions and 77 deletions

View file

@ -1,19 +1,6 @@
assert node.has_bundle('steam') and node.has_bundle('steam-workshop-download')
directories = {
'/opt/steam/left4dead2/left4dead2/ems/admin system': {
'owner': 'steam',
'group': 'steam',
'mode': '0755',
},
'/opt/steam/left4dead2/left4dead2/addons': {
'owner': 'steam',
'group': 'steam',
'purge': True,
'triggers': [
*[f'svc_systemd:left4dead2-{name}.service:restart' for name in node.metadata.get('left4dead2/servers')],
],
},
'/opt/steam/left4dead2-servers': {
'owner': 'steam',
'group': 'steam',
@ -30,30 +17,6 @@ directories = {
},
}
files = {
'/opt/steam/left4dead2/left4dead2/ems/admin system/admins.txt': {
'owner': 'steam',
'group': 'steam',
'mode': '0755',
'content': '\n'.join(sorted(node.metadata.get('left4dead2/admins'))),
},
'/opt/steam/left4dead2/left4dead2/addons/readme.txt': {
'content_type': 'any',
'owner': 'steam',
'group': 'steam',
}
}
for id in node.metadata.get('left4dead2/workshop'):
files[f'/opt/steam/left4dead2/left4dead2/addons/{id}.vpk'] = {
'content_type': 'any',
'owner': 'steam',
'group': 'steam',
'triggers': [
*[f'svc_systemd:left4dead2-{name}.service:restart' for name in node.metadata.get('left4dead2/servers')],
],
}
# /opt/steam/steam/.steam/sdk32/steamclient.so: cannot open shared object file: No such file or directory
symlinks = {
'/opt/steam/steam/.steam/sdk32': {
@ -99,7 +62,24 @@ for name, config in node.metadata.get('left4dead2/servers').items():
],
}
# addons
# service
svc_systemd[f'left4dead2-{name}.service'] = {
'needs': [
f'file:/opt/steam/left4dead2-servers/{name}/left4dead2/cfg/server.cfg',
f'file:/usr/local/lib/systemd/system/left4dead2-{name}.service',
],
}
#
# ADDONS
#
# base
files[f'/opt/steam/left4dead2-servers/{name}/left4dead2/addons/readme.txt'] = {
'content_type': 'any',
'owner': 'steam',
'group': 'steam',
}
directories[f'/opt/steam/left4dead2-servers/{name}/left4dead2/addons'] = {
'owner': 'steam',
'group': 'steam',
@ -108,11 +88,6 @@ for name, config in node.metadata.get('left4dead2/servers').items():
f'svc_systemd:left4dead2-{name}.service:restart',
],
}
files[f'/opt/steam/left4dead2-servers/{name}/left4dead2/addons/readme.txt'] = {
'content_type': 'any',
'owner': 'steam',
'group': 'steam',
}
for id in [
*config.get('workshop', []),
*node.metadata.get('left4dead2/workshop'),
@ -126,10 +101,22 @@ for name, config in node.metadata.get('left4dead2/servers').items():
],
}
# service
svc_systemd[f'left4dead2-{name}.service'] = {
'needs': [
f'file:/opt/steam/left4dead2-servers/{name}/left4dead2/cfg/server.cfg',
f'file:/usr/local/lib/systemd/system/left4dead2-{name}.service',
# admin system
directories[f'/opt/steam/left4dead2-servers/{name}/left4dead2/ems/admin system'] = {
'owner': 'steam',
'group': 'steam',
'mode': '0755',
'triggers': [
f'svc_systemd:left4dead2-{name}.service:restart',
],
}
files[f'/opt/steam/left4dead2-servers/{name}/left4dead2/ems/admin system/admins.txt'] = {
'owner': 'steam',
'group': 'steam',
'mode': '0755',
'content': '\n'.join(sorted(node.metadata.get('left4dead2/admins'))),
'triggers': [
f'svc_systemd:left4dead2-{name}.service:restart',
],
}

View file

@ -33,31 +33,6 @@ def rconn_password(metadata):
}
@metadata_reactor.provides(
'steam-workshop-download',
)
def workshop_download(metadata):
if metadata.get('left4dead2/workshop'):
return {
'steam-workshop-download': {
'left4dead2-global': {
'ids': metadata.get('left4dead2/workshop'),
'path': '/opt/steam/left4dead2/left4dead2/addons',
'user': 'steam',
'requires': {
'steam-update.service',
},
'required_by': {
f'left4dead2-{name}.service'
for name in metadata.get('left4dead2/servers')
},
},
},
}
else:
return {}
@metadata_reactor.provides(
'steam-workshop-download',
'systemd/units',
@ -95,9 +70,10 @@ def server_units(metadata):
}
# individual workshop
if 'workshop' in config:
workshop_ids = config.get('workshop', set()) | metadata.get('left4dead2/workshop', set())
if workshop_ids:
workshop[f'left4dead2-{name}'] = {
'ids': config['workshop'],
'ids': workshop_ids,
'path': f'/opt/steam/left4dead2-servers/{name}/left4dead2/addons',
'user': 'steam',
'requires': {

1
bundles/pip/items.py Normal file
View file

@ -0,0 +1 @@
pkg_pip = node.metadata.get('pip')

3
bundles/pip/metadata.py Normal file
View file

@ -0,0 +1,3 @@
defaults = {
'pip': {},
}

View file

@ -3,6 +3,9 @@ from shlex import quote
defaults = {
'steam-workshop-download': {},
'pip': {
'vpk': {},
},
}

View file

@ -46,8 +46,8 @@ actions = {
}
svc_systemd['steam-update.service'] = {
'running': False,
'enabled': False,
'running': None,
'enabled': True,
'needs': {
'file:/usr/local/lib/systemd/system/steam-update.service',
}

View file

@ -5,6 +5,7 @@
'bundles': [
'apt',
'nftables',
'pip',
],
'metadata': {
'apt': {