From 9142379e33d330fb46b3637c5612b5bbcb40890f Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Mon, 6 Feb 2017 17:38:21 +0100 Subject: mount-nv: make it clear which phase is formating and which phase is mounting When called with --format, we want to see the "formating" message appear as it can be long and avoids to scare users when seeing a long "mounting..." phase. --- scripts/mount-nv | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/scripts/mount-nv b/scripts/mount-nv index 3679c3f..2de6544 100755 --- a/scripts/mount-nv +++ b/scripts/mount-nv @@ -271,7 +271,12 @@ fi # Trick: we enter the directory before we remount over it cd $PERSIST_DIR -echo "Mounting $FLASH_NV on $PERSIST_DIR..." + +if [ -z "$DO_FORMAT" ]; then + echo "Mounting $FLASH_NV on $PERSIST_DIR..." +else + echo "Formating $FLASH_NV..." +fi if [ "$FS_TYPE" = jffs2 ]; then # Note: this one uses MTDBLOCK @@ -306,6 +311,8 @@ if [ "$FS_TYPE" = jffs2 ]; then # simulate a flash full of 0xFF tr '\000' '\377' /dev/null + sync + echo "Mounting $FLASH_NV on $PERSIST_DIR..." if ! mount -t $FS_TYPE $MTDBLOCK $PERSIST_DIR 2>/dev/null; then echo "Error: failed to format $FLASH_NV using $FS_TYPE." modprobe -r block2mtd mtdblock 2>/dev/null @@ -343,6 +350,8 @@ else if [ $FS_TYPE = ext2 -o $FS_TYPE = ext3 -o $FS_TYPE = ext4 ]; then mke2fs -t $FS_TYPE -q -s 1 -m 0 $FLASH_NV tune2fs -c 0 -i 0 $FLASH_NV + sync + echo "Mounting $FLASH_NV on $PERSIST_DIR..." if ! mount -t $FS_TYPE $FLASH_NV $PERSIST_DIR 2>/dev/null; then echo "Error: failed to format $FLASH_NV using $FS_TYPE." exit 1 -- 1.7.12.1