From 5c3ee135fbaf15d9854bd383aa3672e193d83484 Mon Sep 17 00:00:00 2001 From: Jackeagle Date: Tue, 3 Oct 2023 13:21:30 +0530 Subject: [PATCH] build: Generate SHA256 checksums for all images in recovery-IMG.zip - Copy sha256sum Hash files for recovery-IMG.zip and recovery.img Signed-off-by: Jackeagle --- src/build.sh | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/build.sh b/src/build.sh index d7b5fd9..34f127f 100755 --- a/src/build.sh +++ b/src/build.sh @@ -329,18 +329,23 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then # Copy the files specified by the flags if [ "$RECOVERY_NEEDS_BOOT_IMG" = true ]; then cp -a obj/PACKAGING/target_files_intermediates/lineage_*/IMAGES/boot.img "$BOOT_IMG_NAME" + sha256sum "$BOOT_IMG_NAME" > "$BOOT_IMG_NAME.sha256sum" fi if [ "$RECOVERY_NEEDS_DTBO_IMG" = true ]; then cp -a obj/PACKAGING/target_files_intermediates/lineage_*/IMAGES/dtbo.img "$DTBO_IMG_NAME" + sha256sum "$DTBO_IMG_NAME" > "$DTBO_IMG_NAME.sha256sum" fi if [ "$RECOVERY_NEEDS_VBMETA_IMG" = true ]; then cp -a obj/PACKAGING/target_files_intermediates/lineage_*/IMAGES/vbmeta.img "$VBMETA_IMG_NAME" + sha256sum "$VBMETA_IMG_NAME" > "$VBMETA_IMG_NAME.sha256sum" fi if [ "$RECOVERY_NEEDS_VENDOR_BOOT_IMG" = true ]; then cp -a obj/PACKAGING/target_files_intermediates/lineage_*/IMAGES/vendor_boot.img "$VENDOR_BOOT_IMG_NAME" + sha256sum "$VENDOR_BOOT_IMG_NAME" > "$VENDOR_BOOT_IMG_NAME.sha256sum" fi if [ "$RECOVERY_NEEDS_SUPER_IMG" = true ]; then cp -a obj/PACKAGING/target_files_intermediates/lineage_*/IMAGES/super_empty.img "$SUPER_EMPTY_IMG_NAME" + sha256sum "$SUPER_EMPTY_IMG_NAME" > "$SUPER_EMPTY_IMG_NAME.sha256sum" fi if [ "$VBOOT_IS_RECOVERY" = true ]; then @@ -351,28 +356,37 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then cp -a boot.img "$RECOVERY_IMG_NAME" fi + # Generate SHA256 checksum for RECOVERY_IMG_NAME + sha256sum "$RECOVERY_IMG_NAME" > "$RECOVERY_IMG_NAME.sha256sum" + # Conditionally include files in zip command based on flags - files_to_zip=("$RECOVERY_IMG_NAME") + files_to_zip=("$RECOVERY_IMG_NAME" "$RECOVERY_IMG_NAME.sha256sum") + if [ "$RECOVERY_NEEDS_BOOT_IMG" = true ]; then files_to_zip+=("$BOOT_IMG_NAME") + files_to_zip+=("$BOOT_IMG_NAME.sha256sum") fi if [ "$RECOVERY_NEEDS_DTBO_IMG" = true ]; then files_to_zip+=("$DTBO_IMG_NAME") + files_to_zip+=("$DTBO_IMG_NAME.sha256sum") fi if [ "$RECOVERY_NEEDS_VBMETA_IMG" = true ]; then files_to_zip+=("$VBMETA_IMG_NAME") + files_to_zip+=("$VBMETA_IMG_NAME.sha256sum") fi if [ "$RECOVERY_NEEDS_VENDOR_BOOT_IMG" = true ]; then files_to_zip+=("$VENDOR_BOOT_IMG_NAME") + files_to_zip+=("$VENDOR_BOOT_IMG_NAME.sha256sum") fi if [ "$RECOVERY_NEEDS_SUPER_IMG" = true ]; then files_to_zip+=("$SUPER_EMPTY_IMG_NAME") + files_to_zip+=("$SUPER_EMPTY_IMG_NAME.sha256sum") fi # Zip command zip "$RECOVERY_ZIP_NAME" "${files_to_zip[@]}" sha256sum "$RECOVERY_ZIP_NAME" > "$RECOVERY_ZIP_NAME.sha256sum" - mv "$RECOVERY_ZIP_NAME" "$ZIP_DIR/$zipsubdir/" + mv "$RECOVERY_ZIP_NAME"* "$ZIP_DIR/$zipsubdir/" else if [ "$VBOOT_IS_RECOVERY" = true ]; then cp -a "obj/PACKAGING/target_files_intermediates/lineage_*/IMAGES/vendor_boot.img" "$RECOVERY_IMG_NAME" @@ -384,7 +398,7 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then # Calculate sha256sum and move file sha256sum "$RECOVERY_IMG_NAME" > "$RECOVERY_IMG_NAME.sha256sum" - mv "$RECOVERY_IMG_NAME" "$ZIP_DIR/$zipsubdir/" + mv "$RECOVERY_IMG_NAME"* "$ZIP_DIR/$zipsubdir/" fi fi done -- GitLab