examples/mdev.conf.change_blockdev.sh: update
authorDenys Vlasenko <vda.linux@googlemail.com>
Tue, 2 Apr 2013 11:26:24 +0000 (13:26 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Tue, 2 Apr 2013 11:26:24 +0000 (13:26 +0200)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
examples/mdev.conf.change_blockdev.sh

index a479a9630d17657a996790e2eed47993e5cd224f..512e43fccc0fa35467e28359b56870d9478c4b3c 100755 (executable)
@@ -13,12 +13,17 @@ echo "Env:"
 env | sort
 
 while sleep 1; test $cnt != 0; do
-       echo "Trying to rereat partition table on $DEVNAME ($cnt)"
+       echo "Trying to reread partition table on $DEVNAME ($cnt)"
        : $((cnt--))
+       # If device node doesn't exist, it means the device was removed.
+       # Stop trying.
        test -e "$DEVNAME" || { echo "$DEVNAME doesn't exist, aborting"; exit 1; }
        #echo "$DEVNAME exists"
-       blockdev --rereadpt "$DEVNAME" && break
+       if blockdev --rereadpt "$DEVNAME"; then
+               echo "blockdev --rereadpt succeeded"
+               exit 0
+       fi
        echo "blockdev --rereadpt failed, exit code: $?"
 done
-echo "blockdev --rereadpt succeeded"
+echo "Timed out"
 ) &