summaryrefslogtreecommitdiff
path: root/recipes/images/files/library/imx6
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
commit104fcaea140e26ebf73c89cb67c905e8981c102e (patch)
tree6b42c93a04c5cc6a6fefe9db67177ab3ccd62a67 /recipes/images/files/library/imx6
parentc62ed6f52b3ac99b3d9f74047e60ea57870c378d (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/library/imx6')
-rwxr-xr-xrecipes/images/files/library/imx6/update.sh9
1 files changed, 7 insertions, 2 deletions
diff --git a/recipes/images/files/library/imx6/update.sh b/recipes/images/files/library/imx6/update.sh
index 0bf5380..b80e198 100755
--- a/recipes/images/files/library/imx6/update.sh
+++ b/recipes/images/files/library/imx6/update.sh
@@ -159,6 +159,10 @@ MKFSVFAT=`command -v mkfs.vfat` || MKFSVFAT=`sudo -s command -v mkfs.vfat` || {
MKFSEXT3=`command -v mkfs.ext3` || MKFSEXT3=`sudo -s command -v mkfs.ext3` || { echo >&2 "Program mkfs.ext3 not available. Aborting."; exit 1; }
dd --help >/dev/null 2>&1 || { echo >&2 "Program dd not available. Aborting."; exit 1; }
+#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
+
#make the directory with the outputfiles writable
sudo chown $USER: ${BINARIES}
@@ -278,7 +282,8 @@ sudo split -a 2 -b `expr 64 \* 1024 \* 1024` --numeric-suffixes=10 "$OUT_DIR/roo
fi
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