summaryrefslogtreecommitdiffstats
path: root/bitbake/bin
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2015-05-04 12:16:48 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-05-12 12:14:12 +0100
commit13e88144bf3d68cc509452fd1a5356f7db8870bc (patch)
tree48c4cb00af651ca5edffdfce85ccd4a2f57ec38c /bitbake/bin
parent3b1bb2dfffe35a894bc08bb6c8caa24f4ac1db47 (diff)
downloadpoky-13e88144bf3d68cc509452fd1a5356f7db8870bc.tar.gz
bitbake: toaster: Make toaster script working in zsh
Fixed shell syntax not understood by zsh. Made toaster script to work for both shells in both modes: sourced and directly called. [YOCTO #6964] (Bitbake rev: e7b27843e2f37619dbe555a8883ac67f418f32dc) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/bin')
-rwxr-xr-xbitbake/bin/toaster26
1 files changed, 13 insertions, 13 deletions
diff --git a/bitbake/bin/toaster b/bitbake/bin/toaster
index 792fb7210c..8568c133ee 100755
--- a/bitbake/bin/toaster
+++ b/bitbake/bin/toaster
@@ -63,7 +63,7 @@ function webserverStartAll()
63 retval=0 63 retval=0
64 python $BBBASEDIR/lib/toaster/manage.py migrate orm || retval=1 64 python $BBBASEDIR/lib/toaster/manage.py migrate orm || retval=1
65 fi 65 fi
66 if [ "x$TOASTER_MANAGED" == "x1" ]; then 66 if [ "$TOASTER_MANAGED" '==' '1' ]; then
67 python $BBBASEDIR/lib/toaster/manage.py migrate bldcontrol || retval=1 67 python $BBBASEDIR/lib/toaster/manage.py migrate bldcontrol || retval=1
68 python $BBBASEDIR/lib/toaster/manage.py checksettings --traceback || retval=1 68 python $BBBASEDIR/lib/toaster/manage.py checksettings --traceback || retval=1
69 fi 69 fi
@@ -97,7 +97,7 @@ INSTOPSYSTEM=0
97function stop_system() 97function stop_system()
98{ 98{
99 # prevent reentry 99 # prevent reentry
100 if [ $INSTOPSYSTEM == 1 ]; then return; fi 100 if [ $INSTOPSYSTEM -eq 1 ]; then return; fi
101 INSTOPSYSTEM=1 101 INSTOPSYSTEM=1
102 if [ -f ${BUILDDIR}/.toasterui.pid ]; then 102 if [ -f ${BUILDDIR}/.toasterui.pid ]; then
103 kill $(< ${BUILDDIR}/.toasterui.pid ) 2>/dev/null 103 kill $(< ${BUILDDIR}/.toasterui.pid ) 2>/dev/null
@@ -119,7 +119,7 @@ function check_pidbyfile() {
119 119
120 120
121function notify_chldexit() { 121function notify_chldexit() {
122 if [ $NOTOASTERUI == 0 ]; then 122 if [ $NOTOASTERUI -eq 0 ]; then
123 check_pidbyfile ${BUILDDIR}/.toasterui.pid && return 123 check_pidbyfile ${BUILDDIR}/.toasterui.pid && return
124 stop_system 124 stop_system
125 fi 125 fi
@@ -143,8 +143,7 @@ function verify_prereq() {
143 143
144 144
145# read command line parameters 145# read command line parameters
146 146BBBASEDIR=`dirname ${BASH_SOURCE:-${(%):-%x}}`/..
147BBBASEDIR=`dirname ${BASH_SOURCE}`/..
148RUNNING=0 147RUNNING=0
149 148
150NOTOASTERUI=0 149NOTOASTERUI=0
@@ -168,8 +167,9 @@ for param in $*; do
168 esac 167 esac
169done 168done
170 169
170[ -z "$ZSH_NAME" ] && SRCFILE=${BASH_SOURCE} || SRCFILE=$_
171 171
172if [ -z "$ZSH_NAME" ] && [ `basename \"$0\"` = `basename \"$BASH_SOURCE\"` ]; then 172if [ `basename \"$0\"` = `basename \"${SRCFILE}\"` ]; then
173 # We are called as standalone. We refuse to run in a build environment - we need the interactive mode for that. 173 # We are called as standalone. We refuse to run in a build environment - we need the interactive mode for that.
174 # Start just the web server, point the web browser to the interface, and start any Django services. 174 # Start just the web server, point the web browser to the interface, and start any Django services.
175 175
@@ -183,7 +183,7 @@ if [ -z "$ZSH_NAME" ] && [ `basename \"$0\"` = `basename \"$BASH_SOURCE\"` ]; th
183 exit 1; 183 exit 1;
184 fi 184 fi
185 185
186 if [ "x`which daemon`" == "x" ]; then 186 if ! which daemon >/dev/null 2>&1; then
187 echo -e "Failed dependency; toaster needs the 'daemon' program in order to be able to start builds'. Please install the 'daemon' program from your distribution repositories or http://www.libslack.org/daemon/" 1>&2; 187 echo -e "Failed dependency; toaster needs the 'daemon' program in order to be able to start builds'. Please install the 'daemon' program from your distribution repositories or http://www.libslack.org/daemon/" 1>&2;
188 exit 1; 188 exit 1;
189 fi 189 fi
@@ -251,14 +251,14 @@ fi
251 251
252 252
253# We make sure we're running in the current shell and in a good environment 253# We make sure we're running in the current shell and in a good environment
254if [ -z "$BUILDDIR" ] || [ -z `which bitbake` ]; then 254if [ -z "$BUILDDIR" ] || ! which bitbake >/dev/null 2>&1 ; then
255 echo "Error: Build environment is not setup or bitbake is not in path." 1>&2; 255 echo "Error: Build environment is not setup or bitbake is not in path." 1>&2;
256 return 2 256 return 2
257fi 257fi
258 258
259 259
260# Determine the action. If specified by arguments, fine, if not, toggle it 260# Determine the action. If specified by arguments, fine, if not, toggle it
261if [ "x$1" == "xstart" ] || [ "x$1" == "xstop" ]; then 261if [ "$1" '==' 'start' ] || [ "$1" '==' 'stop' ]; then
262 CMD="$1" 262 CMD="$1"
263else 263else
264 if [ -z "$BBSERVER" ]; then 264 if [ -z "$BBSERVER" ]; then
@@ -274,16 +274,16 @@ echo "The system will $CMD."
274 274
275lock=1 275lock=1
276if [ -e $BUILDDIR/bitbake.lock ]; then 276if [ -e $BUILDDIR/bitbake.lock ]; then
277 (flock -n 200 ) 200<$BUILDDIR/bitbake.lock || lock=0 277 python -c "import fcntl; fcntl.flock(open(\"$BUILDDIR/bitbake.lock\"), fcntl.LOCK_EX|fcntl.LOCK_NB)" 2>/dev/null || lock=0
278fi 278fi
279 279
280if [ ${CMD} == "start" ] && [ $lock -eq 0 ]; then 280if [ ${CMD} '==' 'start' ] && [ $lock -eq 0 ]; then
281 echo "Error: bitbake lock state error. File locks show that the system is on." 1>&2 281 echo "Error: bitbake lock state error. File locks show that the system is on." 1>&2
282 echo "Please wait for the current build to finish, stop and then start the system again." 1>&2 282 echo "Please wait for the current build to finish, stop and then start the system again." 1>&2
283 return 3 283 return 3
284fi 284fi
285 285
286if [ ${CMD} == "start" ] && [ -e $BUILDDIR/.toastermain.pid ] && kill -0 `cat $BUILDDIR/.toastermain.pid`; then 286if [ ${CMD} '==' 'start' ] && [ -e $BUILDDIR/.toastermain.pid ] && kill -0 `cat $BUILDDIR/.toastermain.pid`; then
287 echo "Warning: bitbake appears to be dead, but the Toaster web server is running. Something fishy is going on." 1>&2 287 echo "Warning: bitbake appears to be dead, but the Toaster web server is running. Something fishy is going on." 1>&2
288 echo "Cleaning up the web server to start from a clean slate." 288 echo "Cleaning up the web server to start from a clean slate."
289 webserverKillAll 289 webserverKillAll
@@ -311,7 +311,7 @@ case $CMD in
311 echo "Bitbake server start failed" 311 echo "Bitbake server start failed"
312 else 312 else
313 export BBSERVER=0.0.0.0:-1 313 export BBSERVER=0.0.0.0:-1
314 if [ $NOTOASTERUI == 0 ]; then # we start the TOASTERUI only if not inhibited 314 if [ $NOTOASTERUI -eq 0 ]; then # we start the TOASTERUI only if not inhibited
315 bitbake --observe-only -u toasterui >>${BUILDDIR}/toaster_ui.log 2>&1 & echo $! >${BUILDDIR}/.toasterui.pid 315 bitbake --observe-only -u toasterui >>${BUILDDIR}/toaster_ui.log 2>&1 & echo $! >${BUILDDIR}/.toasterui.pid
316 fi 316 fi
317 fi 317 fi