Create delta.tar with delta.ua in it
authorSunmin Lee <sunm.lee@samsung.com>
Thu, 25 May 2017 06:03:43 +0000 (15:03 +0900)
committerSunmin Lee <sunm.lee@samsung.com>
Thu, 24 Aug 2017 06:14:22 +0000 (15:14 +0900)
delta.ua should be included into delta package (delta.tar), too.
It would be extracted from RAMDISK2 of new binary.

Change-Id: Icb8b89b61ad3095b62bace19875e1ab6c2965115
Signed-off-by: Sunmin Lee <sunm.lee@samsung.com>
mk_delta/common/bin/mk_delta.sh
mk_delta/common/bin/mk_part_delta.sh

index 3493555..d42702b 100755 (executable)
@@ -177,6 +177,7 @@ fn_set_default_params()
        DELTA_CFG_PATH=./cfg/delta.cfg
        PART_CFG_PATH=./cfg/default_part.cfg
        UPDATE_CFG_PATH=./cfg/update.cfg
+       DELTA_UA=./data/delta.ua
 
        LOG_PATH=./data/Delta.log
        # Getting date and minor version
@@ -342,6 +343,12 @@ do
                sudo rm ${LOG_PATH}
        fi
 
+       #--- move delta.ua to delta directory ---
+       if [ -r ${DELTA_UA} ]; then
+               sudo cp ${DELTA_UA} ${DELTA_DIR}/delta.ua
+               sudo rm ${DELTA_UA}
+       fi
+
        #--- archive result directory ---
        cd result/$MONDATE
        echo "tar result directory"
index 236f322..56ffcc1 100755 (executable)
@@ -436,6 +436,40 @@ fn_get_tar_file_names()
 
 }
 
+#------------------------------------------------------------------------------
+# Function :
+#      extract_delta_ua
+#
+# Description :
+#      extract delta binary (delta.ua) from given image
+#
+
+fn_extract_delta_ua()
+{
+       MNT_PNT=${PART_NAME}_MNT
+       mkdir -p ${MNT_PNT}
+
+       tar xvf ${DATA_DIR}/${NEW_TAR_DIR}/${NEW_TAR_FILE} $1
+       if [ "$?" != "0" ]; then
+               return 1;
+       fi
+
+       sudo mount -t ext4 -o loop $1 ${MNT_PNT}
+       if [ "$?" != "0" ]; then
+               return 1;
+       fi
+
+       DELTA_UA="${MNT_PNT}/usr/bin/delta.ua"
+       if [ -e ${DELTA_UA} ]; then
+               sudo cp ${DELTA_UA} ${DATA_DIR}/delta.ua
+       else
+               echo "There is no delta.ua in $1"
+       fi
+
+       sudo umount ${MNT_PNT}
+       sudo rm -rf ${MNT_PNT}
+       sudo rm -f $1
+}
 
 ###############################################################################
 #==================
@@ -497,6 +531,10 @@ NEW_TAR_FILE=
 
 fn_get_tar_file_names ${PART_BIN}
 
+if [ "${PART_NAME}" = "RAMDISK2" ]; then
+       fn_extract_delta_ua ${PART_BIN}
+fi
+
 if [ "z${OLD_TAR_FILE}" = "z" ]; then
        echo "[old] tar file does not exist in ${DATA_DIR}/${OLD_TAR_DIR} which contains ${PART_BIN}"
        #exit 0, cos this is not an error.