fix(device-deploy): prove r46 rollback and version empty DNS fingerprints
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
"""Embed the reviewed r46 recovery into the standalone root-owned runner."""
|
||||
import json
|
||||
from pathlib import Path
|
||||
ROOT = Path(__file__).resolve().parent
|
||||
RUNNER = ROOT.parent / 'deploy-runner/nodedc-deploy'
|
||||
START = '# BEGIN GENERATED DEVICE R46 RECOVERY\n'
|
||||
END = '# END GENERATED DEVICE R46 RECOVERY\n'
|
||||
|
||||
|
||||
def section():
|
||||
source = (ROOT / 'r46_runtime.py').read_text()
|
||||
evidence = json.loads((ROOT / 'r46-evidence.json').read_text())
|
||||
return START + source.replace('__DEVICE_R46_EVIDENCE__', repr(evidence)) + '\n' + END
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
current = RUNNER.read_text()
|
||||
if START in current:
|
||||
before, rest = current.split(START, 1)
|
||||
_, after = rest.split(END, 1)
|
||||
current = before + section() + after
|
||||
else:
|
||||
current = current.replace('\ndef main(argv):', '\n' + section() + '\n\ndef main(argv):', 1)
|
||||
RUNNER.write_text(current)
|
||||
Reference in New Issue
Block a user