[OE-core] [PATCH] ddimage: if 'pv' is installed, use it

Christopher Larson kergoth at gmail.com
Tue Apr 26 04:56:18 UTC 2016


From: Christopher Larson <chris_larson at mentor.com>

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 at mentor.com>
---
 scripts/contrib/ddimage | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/scripts/contrib/ddimage b/scripts/contrib/ddimage
index a503f11..ab92995 100755
--- a/scripts/contrib/ddimage
+++ b/scripts/contrib/ddimage
@@ -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
-- 
2.8.0




More information about the Openembedded-core mailing list