exit(1)
json_path = Path(argv[1])
-bin_dir = Path(getenv("BIN_DIR"))
-file_path = bin_dir / getenv("FILE_NAME")
+file_path = Path(getenv("FILE_DIR")) / getenv("FILE_NAME")
+
if not file_path.is_file():
print("Skip JSON creation for non existing file", file_path)
def get_titles():
titles = []
- for prefix in ["", "ALT0_", "ALT1_", "ALT2_"]:
+ for prefix in ["", "ALT0_", "ALT1_", "ALT2_", "ALT3_", "ALT4_"]:
title = {}
for var in ["vendor", "model", "variant"]:
if getenv("DEVICE_{}{}".format(prefix, var.upper())):
device_id = getenv("DEVICE_ID")
-file_hash = hashlib.sha256(file_path.read_bytes()).hexdigest()
+hash_file = hashlib.sha256(file_path.read_bytes()).hexdigest()
+
+if file_path.with_suffix(file_path.suffix + ".sha256sum").exists():
+ hash_unsigned = (
+ file_path.with_suffix(file_path.suffix + ".sha256sum").read_text().strip()
+ )
+else:
+ hash_unsigned = hash_file
file_info = {
"metadata_version": 1,
{
"type": getenv("FILE_TYPE"),
"name": getenv("FILE_NAME"),
- "sha256": file_hash,
+ "sha256": hash_file,
+ "sha256_unsigned": hash_unsigned,
}
],
"device_packages": getenv("DEVICE_PACKAGES").split(),