Call function to wait for device to re-appear after partitioning device,
before formatting the same device.

Signed-off-by: Oscar Andreasson <[email protected]>
---
 scripts/contrib/mkefidisk.sh | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/scripts/contrib/mkefidisk.sh b/scripts/contrib/mkefidisk.sh
index 55f72b0..133c5bc 100755
--- a/scripts/contrib/mkefidisk.sh
+++ b/scripts/contrib/mkefidisk.sh
@@ -83,6 +83,17 @@ debug() {
        fi
 }
 
+waitfordevice() {
+    counter=0
+    while [ ! -e "$1" ]; do
+        sleep 1
+        counter=$(($counter+1))
+        if [ $counter -ge 10 ]; then
+            die  "Device $1 not showing up, something is probably wrong"
+        fi
+    done
+}
+
 usage() {
        echo "Usage: $(basename $0) [-v] DEVICE HDDIMG TARGET_DEVICE"
        echo "       -v: Verbose debug"
@@ -293,6 +304,7 @@ fi
 #
 unmount_device || die "Failed to unmount $DEVICE partitions"
 
+waitfordevice $BOOTFS
 
 #
 # Format $DEVICE partitions
-- 
2.1.4

-- 
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Reply via email to