summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake')
-rwxr-xr-xbitbake/bin/toaster27
1 files changed, 18 insertions, 9 deletions
diff --git a/bitbake/bin/toaster b/bitbake/bin/toaster
index 0fa8b60142..411ce2c356 100755
--- a/bitbake/bin/toaster
+++ b/bitbake/bin/toaster
@@ -1,4 +1,4 @@
1#!/bin/bash 1#!/bin/sh
2# (c) 2013 Intel Corp. 2# (c) 2013 Intel Corp.
3 3
4# This program is free software; you can redistribute it and/or modify 4# This program is free software; you can redistribute it and/or modify
@@ -54,7 +54,7 @@ webserverStartAll()
54 fi 54 fi
55 55
56 retval=0 56 retval=0
57 if [ "$TOASTER_MANAGED" '==' '1' ]; then 57 if [ "$TOASTER_MANAGED" '=' '1' ]; then
58 python $BBBASEDIR/lib/toaster/manage.py syncdb || retval=1 58 python $BBBASEDIR/lib/toaster/manage.py syncdb || retval=1
59 else 59 else
60 python $BBBASEDIR/lib/toaster/manage.py syncdb --noinput || retval=1 60 python $BBBASEDIR/lib/toaster/manage.py syncdb --noinput || retval=1
@@ -68,7 +68,7 @@ webserverStartAll()
68 retval=0 68 retval=0
69 python $BBBASEDIR/lib/toaster/manage.py migrate orm || retval=1 69 python $BBBASEDIR/lib/toaster/manage.py migrate orm || retval=1
70 fi 70 fi
71 if [ "$TOASTER_MANAGED" '==' '1' ]; then 71 if [ "$TOASTER_MANAGED" = '1' ]; then
72 python $BBBASEDIR/lib/toaster/manage.py migrate bldcontrol || retval=1 72 python $BBBASEDIR/lib/toaster/manage.py migrate bldcontrol || retval=1
73 python $BBBASEDIR/lib/toaster/manage.py checksettings --traceback || retval=1 73 python $BBBASEDIR/lib/toaster/manage.py checksettings --traceback || retval=1
74 fi 74 fi
@@ -148,7 +148,16 @@ verify_prereq() {
148 148
149 149
150# read command line parameters 150# read command line parameters
151BBBASEDIR=`dirname ${BASH_SOURCE:-${(%):-%x}}`/.. 151if [ -n "$BASH_SOURCE" ] ; then
152 TOASTER=${BASH_SOURCE}
153elif [ -n "$ZSH_NAME" ] ; then
154 TOASTER=${(%):-%x}
155else
156 TOASTER=$0
157fi
158
159BBBASEDIR=`dirname $TOASTER`/..
160
152RUNNING=0 161RUNNING=0
153 162
154NOTOASTERUI=0 163NOTOASTERUI=0
@@ -176,7 +185,7 @@ for param in $*; do
176 esac 185 esac
177done 186done
178 187
179[ -z "$ZSH_NAME" ] && SRCFILE=${BASH_SOURCE} || SRCFILE=$_ 188[ -n "${BASH_SOURCE}" ] && SRCFILE=${BASH_SOURCE} || SRCFILE=$_
180 189
181if [ `basename \"$0\"` = `basename \"${SRCFILE}\"` ]; then 190if [ `basename \"$0\"` = `basename \"${SRCFILE}\"` ]; then
182 # We are called as standalone. We refuse to run in a build environment - we need the interactive mode for that. 191 # We are called as standalone. We refuse to run in a build environment - we need the interactive mode for that.
@@ -236,7 +245,7 @@ if [ `basename \"$0\"` = `basename \"${SRCFILE}\"` ]; then
236 echo "Starting browser..." 245 echo "Starting browser..."
237 xdg-open http://127.0.0.1:$WEB_PORT/ >/dev/null 2>&1 & 246 xdg-open http://127.0.0.1:$WEB_PORT/ >/dev/null 2>&1 &
238 fi 247 fi
239 trap trap_ctrlc SIGINT 248 trap trap_ctrlc 2
240 echo "Toaster is now running. You can stop it with Ctrl-C" 249 echo "Toaster is now running. You can stop it with Ctrl-C"
241 while [ $RUNNING -gt 0 ]; do 250 while [ $RUNNING -gt 0 ]; do
242 python $BBBASEDIR/lib/toaster/manage.py runbuilds 2>&1 | tee -a "$BUILDDIR/toaster.log" 251 python $BBBASEDIR/lib/toaster/manage.py runbuilds 2>&1 | tee -a "$BUILDDIR/toaster.log"
@@ -262,7 +271,7 @@ fi
262 271
263 272
264# Determine the action. If specified by arguments, fine, if not, toggle it 273# Determine the action. If specified by arguments, fine, if not, toggle it
265if [ "$1" '==' 'start' ] || [ "$1" '==' 'stop' ]; then 274if [ "$1" = 'start' ] || [ "$1" = 'stop' ]; then
266 CMD="$1" 275 CMD="$1"
267else 276else
268 if [ -z "$BBSERVER" ]; then 277 if [ -z "$BBSERVER" ]; then
@@ -281,13 +290,13 @@ if [ -e $BUILDDIR/bitbake.lock ]; then
281 python -c "import fcntl; fcntl.flock(open(\"$BUILDDIR/bitbake.lock\"), fcntl.LOCK_EX|fcntl.LOCK_NB)" 2>/dev/null || lock=0 290 python -c "import fcntl; fcntl.flock(open(\"$BUILDDIR/bitbake.lock\"), fcntl.LOCK_EX|fcntl.LOCK_NB)" 2>/dev/null || lock=0
282fi 291fi
283 292
284if [ ${CMD} '==' 'start' ] && [ $lock -eq 0 ]; then 293if [ ${CMD} = 'start' ] && [ $lock -eq 0 ]; then
285 echo "Error: bitbake lock state error. File locks show that the system is on." 1>&2 294 echo "Error: bitbake lock state error. File locks show that the system is on." 1>&2
286 echo "Please wait for the current build to finish, stop and then start the system again." 1>&2 295 echo "Please wait for the current build to finish, stop and then start the system again." 1>&2
287 return 3 296 return 3
288fi 297fi
289 298
290if [ ${CMD} '==' 'start' ] && [ -e $BUILDDIR/.toastermain.pid ] && kill -0 `cat $BUILDDIR/.toastermain.pid`; then 299if [ ${CMD} = 'start' ] && [ -e $BUILDDIR/.toastermain.pid ] && kill -0 `cat $BUILDDIR/.toastermain.pid`; then
291 echo "Warning: bitbake appears to be dead, but the Toaster web server is running. Something fishy is going on." 1>&2 300 echo "Warning: bitbake appears to be dead, but the Toaster web server is running. Something fishy is going on." 1>&2
292 echo "Cleaning up the web server to start from a clean slate." 301 echo "Cleaning up the web server to start from a clean slate."
293 webserverKillAll 302 webserverKillAll