From 666f33cc2487ae1425baf0e7920463c6d118d638 Mon Sep 17 00:00:00 2001
From: moebius/ALUG <fs11linux.20.masuefke@spamgourmet.com>
Date: Thu, 26 Mar 2015 21:02:07 +0100
Subject: [PATCH] Updated blkwrite.sh to display a progress bar

---
 MassStorageCloner/blkwrite.sh | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/MassStorageCloner/blkwrite.sh b/MassStorageCloner/blkwrite.sh
index 9485669..fafbc2e 100755
--- a/MassStorageCloner/blkwrite.sh
+++ b/MassStorageCloner/blkwrite.sh
@@ -32,12 +32,18 @@ fi
 SRC="$1"
 TGT="$2"
 
-if [ ! -b "$TGT" ]
+if [ ! -r "$SRC" ]
 then
-    echo "need a blockdevice as parameter 2"
+    echo "Source file >$SRC< is not readable. Exit."
     exit 2
 fi
 
+if [ ! -b "$TGT" ]
+then
+    echo "need a blockdevice as parameter 2. Exit."
+    exit 3
+fi
+
 if [ "x${TGT%%[0-9]*}" == "x$TGT" ]
 then
   # have a "master" block device
@@ -47,9 +53,9 @@ fi
 
 echo "Start copy operation"
 # live version
-pv -trabe -B8m $SRC | dd bs=8M iflag=fullblock of="$TGT" oflag=sync
+pv -trabep -B8m $SRC | dd bs=8M iflag=fullblock of="$TGT" oflag=sync
 # debug version
-#pv -trabe -B8m $SRC | dd bs=8M iflag=fullblock of=/dev/null oflag=sync
+#pv -trabep -B8m $SRC | dd bs=8M iflag=fullblock of=/dev/null oflag=sync
 res="$?"
 echo "Result code $res"
 
-- 
GitLab