From: Jaehoon Chung Date: Wed, 8 Nov 2023 11:20:15 +0000 (+0900) Subject: upgrade-scripts: Store the log message before exit_error X-Git-Tag: accepted/tizen/unified/20231122.172552~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F99%2F301099%2F5;p=platform%2Fcore%2Fsystem%2Fupgrade.git upgrade-scripts: Store the log message before exit_error The created files of tmp directory will be removed after rebooting. That makes a difficult to debug when there is a problem. To remain the log message, copy all log files from /tmp/ to /var/log/fota/ before exit_error. If error is occurred, there should be the log files. Change-Id: I63bd28c9e2256ea3a417ee02c3f6c7a0e49641cf Signed-off-by: Jaehoon Chung --- diff --git a/scripts/upgrade-support/upgrade-common.inc b/scripts/upgrade-support/upgrade-common.inc index e11a0cf..a3aba08 100644 --- a/scripts/upgrade-support/upgrade-common.inc +++ b/scripts/upgrade-support/upgrade-common.inc @@ -305,6 +305,28 @@ set_upgrade_status() { exit_error() { set_upgrade_status -1 + LOG_DIR="/var/log/fota" + + if [ ! -d "$LOG_DIR" ]; then + /usr/bin/mkdir -p "$LOG_DIR" + fi + + if [ -e /tmp/upgrade-prepare-partitions.log ]; then + /usr/bin/mv /tmp/upgrade-prepare-partitions.log $LOG_DIR/ + fi + + if [ -e /tmp/upgrade-trigger.log ]; then + /usr/bin/mv /tmp/upgrade-trigger.log $LOG_DIR/ + fi + + if [ -e /tmp/upgrade-partial.log ]; then + /usr/bin/mv /tmp/upgrade-partial.log $LOG_DIR/ + fi + + if [ -e /tmp/update-fota.log ]; then + /usr/bin/mv /tmp/update-fota.log $LOG_DIR/ + fi + exit 1 }