diff options
author | Ed Bartosh <ed.bartosh@linux.intel.com> | 2015-05-04 12:16:48 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-05-12 12:14:12 +0100 |
commit | 13e88144bf3d68cc509452fd1a5356f7db8870bc (patch) | |
tree | 48c4cb00af651ca5edffdfce85ccd4a2f57ec38c /bitbake/bin | |
parent | 3b1bb2dfffe35a894bc08bb6c8caa24f4ac1db47 (diff) | |
download | openembedded-core-contrib-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-x | bitbake/bin/toaster | 26 |
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() retval=0 python $BBBASEDIR/lib/toaster/manage.py migrate orm || retval=1 fi - if [ "x$TOASTER_MANAGED" == "x1" ]; then + if [ "$TOASTER_MANAGED" '==' '1' ]; then python $BBBASEDIR/lib/toaster/manage.py migrate bldcontrol || retval=1 python $BBBASEDIR/lib/toaster/manage.py checksettings --traceback || retval=1 fi @@ -97,7 +97,7 @@ INSTOPSYSTEM=0 function stop_system() { # prevent reentry - if [ $INSTOPSYSTEM == 1 ]; then return; fi + if [ $INSTOPSYSTEM -eq 1 ]; then return; fi INSTOPSYSTEM=1 if [ -f ${BUILDDIR}/.toasterui.pid ]; then kill $(< ${BUILDDIR}/.toasterui.pid ) 2>/dev/null @@ -119,7 +119,7 @@ function check_pidbyfile() { function notify_chldexit() { - if [ $NOTOASTERUI == 0 ]; then + if [ $NOTOASTERUI -eq 0 ]; then check_pidbyfile ${BUILDDIR}/.toasterui.pid && return stop_system fi @@ -143,8 +143,7 @@ function verify_prereq() { # read command line parameters - -BBBASEDIR=`dirname ${BASH_SOURCE}`/.. +BBBASEDIR=`dirname ${BASH_SOURCE:-${(%):-%x}}`/.. RUNNING=0 NOTOASTERUI=0 @@ -168,8 +167,9 @@ for param in $*; do esac done +[ -z "$ZSH_NAME" ] && SRCFILE=${BASH_SOURCE} || SRCFILE=$_ -if [ -z "$ZSH_NAME" ] && [ `basename \"$0\"` = `basename \"$BASH_SOURCE\"` ]; then +if [ `basename \"$0\"` = `basename \"${SRCFILE}\"` ]; then # We are called as standalone. We refuse to run in a build environment - we need the interactive mode for that. # Start just the web server, point the web browser to the interface, and start any Django services. @@ -183,7 +183,7 @@ if [ -z "$ZSH_NAME" ] && [ `basename \"$0\"` = `basename \"$BASH_SOURCE\"` ]; th exit 1; fi - if [ "x`which daemon`" == "x" ]; then + if ! which daemon >/dev/null 2>&1; then 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; exit 1; fi @@ -251,14 +251,14 @@ fi # We make sure we're running in the current shell and in a good environment -if [ -z "$BUILDDIR" ] || [ -z `which bitbake` ]; then +if [ -z "$BUILDDIR" ] || ! which bitbake >/dev/null 2>&1 ; then echo "Error: Build environment is not setup or bitbake is not in path." 1>&2; return 2 fi # Determine the action. If specified by arguments, fine, if not, toggle it -if [ "x$1" == "xstart" ] || [ "x$1" == "xstop" ]; then +if [ "$1" '==' 'start' ] || [ "$1" '==' 'stop' ]; then CMD="$1" else if [ -z "$BBSERVER" ]; then @@ -274,16 +274,16 @@ echo "The system will $CMD." lock=1 if [ -e $BUILDDIR/bitbake.lock ]; then - (flock -n 200 ) 200<$BUILDDIR/bitbake.lock || lock=0 + python -c "import fcntl; fcntl.flock(open(\"$BUILDDIR/bitbake.lock\"), fcntl.LOCK_EX|fcntl.LOCK_NB)" 2>/dev/null || lock=0 fi -if [ ${CMD} == "start" ] && [ $lock -eq 0 ]; then +if [ ${CMD} '==' 'start' ] && [ $lock -eq 0 ]; then echo "Error: bitbake lock state error. File locks show that the system is on." 1>&2 echo "Please wait for the current build to finish, stop and then start the system again." 1>&2 return 3 fi -if [ ${CMD} == "start" ] && [ -e $BUILDDIR/.toastermain.pid ] && kill -0 `cat $BUILDDIR/.toastermain.pid`; then +if [ ${CMD} '==' 'start' ] && [ -e $BUILDDIR/.toastermain.pid ] && kill -0 `cat $BUILDDIR/.toastermain.pid`; then echo "Warning: bitbake appears to be dead, but the Toaster web server is running. Something fishy is going on." 1>&2 echo "Cleaning up the web server to start from a clean slate." webserverKillAll @@ -311,7 +311,7 @@ case $CMD in echo "Bitbake server start failed" else export BBSERVER=0.0.0.0:-1 - if [ $NOTOASTERUI == 0 ]; then # we start the TOASTERUI only if not inhibited + if [ $NOTOASTERUI -eq 0 ]; then # we start the TOASTERUI only if not inhibited bitbake --observe-only -u toasterui >>${BUILDDIR}/toaster_ui.log 2>&1 & echo $! >${BUILDDIR}/.toasterui.pid fi fi |