SCRIPT_NAME="upgrade-partial.sh"
LOG_FILE="/tmp/upgrade-partial.log"
FOTA_DIR="/opt/usr/data/fota"
+HAL_UPGRADE_CFG_DIR="/hal/etc/upgrade/"
+HAL_PART_MAP_FILE="label_map.list"
untrap() {
trap '' ERR
flog "[Info] Flash images for update..."
CONFIG_FILE="update.cfg"
+ LABEL_MAP_PATH=${HAL_UPGRADE_CFG_DIR}/${HAL_}
+ while read LABEL PARTLABEL; do
+ declare "LABEL_MAP_${LABEL}=${PARTLABEL}"
+ done < <(grep -v -e "^#" -e "^#" ${LABEL_MAP_PATH}/${HAL_PART_MAP_FILE})
+
/bin/tar xvfp "$DELTA_TAR" -C "$FOTA_DIR" "$CONFIG_FILE"
if [ ! -e "$FOTA_DIR/$CONFIG_FILE" ]; then
flog "[Error] There is no $CONFIG_FILE"
fi
rm -f "$FOTA_DIR/delta.ua"
# _OFFSET _SIZE _HASH1 _HASH2
- while read -r PART_NAME DELTA_NAME TYPE DEV _ _ _ _
+ while read -r LABEL_NAME DELTA_NAME TYPE DEV _ _ _ _
do
- PART_NAME="$(echo "$PART_NAME" | /bin/awk '{print tolower($0)}')"
+ LABEL_NAME="$(echo "$LABEL_NAME" | /bin/awk '{print tolower($0)}')"
+
+ # Translate LABEL to PARTLABEL using label_map.list
+ TMP="LABEL_MAP_${LABEL_NAME}"
+ PART_NAME=${!TMP}
+ if [ -z "${PART_NAME}" ]; then
+ PART_NAME=${LABEL_NAME}
+ fi
+
if [ "$TYPE" == "PRE_UA" ]; then
/bin/tar xvfp "$DELTA_TAR" -C "$FOTA_DIR" "$DELTA_NAME"
if [ ! -e "$FOTA_DIR/$DELTA_NAME" ]; then
- flog "[Info] There is no delta $DELTA_NAME for $PART_NAME"
+ flog "[Info] There is no delta $DELTA_NAME for label $LABEL_NAME from part $PART_NAME"
continue
fi
- if [ "$PART_NAME" == "ramdisk-recovery" ]; then
- PART_NAME="recovery"
- fi
NEXT_PARTITION="$(/usr/bin/blkid-print "$EMMC_DEVICE" "$PART_NAME" "$NEXT_AB" |\
/bin/sed -E 's|(part_nr: [0-9]+ )\((.*)\): (.*)|\3|')"