Skip to contentSkip to conversation

ddimage: if 'pv' is installed, use it

PATCH New Christopher Larson 1 participant 1 message Apr 26, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ddimage: if 'pv' is installed, use it

From: Christopher Larson <[email protected]>

This gives us a progress bar for the image write, which is quite helpful. See
https://www.ivarch.com/programs/pv.shtml.

---
 scripts/contrib/ddimage | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
scripts/contrib/ddimage +5 -1
index a503f11..ab92995 100755
@@ -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
Signature · 1 line
2.8.0