summaryrefslogtreecommitdiffstats
path: root/scripts/poky-qemu-internal
diff options
context:
space:
mode:
authorSaul Wold <Saul.Wold@intel.com>2010-09-17 11:33:01 -0700
committerSaul Wold <Saul.Wold@intel.com>2010-09-17 11:30:44 -0700
commit0be92981b32a595e7f48d6589d0e7d73c00ede98 (patch)
tree610a009bd5fbbcf80cd501bdbff2cd51953deaa4 /scripts/poky-qemu-internal
parenta67d9dcaa9fb724034b874849b27c5c1ee0b0ec1 (diff)
downloadopenembedded-core-contrib-0be92981b32a595e7f48d6589d0e7d73c00ede98.tar.gz
poky-qemu-internal: fix locking of tap lockfile
Signed-off-by: Saul Wold <Saul.Wold@intel.com>
Diffstat (limited to 'scripts/poky-qemu-internal')
-rwxr-xr-xscripts/poky-qemu-internal14
1 files changed, 9 insertions, 5 deletions
diff --git a/scripts/poky-qemu-internal b/scripts/poky-qemu-internal
index f1aa43945a..c28568049c 100755
--- a/scripts/poky-qemu-internal
+++ b/scripts/poky-qemu-internal
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/bash -x
# Handle running Poky images under qemu
#
@@ -62,22 +62,26 @@ TAP=""
LOCKFILE=""
for tap in $POSSIBLE; do
LOCKFILE="$LOCKDIR/$tap"
- if lockfile $LOCKFILE; then
+ if lockfile -2 -r 1 $LOCKFILE; then
TAP=$tap
break;
- fi
+ fi
done
if [ "$TAP" = "" ]; then
GROUPID=`id -g`
echo 'Setting up tap interface under sudo'
- TAP=`sudo $QEMUIFUP $GROUPID $POKY_NATIVE_SYSROOT`
+ tap=`sudo $QEMUIFUP $GROUPID $POKY_NATIVE_SYSROOT`
if [ $? -ne 0 ]; then
# Re-run standalone to see verbose errors
sudo $QEMUIFUP $GROUPID $POKY_NATIVE_SYSROOT
return
fi
- LOCKFILE=""
+ LOCKFILE="$LOCKDIR/$tap"
+ if lockfile $LOCKFILE; then
+ TAP=$tap
+ break;
+ fi
else
echo "Using preconfigured tap device '$TAP'"
fi