]> code.ossystems Code Review - openembedded-core.git/commitdiff
ddimage: if 'pv' is installed, use it
authorChristopher Larson <chris_larson@mentor.com>
Tue, 26 Apr 2016 04:56:18 +0000 (21:56 -0700)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 6 May 2016 09:30:59 +0000 (10:30 +0100)
This gives us a progress bar for the image write, which is quite helpful. See
https://www.ivarch.com/programs/pv.shtml.

Signed-off-by: Christopher Larson <chris_larson@mentor.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
scripts/contrib/ddimage

index a503f11d0dd8e4d83f1aa012cd813382c2a8f0e9..ab929957a5a2bf76452c6856fa648befd8f7d6d6 100755 (executable)
@@ -100,5 +100,9 @@ if [ "$RESPONSE" != "y" ]; then
 fi
 
 echo "Writing image..."
-dd if="$IMAGE" of="$DEVICE" bs="$BLOCKSIZE"
+if which pv >/dev/null 2>&1; then
+       pv "$IMAGE" | dd of="$DEVICE" bs="$BLOCKSIZE"
+else
+       dd if="$IMAGE" of="$DEVICE" bs="$BLOCKSIZE"
+fi
 sync