summaryrefslogtreecommitdiffstats
path: root/bitbake/bin/toaster
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2015-05-21 18:00:41 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-06-12 00:01:49 +0100
commit5a013b562e4f593fab54f0fc88ff7a1bb71bf18b (patch)
tree32ef6249d65918897627c3fca18bd1fcf4d6d9dc /bitbake/bin/toaster
parent0eaf070337c6c3a771ff07e6057ebc28b8fec840 (diff)
downloadpoky-5a013b562e4f593fab54f0fc88ff7a1bb71bf18b.tar.gz
bitbake: toaster: Make toaster script to work in dash
Made it working in dash. Note, that due to dash limitations script will not work if sourced. (Bitbake rev: febf8bedf8f9d37659831cdde208d14ece2fb322) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/bin/toaster')
-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