Check the result of hash remaking 36/246436/1
authorKichan Kwon <k_c.kwon@samsung.com>
Thu, 29 Oct 2020 01:43:57 +0000 (10:43 +0900)
committerKichan Kwon <k_c.kwon@samsung.com>
Thu, 29 Oct 2020 01:45:39 +0000 (10:45 +0900)
Change-Id: I3b34d42570f712099aa7bafc641ef95fccd912c8
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
scripts/fota-init.sh

index 937c44e..ab6559a 100755 (executable)
@@ -294,10 +294,22 @@ remake_hash_table() {
        if [ -f "${VERITYCTL}" ]; then
                if [ -f "${VERITY_HANDLER}" ]; then
                        "$MOUNT" -o remount,ro ${FAKE_ROOT}
+
                        "${VERITY_HANDLER}" ${PART_ROOTFS}
+                       if [ $? -ne 0 ]; then
+                               echo "verity-handler fail!!!"
+                               return 1
+                       else
+                               echo "verity-handler success"
+                               return 0
+                       fi
                else
                        echo "Warning: ${VERITYCTL} exists but ${VERITY_HANDLER} not exists"
+                       return 2
                fi
+       else
+               echo "verityctl not exist. Skip hash remaking"
+               return 0
        fi
 }
 
@@ -334,9 +346,11 @@ if [ "$fota_result" = "0" ]; then
 fi
 
 remake_hash_table
+remake_result=$?
+
 umount_partitions
 
-if [ "$fota_result" = "0" ]; then
+if [ "$fota_result" = "0" ] && [ "$remake_result" = "0" ]; then
        exec /sbin/fus_rw-init
 else
        echo "Upgrade FAILED"