Fix Device Core mount-order fingerprints with exact r5 recovery
This commit is contained in:
@@ -12,13 +12,16 @@ ROOT = Path(__file__).resolve().parent
|
||||
ENTRY = 'deployment/device-core-release-r5-reconciliation-v1.json'
|
||||
|
||||
|
||||
def bundle():
|
||||
descriptor = (ROOT / 'r5-reconciliation-v1.json').read_bytes()
|
||||
def bundle(version=1):
|
||||
if version not in (1, 2):
|
||||
raise ValueError("unsupported reconciliation version")
|
||||
entry = ENTRY if version == 1 else ENTRY.replace("-v1.json", "-v2.json")
|
||||
descriptor = (ROOT / ('r5-reconciliation-v'+str(version)+'.json')).read_bytes()
|
||||
identity = json.loads(descriptor)['releaseId']
|
||||
members = {
|
||||
'manifest.env': ('id='+identity+'\ncomponent=device-core-release-reconciliation\ntype=app-overlay\n').encode(),
|
||||
'files.txt': (ENTRY+'\n').encode(),
|
||||
'payload/'+ENTRY: descriptor,
|
||||
'files.txt': (entry+'\n').encode(),
|
||||
'payload/'+entry: descriptor,
|
||||
}
|
||||
output=io.BytesIO()
|
||||
with gzip.GzipFile(fileobj=output, mode='wb', mtime=0, filename='') as compressed:
|
||||
@@ -31,8 +34,9 @@ def bundle():
|
||||
|
||||
if __name__=='__main__':
|
||||
parser=argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument('--version', type=int, choices=(1, 2), default=1)
|
||||
parser.add_argument('--output-dir',required=True,type=Path)
|
||||
args=parser.parse_args();args.output_dir.mkdir(parents=True,exist_ok=True)
|
||||
identity,data=bundle();path=args.output_dir/('nodedc-'+identity+'.tgz')
|
||||
identity,data=bundle(args.version);path=args.output_dir/('nodedc-'+identity+'.tgz')
|
||||
with path.open('xb') as stream:stream.write(data)
|
||||
print(json.dumps({'artifact':str(path),'sha256':hashlib.sha256(data).hexdigest(),'id':identity}))
|
||||
|
||||
Reference in New Issue
Block a user