#!/bin/bash OTA_TEST_TMP_DIR=ota_test_tmp ORIGIN_UPDATE_ZIP=../../../../oe-core/build/tmp-glibc/deploy/images/mdm9607/mdm9607-ota-target-image-ubi.zip OTA_TEST_ZIP=mdm9607-ota-target-image-ubi.zip OUTPUT_ZIP=ota_test_tmp.zip MODIFY_PRODUCT_FILE=SYSTEM/etc/default_config/product RM_DATA_BIN=SYSTEM/usr/bin/smbd # copy mdm9607-ota-target-image-ubi.zip cp -f ${ORIGIN_UPDATE_ZIP} ./${OTA_TEST_ZIP} # mkdir for unzip rm -rf ${OTA_TEST_TMP_DIR} mkdir -p ${OTA_TEST_TMP_DIR} unzip ${OTA_TEST_ZIP} -d ${OTA_TEST_TMP_DIR} pushd ${OTA_TEST_TMP_DIR} FIRMWARE_VER=`cat ${MODIFY_PRODUCT_FILE} | grep -oP '(?<=option firmware_ver ")[\d\.]+'` TEST_FIRMWARE_VER=`echo ${FIRMWARE_VER} | awk -F"." '{print $1 "." $2 "." expr $3 + 1}'` PRODUCT_ID=`cat ${MODIFY_PRODUCT_FILE} | grep -oP '(?<=option product_id ")[\d\.]+'` # modify product (firmware_ver + 1) sed -i "s/option firmware_ver \"${FIRMWARE_VER}\"/option firmware_ver \"${TEST_FIRMWARE_VER}\"/g" ${MODIFY_PRODUCT_FILE} rm -rf ../${OUTPUT_ZIP} zip -ry ../${OUTPUT_ZIP} ./ popd # rm thermal-engine just for test zip ${OTA_TEST_ZIP} ${RM_DATA_BIN} -d # produce compatibility.txt COMPA_TXT=compatibility.txt echo ${PRODUCT_ID}:${FIRMWARE_VER} > ${COMPA_TXT} ./make_ota_package.sh ${OTA_TEST_ZIP} ${OUTPUT_ZIP} n n OTE_TEST_ZIP=${FIRMWARE_VER}_${TEST_FIRMWARE_VER}.zip mv update.zip ${OTE_TEST_ZIP} # produce compatibility.txt COMPA_TXT=compatibility.txt echo ${PRODUCT_ID}:0 > ${COMPA_TXT} cp -f ${ORIGIN_UPDATE_ZIP} ./${OTA_TEST_ZIP} ./make_ota_package.sh origin_update.zip ${OTA_TEST_ZIP} n n OTE_TEST_FULL_ZIP=0_${FIRMWARE_VER}.zip mv update.zip ${OTE_TEST_FULL_ZIP} # rm unuse files rm -rf ${OTA_TEST_TMP_DIR} rm -rf ${OUTPUT_ZIP} rm -rf ${OTA_TEST_ZIP} rm -rf ${COMPA_TXT}