[bitbake-devel] [PATCH 25/94] bitbake: webhob: fix and cleanup start script

Alex DAMIAN alexandru.damian at intel.com
Tue Sep 24 16:51:54 UTC 2013


From: Alexandru DAMIAN <alexandru.damian at intel.com>

Make sure that the script can start without a bitbake.lock
file present.
Fixes [YOCTO #4873].

Also, clean up whitespace.

Signed-off-by: Alexandru DAMIAN <alexandru.damian at intel.com>
---
 bitbake/bin/webhob | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/bitbake/bin/webhob b/bitbake/bin/webhob
index 8513a3a..44a25cb 100755
--- a/bitbake/bin/webhob
+++ b/bitbake/bin/webhob
@@ -21,8 +21,8 @@
 # use as:  source webhob [start|stop]
 
 # Helper function to kill a background webhob development server
-        
-function webserverKillAllComponents() 
+
+function webserverKillAllComponents()
 {
 	local pidfile
 	for pidfile in ${BUILDDIR}/whbmain.pid; do
@@ -42,7 +42,7 @@ if [ -z "$ZSH_NAME" ] && [ `basename "$0"` = `basename $BASH_SOURCE` ]; then
     echo "Error: This script needs to be sourced. Please run as 'source webhob [start|stop]'" 1>&2;
     exit 1
 fi
-    
+
 if [ -z "$BUILDDIR" ] || [ -z `which bitbake` ]; then
     echo "Error: Build environment is not setup or bitbake is not in path." 1>&2;
     return 2
@@ -64,15 +64,17 @@ fi
 # Make sure it's safe to run by checking bitbake lock
 
 lock=1
-(flock -n 200 ) 200<$BUILDDIR/bitbake.lock || lock=0 
+if [ -e $BUILDDIR/bitbake.lock ]; then
+    (flock -n 200 ) 200<$BUILDDIR/bitbake.lock || lock=0
+fi
 
 if [ ${CMD} == "start" ] && ( [ $lock -eq 0 ] || [ -e $BUILDDIR/whbmain.pid ] ); then
     echo "Error: bitbake lock state error. System may be already on." 2>&1
-    return 3 
+    return 3
 elif [ ${CMD} == "stop" ] && ( [ $lock -eq 1 ] || ! [ -e $BUILDDIR/whbmain.pid ] ) ; then
     echo "Error: bitbake lock state error. System may be already off.
 manually stop system with bitbake -m / webserverKillAllComponents" 2>&1
-    return 3 
+    return 3
 fi
 
 
@@ -82,7 +84,7 @@ case $CMD in
     start )
         unset BBSERVER
         python $BBBASEDIR/lib/webhob/manage.py syncdb || (echo "Failed db sync, stopping system start" 1>&2 && return 0)
-        bitbake --server-only -t xmlrpc -B localhost:8200 
+        bitbake --server-only -t xmlrpc -B localhost:8200
         export BBSERVER=localhost:8200
         bitbake --observe-only -u dsi >/dev/null 2>&1 & echo $! >${BUILDDIR}/dsi.pid
         python $BBBASEDIR/lib/webhob/manage.py runserver </dev/null >${BUILDDIR}/whbmain.log 2>&1 & echo $! >${BUILDDIR}/whbmain.pid
@@ -95,4 +97,4 @@ case $CMD in
         webserverKillAllComponents
 esac
 
-    
+
-- 
1.8.1.2




More information about the bitbake-devel mailing list