From: Mateusz Moscicki Date: Tue, 17 May 2022 08:50:45 +0000 (+0200) Subject: Error handling of checkpoint creation X-Git-Tag: accepted/tizen/7.0/unified/20221110.060312~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5e59cfeda7c829aec0233134b01c4ac30f5b7516;p=platform%2Fcore%2Fsystem%2Fsystem-rw-update.git Error handling of checkpoint creation Change-Id: Iabae1e33e69fc347335f9804b1fba8abacf80915 --- diff --git a/upgrade/update-checkpoint-create.sh b/upgrade/update-checkpoint-create.sh index cc276d1..4d4c1ed 100755 --- a/upgrade/update-checkpoint-create.sh +++ b/upgrade/update-checkpoint-create.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash PATH="/usr/bin:/bin:/usr/sbin:/sbin" SYNC="/bin/sync" @@ -15,6 +15,15 @@ USER_MNT="opt/usr" HAL_MNT="hal" BTRFS="/usr/sbin/btrfs" +exit_handler() { + if [ $? -ne 0 ]; then + echo "[Error] Failure to create checkpoint. Reboot." + reboot -f + exit 1 + fi + echo "[Debug] Checkpoint created" +} + 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) @@ -41,15 +50,26 @@ mount_bow_partition() { DM_NUMBER=$(($("${STAT}" -c "0x%T" $(readlink -f ${BOWDEV_PATH})))) echo 1 > /sys/block/dm-${DM_NUMBER}/bow/state - echo "[Debug] Mounted ${PARTITION} as DM-BOW" + if [ "$(