diff options
author | Saul Wold <Saul.Wold@intel.com> | 2010-09-17 11:33:01 -0700 |
---|---|---|
committer | Saul Wold <Saul.Wold@intel.com> | 2010-09-17 11:30:44 -0700 |
commit | 0be92981b32a595e7f48d6589d0e7d73c00ede98 (patch) | |
tree | 610a009bd5fbbcf80cd501bdbff2cd51953deaa4 | |
parent | a67d9dcaa9fb724034b874849b27c5c1ee0b0ec1 (diff) | |
download | poky-0be92981b32a595e7f48d6589d0e7d73c00ede98.tar.gz |
poky-qemu-internal: fix locking of tap lockfile
Signed-off-by: Saul Wold <Saul.Wold@intel.com>
-rwxr-xr-x | scripts/poky-qemu-internal | 14 |
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="" | |||
62 | LOCKFILE="" | 62 | LOCKFILE="" |
63 | for tap in $POSSIBLE; do | 63 | for 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 |
69 | done | 69 | done |
70 | 70 | ||
71 | if [ "$TAP" = "" ]; then | 71 | if [ "$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 | ||
81 | else | 85 | else |
82 | echo "Using preconfigured tap device '$TAP'" | 86 | echo "Using preconfigured tap device '$TAP'" |
83 | fi | 87 | fi |