[OE-core] [meta-oe][PATCH] mkefidisk.sh: Added function to wait for devices to show up

Oscar Andreasson oscar.andreasson at pelagicore.com
Thu Jul 23 22:51:44 UTC 2015


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

Signed-off-by: Oscar Andreasson <oscar.andreasson at pelagicore.com>
---
 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




More information about the Openembedded-core mailing list