poky-qemu-internal: fix locking of tap lockfile

Signed-off-by: Saul Wold <Saul.Wold@intel.com>
This commit is contained in:
Saul Wold 2010-09-17 11:33:01 -07:00
parent a67d9dcaa9
commit 0be92981b3
1 changed files with 9 additions and 5 deletions

View File

@ -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