Files
archy/scripts/package-public-update-worker.py
T

23 lines
998 B
Python

#!/usr/bin/env python3
"""Emit a source-only standalone owner for separately reviewed root installation.
No install, signing, candidate execution or live-node operation. This bundle is
the same preparation+worker source embedded by the corrected backend.
"""
import argparse
import hashlib
from pathlib import Path
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--output', type=Path, required=True)
args = parser.parse_args()
scripts = Path(__file__).resolve().parent
preparation = (scripts / 'public_update_prepare.py').read_text().rsplit("\nif __name__ == '__main__':", 1)[0]
bundle = (preparation + '\n' + (scripts / 'public_update_runtime.py').read_text()
+ '\n' + (scripts / 'public_update_adopt.py').read_text()
+ '\n' + (scripts / 'public_update_worker.py').read_text()).encode()
compile(bundle, str(args.output), 'exec')
with args.output.open('xb') as stream:
stream.write(bundle)
print(hashlib.sha256(bundle).hexdigest(), args.output)