From 94b7c529b883ea980f900bb3f42547ba45a9ecd9 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Wed, 24 Aug 2016 15:06:42 +0200 Subject: mount-nv: fail on formating error If the formating fails when passing "--format", we currently only report an error message and continue with other possible errors then exit 0. First it's important to emit a relevant error message, and second we must exit immediately upon such a failure. --- scripts/mount-nv | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/mount-nv b/scripts/mount-nv index 15a7960..eb5ddc0 100755 --- a/scripts/mount-nv +++ b/scripts/mount-nv @@ -86,7 +86,9 @@ if mkdir -p $PERSIST_DIR 2>/dev/null; then tr '\000' '\377' /dev/null mount -t jffs2 $mtdblock $PERSIST_DIR 2>/dev/null if [ "$?" != "0" ] ; then - echo "Unable to format." + echo "Error: unable to format $FLASH_NV using JFFS2." + modprobe -r block2mtd mtdblock 2>/dev/null + exit 1 fi else echo "Error: mount failed, nv seems not formatted use option --format." -- 1.7.12.1