diff options
Diffstat (limited to 'bin/toaster')
-rwxr-xr-x | bin/toaster | 49 |
1 files changed, 30 insertions, 19 deletions
diff --git a/bin/toaster b/bin/toaster index ecf66fa51..f002c8c15 100755 --- a/bin/toaster +++ b/bin/toaster @@ -3,27 +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] [toasterdir] +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() @@ -42,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 @@ -50,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 @@ -93,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 @@ -190,6 +181,14 @@ 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 @@ -218,13 +217,21 @@ for param in $*; do 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 @@ -249,7 +256,7 @@ fi # 3) the sqlite db if that is being used. # 4) pid's we need to clean up on exit/shutdown export TOASTER_DIR=$TOASTERDIR -export BB_ENV_EXTRAWHITE="$BB_ENV_EXTRAWHITE TOASTER_DIR" +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 @@ -300,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." @@ -316,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 |