PARTITION_LIST=$(sed -e '/^#/d' -e '/^$/d' "${HAL_UPGRADE_CFG_DIR}/${HAL_PART_LIST_FILE}")
}
+run_upgrade_binary() {
+ log "[Info] Running $1"
+ $1 2>&1 | tee -a "$LOG_FILE"
+ return ${PIPESTATUS[0]}
+}
+
upgrade_images() {
DELTA_TAR="$1"
log "[Info] Flash images for update..."
CURR_PARTITION="$("$BLKID_PRINT" "$EMMC_DEVICE" "$PART_NAME" "$CURRENT_AB")"
fi
- log "[Info] Flashing $DELTA_NAME... to $NEXT_PARTITION"
+ log "[Info] Flashing $DELTA_NAME... to $NEXT_PARTITION, Delta type: ${TYPE_S[0]}"
local UP_RES
untrap
case "${TYPE_S[0]}" in
FULL_IMAGE)
- "$FOTA_DIR/upgrade-apply" --archive "$DELTA_TAR" \
- --dest "$NEXT_PARTITION" \
- --dest-size "$NEW_SIZE" \
- --archive-file "$DELTA_NAME" \
- --kind raw \
- --dest-sha1 "$NEW_SHA" && UP_RES=$? || UP_RES=$?
+ run_upgrade_binary "$FOTA_DIR/upgrade-apply "`
+ `"--archive $DELTA_TAR "`
+ `"--dest $NEXT_PARTITION "`
+ `"--dest-size $NEW_SIZE "`
+ `"--archive-file $DELTA_NAME "`
+ `"--kind raw "`
+ `"--dest-sha1 $NEW_SHA"
+ UP_RES=$?
;;
DELTA_IMAGE)
- "$FOTA_DIR/upgrade-apply" --archive "$DELTA_TAR" \
- --dest "$NEXT_PARTITION" \
- --dest-size "$NEW_SIZE" \
- --archive-file "$DELTA_NAME" \
- --kind ss_brotli_patch \
- --patch-orig "$CURR_PARTITION" \
- --no-write-all \
- --dest-sha1 "$NEW_SHA" && UP_RES=$? || UP_RES=$?
+ run_upgrade_binary "$FOTA_DIR/upgrade-apply "`
+ `"--archive $DELTA_TAR "`
+ `"--dest $NEXT_PARTITION "`
+ `"--dest-size $NEW_SIZE "`
+ `"--archive-file $DELTA_NAME "`
+ `"--kind ss_brotli_patch "`
+ `"--patch-orig $CURR_PARTITION "`
+ `"--no-write-all "`
+ `"--dest-sha1 $NEW_SHA"
+ UP_RES=$?
;;
DELTA_FS)
mkdir "$FOTA_DIR/partition_mnt"
mount "$NEXT_PARTITION" "$FOTA_DIR/partition_mnt"
- "$FOTA_DIR/upgrade-apply-deltafs" --archive "$DELTA_TAR" \
- --dest "$FOTA_DIR/partition_mnt" \
- --archive-file "${DELTA_NAME}/" && UP_RES=$? || UP_RES=$?
+
+ run_upgrade_binary "$FOTA_DIR/upgrade-apply-deltafs "`
+ `"--archive $DELTA_TAR "`
+ `"--dest $FOTA_DIR/partition_mnt "`
+ `"--archive-file $DELTA_NAME/"
+ UP_RES=$?
+
umount "$NEXT_PARTITION"
rm -rf "$FOTA_DIR/partition_mnt"
;;