diff --git a/src/build.sh b/src/build.sh index d7b5fd90a52ffe834cdc5b57aad1c9626276025e..34f127f39e422c36a49c4767bf15636e16e4417f 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