flatcar-scripts/build_library/generate_kernel_hash.sh
Krzesimir Nowak 336a967941 build_library: Convert python2 scripts to python3
This is just a conversion done by 2to3 with a manual updates of
shebangs to mention python3 explicitly. The fixups for bytearray vs
string issues will follow up.
2021-08-18 18:56:48 +02:00

14 lines
328 B
Bash
Executable File

#!/usr/bin/python3
import hashlib
import json
import os
import sys
path=sys.argv[1]
version=sys.argv[2]
with open(path, "rb") as f:
kernel = f.read()
print(json.dumps({"9": {"binaryvalues": [{"prefix": "grub_linux", "values": [{"value": hashlib.sha1(kernel).hexdigest(), "description": "flatcar-%s" % version}]}]}}))