summaryrefslogtreecommitdiff
path: root/recipes/images/files/colibri-imx7/update.sh
diff options
context:
space:
mode:
authorStefan Agner <stefan.agner@toradex.com>2016-04-19 16:37:19 -0700
committerMarcel Ziswiler <marcel.ziswiler@toradex.com>2016-06-24 00:51:12 +0200
commit546fbde71bea902b8e6bc0c3e00c01aaa2a39199 (patch)
treec826dd184c93017741acdc3ed4947af6f5480afc /recipes/images/files/colibri-imx7/update.sh
parent1830cee8ec7887dbfadd8e6cac0e73ca5be4c06b (diff)
update.sh: use exit trap to report unexpected exits
Add exit trap to report unexpected exits (due to set -e). Note that this traps every exit, also explicit calls to exit. Therefor register the trap only during the sequencial image generating/coping part, after the sanity checks... Signed-off-by: Stefan Agner <stefan.agner@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Diffstat (limited to 'recipes/images/files/colibri-imx7/update.sh')
-rwxr-xr-xrecipes/images/files/colibri-imx7/update.sh10
1 files changed, 7 insertions, 3 deletions
diff --git a/recipes/images/files/colibri-imx7/update.sh b/recipes/images/files/colibri-imx7/update.sh
index ee44989..d531b98 100755
--- a/recipes/images/files/colibri-imx7/update.sh
+++ b/recipes/images/files/colibri-imx7/update.sh
@@ -141,8 +141,11 @@ if [ "$CNT" -eq 0 ] ; then
exit 1
fi
+#Install trap to write a sensible message in case any of the commands below
+#exit premature...
+trap '{ printf "\033[31mScript aborted unexpectedly...\033[0m\n"; }' EXIT
+
# Prepare full flashing
-#build ${IMAGEFILE} if it does not exist
sudo $LOCPATH/mkfs.ubifs --space-fixup -c ${MAXLEB} -e ${BLOCK} -m ${PAGE} -o ${BINARIES}/${IMAGEFILE} -r rootfs/ -v
echo ""
@@ -167,7 +170,8 @@ sudo cp ${BINARIES}/fwd_eth.img "$OUT_DIR/../flash_eth.img"
sudo rm ${BINARIES}/ubifs.img ${BINARIES}/versions.txt
sync
-echo "Successfully copied data to target folder."
-echo ""
+#Remove trap and report success!
+trap - EXIT
+printf "\033[32mSuccessfully copied data to target folder.\033[0m\n\n"
Flash