From 520fae3fd44e69c49adf92055f53f44a9d0c3319dd0c4599b4adaffa2530a12e Mon Sep 17 00:00:00 2001 From: e-minguez Date: Fri, 14 Nov 2025 15:05:01 +0100 Subject: [PATCH] feat: Kiwi-build generates sha256sum now --- kiwi-builder-image/build-image.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/kiwi-builder-image/build-image.sh b/kiwi-builder-image/build-image.sh index bd95ea1..ed8a662 100644 --- a/kiwi-builder-image/build-image.sh +++ b/kiwi-builder-image/build-image.sh @@ -96,6 +96,20 @@ kiwi-ng --temp-dir /tmp/output/tmp-dir --debug --profile $PROFILE \ RESULT=$? if [ $RESULT -eq 0 ]; then echo -e "\n\nINFO: Image build successful, generated images are available in the 'output' directory." + # The -n flag is being used to avoid the \n at the end of the line + echo -n "INFO: Generating sha256 checksum file... " && { + # This returns the iso or raw image from the kiwi.result.json file, preferring iso + FILE_PATH=$(python3 -c 'import json, sys; data = json.load(sys.stdin); iso = data.get("installation_image", {}).get("filename"); raw = data.get("disk_image", {}).get("filename"); print(iso if iso else raw)' < /tmp/output/kiwi.result.json) + # Generate the checksum if the file path was successfully extracted + if [ -n "$FILE_PATH" ]; then + # The sed trims the full path to just the filename (e.g., "sum filename") + sha256sum "$FILE_PATH" | sed -E 's/\s+.*\/([^/]+)$/ \1/' > "$FILE_PATH.sha256" && echo "done" + else + # Or fail if it is not there + echo "ERROR: Neither ISO nor RAW file path found in JSON." + fi + # Catch-all just in case something fails inside the block + } || echo "ERROR: Command failed during processing." else echo -e "\n\nERROR: Failed to build the image, please see above logs." fi -- 2.51.1