Capture current mission, AI, map and administration development
Include the current addon, terrain integrations, tools, regression tests and recorded development evidence.
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
from pathlib import Path
|
||||
import os,sys,json,shutil,subprocess,time,signal
|
||||
ROOT=Path('/home/jakub/devel/escapistsrereintroduced');sys.path.insert(0,str(ROOT/'tools'))
|
||||
from external_addons import policy,prepare_profile
|
||||
from source_manifest import addon_manifest
|
||||
from dedicated_native import PROBE
|
||||
base=Path('/tmp/erri-profile-native');base.mkdir(exist_ok=True)
|
||||
run=base/sys.argv[1];run.mkdir();source=run/'source';source.mkdir()
|
||||
for rel in addon_manifest(ROOT):
|
||||
dest=source/Path(rel).relative_to('addons/core');dest.parent.mkdir(parents=True,exist_ok=True);shutil.copy2(ROOT/rel,dest)
|
||||
shutil.copy2('/tmp/erri-takeover-pair-source32/resourceDatabase.rdb',source/'resourceDatabase.rdb')
|
||||
shutil.copy2('/tmp/erri-profile-probe.c',source/'Scripts/Game/ERR/00_Core/ERR_ZProfileProbe.c')
|
||||
addons=run/'addons';addons.mkdir();steam=Path.home()/'.local/share/Steam'
|
||||
prepare_profile(addons,steam/'steamapps/compatdata/1874880/pfx/drive_c/users/steamuser/Documents/My Games/ArmaReforger/addons',policy(ROOT),run/'external-cache.json');(addons/'ERR_Core').symlink_to(source,target_is_directory=True)
|
||||
profile=run/'profile/profile';profile.mkdir(parents=True)
|
||||
import import_settings
|
||||
settings=import_settings.merge()[0];settings['heliTimerMinutes']=27;settings['unknownFutureSetting']={'values':['brace } comma , quote \\"','ěščř']}
|
||||
(profile/'rereintroduced.json').write_text(json.dumps(settings,ensure_ascii=False))
|
||||
(profile/'EscapistsTerrain.json').write_text('{"scenario":""}')
|
||||
(profile/'EscapistsFactions.json').write_text('{"escapists":"us","enemy":"ussr","independent":"fia"}')
|
||||
(profile/'EscapistsContent.json').write_text('{"dormant_mod":0}')
|
||||
(profile/'EscapistsItems.json').write_text(json.dumps({'version':1,'records':['active','active|1111111111111111|*|0','existing','existing|2222222222222222|*|1']}))
|
||||
(profile/'EscapistsWelcomeVoice.json').write_text('{"welcomeUrl":"http://192.168.52.4:18947/welcome.b64"}')
|
||||
(run/'network.py').write_text(PROBE)
|
||||
runtime=Path('/tmp/erri-takeover-dedicated-runtime')
|
||||
engine=['/tmp/runtime/ArmaReforgerServer','-server','{C1E20667DCE324ED}Missions/ERR_Everon.conf','-addonsDir',str(addons),'-addons','2528466DE220D91C','-profile',str(run/'profile'),'-noBackend','-noSound','-bindIP','127.0.0.1','-bindPort','2001','-maxFPS','30','-logconsole','-noSplash','-noThrow','-disableCrashReporter']
|
||||
cmd=['bwrap','--unshare-net','--unshare-pid','--unshare-ipc','--unshare-uts','--die-with-parent','--cap-drop','ALL','--ro-bind','/','/','--tmpfs','/tmp','--ro-bind',str(runtime),'/tmp/runtime','--bind',str(run),str(run),'--proc','/proc','--dev','/dev','--chdir','/tmp/runtime','python',str(run/'network.py'),os.readlink('/proc/self/ns/net')]+engine
|
||||
with (run/'stdout.log').open('w') as log:
|
||||
p=subprocess.Popen(cmd,stdout=log,stderr=subprocess.STDOUT,start_new_session=True)
|
||||
reason='timeout';start=time.monotonic()
|
||||
try:
|
||||
while time.monotonic()-start<100:
|
||||
files=sorted((run/'profile/logs').glob('logs_*/console.log'));text=files[-1].read_text(errors='replace') if files else ''
|
||||
if 'ERR CONFIG COMPLETE' in text:reason='complete';break
|
||||
if "Can't compile" in text:reason='compile-failed';break
|
||||
if p.poll() is not None:reason='exit';break
|
||||
time.sleep(.3)
|
||||
finally:
|
||||
if p.poll() is None:
|
||||
os.killpg(p.pid,signal.SIGTERM)
|
||||
try:p.wait(timeout=8)
|
||||
except subprocess.TimeoutExpired:os.killpg(p.pid,signal.SIGKILL);p.wait()
|
||||
(run/'result.json').write_text(json.dumps({'reason':reason,'exit':p.returncode}));print(reason)
|
||||
print('\n'.join(line for line in text.splitlines() if 'ERR CONFIG' in line or 'SCRIPT (E)' in line))
|
||||
Reference in New Issue
Block a user