diff options
Diffstat (limited to 'bin/toaster')
-rwxr-xr-x | bin/toaster | 60 |
1 files changed, 39 insertions, 21 deletions
diff --git a/bin/toaster b/bin/toaster index ed365ee82..f002c8c15 100755 --- a/bin/toaster +++ b/bin/toaster @@ -3,26 +3,18 @@ # toaster - shell script to start Toaster # Copyright (C) 2013-2015 Intel Corp. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. # -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. +# SPDX-License-Identifier: GPL-2.0-or-later # -# You should have received a copy of the GNU General Public License -# along with this program. If not, see http://www.gnu.org/licenses/. HELP=" -Usage: source toaster start|stop [webport=<address:port>] [noweb] [nobuild] +Usage 1: source toaster start|stop [webport=<address:port>] [noweb] [nobuild] [toasterdir] Optional arguments: [nobuild] Setup the environment for capturing builds with toaster but disable managed builds [noweb] Setup the environment for capturing builds with toaster but don't start the web server [webport] Set the development server (default: localhost:8000) + [toasterdir] Set absolute path to be used as TOASTER_DIR (default: BUILDDIR/../) +Usage 2: source toaster manage [createsuperuser|lsupdates|migrate|makemigrations|checksettings|collectstatic|...] " custom_extention() @@ -41,7 +33,7 @@ databaseCheck() $MANAGE migrate --noinput || retval=1 if [ $retval -eq 1 ]; then - echo "Failed migrations, aborting system start" 1>&2 + echo "Failed migrations, halting system start" 1>&2 return $retval fi # Make sure that checksettings can pick up any value for TEMPLATECONF @@ -49,7 +41,7 @@ databaseCheck() $MANAGE checksettings --traceback || retval=1 if [ $retval -eq 1 ]; then - printf "\nError while checking settings; aborting\n" + printf "\nError while checking settings; exiting\n" return $retval fi @@ -92,7 +84,7 @@ webserverStartAll() echo "Starting webserver..." $MANAGE runserver --noreload "$ADDR_PORT" \ - </dev/null >>${BUILDDIR}/toaster_web.log 2>&1 \ + </dev/null >>${TOASTER_LOGS_DIR}/web.log 2>&1 \ & echo $! >${BUILDDIR}/.toastermain.pid sleep 1 @@ -160,7 +152,9 @@ fi export BBBASEDIR=`dirname $TOASTER`/.. MANAGE="python3 $BBBASEDIR/lib/toaster/manage.py" -OE_ROOT=`dirname $TOASTER`/../.. +if [ -z "$OE_ROOT" ]; then + OE_ROOT=`dirname $TOASTER`/../.. +fi # this is the configuraton file we are using for toaster # we are using the same logic that oe-setup-builddir uses @@ -186,6 +180,15 @@ unset OE_ROOT WEBSERVER=1 export TOASTER_BUILDSERVER=1 ADDR_PORT="localhost:8000" +TOASTERDIR=`dirname $BUILDDIR` +# ${BUILDDIR}/toaster_logs/ became the default location for toaster logs +# This is needed for implemented django-log-viewer: https://pypi.org/project/django-log-viewer/ +# If the directory does not exist, create it. +TOASTER_LOGS_DIR="${BUILDDIR}/toaster_logs/" +if [ ! -d $TOASTER_LOGS_DIR ] +then + mkdir $TOASTER_LOGS_DIR +fi unset CMD for param in $*; do case $param in @@ -211,13 +214,24 @@ for param in $*; do ADDR_PORT="localhost:$PORT" fi ;; + toasterdir=*) + TOASTERDIR="${param#*=}" + ;; + manage ) + CMD=$param + manage_cmd="" + ;; --help) echo "$HELP" return 0 ;; *) - echo "$HELP" - return 1 + if [ "manage" == "$CMD" ] ; then + manage_cmd="$manage_cmd $param" + else + echo "$HELP" + exit 1 + fi ;; esac @@ -241,8 +255,8 @@ fi # 2) the build dir (in build) # 3) the sqlite db if that is being used. # 4) pid's we need to clean up on exit/shutdown -export TOASTER_DIR=`dirname $BUILDDIR` -export BB_ENV_EXTRAWHITE="$BB_ENV_EXTRAWHITE TOASTER_DIR" +export TOASTER_DIR=$TOASTERDIR +export BB_ENV_PASSTHROUGH_ADDITIONS="$BB_ENV_PASSTHROUGH_ADDITIONS TOASTER_DIR" # Determine the action. If specified by arguments, fine, if not, toggle it if [ "$CMD" = "start" ] ; then @@ -293,7 +307,7 @@ case $CMD in export BITBAKE_UI='toasterui' if [ $TOASTER_BUILDSERVER -eq 1 ] ; then $MANAGE runbuilds \ - </dev/null >>${BUILDDIR}/toaster_runbuilds.log 2>&1 \ + </dev/null >>${TOASTER_LOGS_DIR}/toaster_runbuilds.log 2>&1 \ & echo $! >${BUILDDIR}/.runbuilds.pid else echo "Toaster build server not started." @@ -309,6 +323,10 @@ case $CMD in stop_system echo "Successful ${CMD}." ;; + manage ) + cd $BBBASEDIR/lib/toaster + $MANAGE $manage_cmd + ;; esac custom_extention toaster_postpend $CMD $ADDR_PORT |