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)
downloadpoky-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 @@
1#!/bin/bash 1#!/bin/bash -x
2 2
3# Handle running Poky images under qemu 3# Handle running Poky images under qemu
4# 4#
@@ -62,22 +62,26 @@ TAP=""
62LOCKFILE="" 62LOCKFILE=""
63for tap in $POSSIBLE; do 63for tap in $POSSIBLE; do
64 LOCKFILE="$LOCKDIR/$tap" 64 LOCKFILE="$LOCKDIR/$tap"
65 if lockfile $LOCKFILE; then 65 if lockfile -2 -r 1 $LOCKFILE; then
66 TAP=$tap 66 TAP=$tap
67 break; 67 break;
68 fi 68 fi
69done 69done
70 70
71if [ "$TAP" = "" ]; then 71if [ "$TAP" = "" ]; then
72 GROUPID=`id -g` 72 GROUPID=`id -g`
73 echo 'Setting up tap interface under sudo' 73 echo 'Setting up tap interface under sudo'
74 TAP=`sudo $QEMUIFUP $GROUPID $POKY_NATIVE_SYSROOT` 74 tap=`sudo $QEMUIFUP $GROUPID $POKY_NATIVE_SYSROOT`
75 if [ $? -ne 0 ]; then 75 if [ $? -ne 0 ]; then
76 # Re-run standalone to see verbose errors 76 # Re-run standalone to see verbose errors
77 sudo $QEMUIFUP $GROUPID $POKY_NATIVE_SYSROOT 77 sudo $QEMUIFUP $GROUPID $POKY_NATIVE_SYSROOT
78 return 78 return
79 fi 79 fi
80 LOCKFILE="" 80 LOCKFILE="$LOCKDIR/$tap"
81 if lockfile $LOCKFILE; then
82 TAP=$tap
83 break;
84 fi
81else 85else
82 echo "Using preconfigured tap device '$TAP'" 86 echo "Using preconfigured tap device '$TAP'"
83fi 87fi