Add support for checkpoint & restore on hal partition. 67/264467/2 accepted/tizen/6.5/unified/20211028.114820 accepted/tizen/unified/20210926.235754 submit/tizen/20210924.144745 submit/tizen_6.5/20211028.162501 tizen_6.5.m2_release
authorErnest Borowski <e.borowski@samsung.com>
Wed, 22 Sep 2021 17:19:58 +0000 (17:19 +0000)
committerErnest Borowski <e.borowski@samsung.com>
Fri, 24 Sep 2021 10:12:16 +0000 (10:12 +0000)
This change is required to support updating /hal partition upgrade
during fota.

Change-Id: I3dfeb490907711813273cf0261f530ba15d1eeec
Signed-off-by: Ernest Borowski <e.borowski@samsung.com>
scripts/fota-init.sh

index c9553bc..bf70cad 100755 (executable)
@@ -47,6 +47,7 @@ FOTA_GUI_ENABLE=
 
 SYSTEM_DATA_MNT=opt
 USER_MNT=opt/usr
+HAL_MNT=hal
 
 SCRIPT_NAME="fota-init.sh"
 UPGRADE_SUCCESS=0
@@ -69,6 +70,7 @@ get_partition_id() {
        PART_ROOTFS=$("$BLKID" --match-token PARTLABEL=rootfs -o device || "$BLKID" --match-token LABEL=rootfs -o device)
        PART_SYSTEM_DATA=$("$BLKID" --match-token PARTLABEL=system-data -o device || "$BLKID" --match-token LABEL=system-data -o device)
        PART_USER=$("$BLKID" --match-token PARTLABEL=user -o device || "$BLKID" --match-token LABEL=user -o device)
+       PART_HAL=$("$BLKID" --match-token PARTLABEL=hal -o device || "$BLKID" --match-token LABEL=hal -o device)
 }
 
 delete_btrfs_snapshot() {
@@ -346,6 +348,11 @@ mount_partitions() {
                        return 1
                fi
        fi
+       if [ ! "z${PART_HAL}" = "z" ]; then
+               if ! restore_mount_checkpoint_partition hal "${PART_HAL}" "${FAKE_ROOT}/${HAL_MNT}"; then
+                       return 1
+               fi
+       fi
 
        "$MOUNT" -t proc none "${FAKE_ROOT}/proc"
        "$MOUNT" -t sysfs none "${FAKE_ROOT}/sys"
@@ -387,6 +394,13 @@ umount_partitions() {
        "$UMOUNT" "${FAKE_ROOT}/sys"
        "$UMOUNT" "${FAKE_ROOT}/proc"
 
+       if [ ! "z${PART_HAL}" = "z" ]; then
+               if [ "${UPGRADE_SUCCESS}" = "1" ]; then
+                               commit_partition hal "${FAKE_ROOT}/${HAL_MNT}"
+               fi
+               umount_partition hal "${FAKE_ROOT}/${HAL_MNT}"
+       fi
+
        if [ ! "z${PART_USER}" = "z" ]; then
                if [ "${UPGRADE_SUCCESS}" = "1" ]; then
                        commit_partition user "${FAKE_ROOT}/${USER_MNT}"