summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/poky-qemu-internal25
1 files changed, 20 insertions, 5 deletions
diff --git a/scripts/poky-qemu-internal b/scripts/poky-qemu-internal
index c65e0f1de2..c3720d9ce2 100755
--- a/scripts/poky-qemu-internal
+++ b/scripts/poky-qemu-internal
@@ -55,6 +55,13 @@ QEMUIFDOWN=`which poky-qemu-ifdown`
55 55
56NFSRUNNING="false" 56NFSRUNNING="false"
57 57
58LOCKUTIL=`which lockfile-create`
59if [ -z "$LOCKUTIL" ]; then
60 echo "Error: Unable to find the lockfile-create utility"
61 echo "On Ubuntu systems this is included in the lockfile-progs package"
62 return
63fi
64
58LOCKDIR="/tmp/qemu-tap-locks" 65LOCKDIR="/tmp/qemu-tap-locks"
59[ ! -d "$LOCKDIR" ] && mkdir $LOCKDIR 66[ ! -d "$LOCKDIR" ] && mkdir $LOCKDIR
60 67
@@ -63,10 +70,14 @@ TAP=""
63LOCKFILE="" 70LOCKFILE=""
64for tap in $POSSIBLE; do 71for tap in $POSSIBLE; do
65 LOCKFILE="$LOCKDIR/$tap" 72 LOCKFILE="$LOCKDIR/$tap"
66 if lockfile -2 -r 1 $LOCKFILE; then 73 echo "Acquiring lockfile for $tap..."
74 if lockfile-create --use-pid -r 1 $LOCKFILE; then
75 # the --use-pid option to lockfile-create will give use
76 # the subshell's pid, so override it with the shell's pid:
77 echo $$ > $LOCKFILE.lock
67 TAP=$tap 78 TAP=$tap
68 break; 79 break
69 fi 80 fi
70done 81done
71 82
72if [ "$TAP" = "" ]; then 83if [ "$TAP" = "" ]; then
@@ -79,7 +90,11 @@ if [ "$TAP" = "" ]; then
79 return 90 return
80 fi 91 fi
81 LOCKFILE="$LOCKDIR/$tap" 92 LOCKFILE="$LOCKDIR/$tap"
82 if lockfile $LOCKFILE; then 93 echo "Acquiring lockfile for $tap..."
94 if lockfile-create --use-pid -r 1 $LOCKFILE; then
95 # the --use-pid option to lockfile-create will give us
96 # the subshell's pid, so override it with the shell's pid:
97 echo $$ > $LOCKFILE.lock
83 TAP=$tap 98 TAP=$tap
84 fi 99 fi
85else 100else
@@ -91,7 +106,7 @@ release_lock() {
91 $QEMUIFDOWN $TAP $POKY_NATIVE_SYSROOT 106 $QEMUIFDOWN $TAP $POKY_NATIVE_SYSROOT
92 else 107 else
93 echo "Releasing lockfile of preconfigured tap device '$TAP'" 108 echo "Releasing lockfile of preconfigured tap device '$TAP'"
94 rm -f $LOCKFILE 109 lockfile-remove $LOCKFILE
95 fi 110 fi
96 111
97 if [ "$NFSRUNNING" = "true" ]; then 112 if [ "$NFSRUNNING" = "true" ]; then