| 12345678910111213141516171819202122 |
- """Inspect supported image prerequisites without network or changing runtime files."""
- import json
- import os
- from pathlib import Path
- roots = [Path('/opt/data'), Path('/root/.hermes'), Path('/home/hermes/.hermes')]
- result = {'uid': os.getuid(), 'home': os.environ.get('HOME'),
- 'hermesHome': os.environ.get('HERMES_HOME'), 'roots': {}}
- for root in roots:
- entry = {'exists': root.exists()}
- if root.exists():
- entry['entries'] = sorted(p.name for p in root.iterdir())
- entry['plugins'] = sorted(p.name for p in (root / 'plugins').glob('*'))
- entry['scripts'] = sorted(p.name for p in (root / 'scripts').glob('*'))
- result['roots'][str(root)] = entry
- result['source'] = {}
- for relative in ['docker/entrypoint-dispatch.sh', 'docker/main-wrapper.sh', 'docker/entrypoint.sh',
- 'hermes_cli/config.py', 'hermes_cli/paths.py', 'gateway/platforms/matrix.py']:
- file = Path('/opt/hermes') / relative
- if file.is_file():
- result['source'][relative] = file.read_text()
- print(json.dumps(result, ensure_ascii=False))
|