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 <jh80.chung@samsung.com>
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
}