Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 1 | #!/bin/echo ERROR: This script needs to be sourced. Please run as . |
| 2 | |
| 3 | # toaster - shell script to start Toaster |
| 4 | |
| 5 | # Copyright (C) 2013-2015 Intel Corp. |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 6 | # |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 7 | # SPDX-License-Identifier: GPL-2.0-or-later |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 8 | # |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 9 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 10 | HELP=" |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 11 | Usage 1: source toaster start|stop [webport=<address:port>] [noweb] [nobuild] [toasterdir] |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 12 | Optional arguments: |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 13 | [nobuild] Setup the environment for capturing builds with toaster but disable managed builds |
| 14 | [noweb] Setup the environment for capturing builds with toaster but don't start the web server |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 15 | [webport] Set the development server (default: localhost:8000) |
Brad Bishop | 5dd7cbb | 2018-09-05 22:26:40 -0700 | [diff] [blame] | 16 | [toasterdir] Set absolute path to be used as TOASTER_DIR (default: BUILDDIR/../) |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 17 | Usage 2: source toaster manage [createsuperuser|lsupdates|migrate|makemigrations|checksettings|collectstatic|...] |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 18 | " |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 19 | |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 20 | custom_extention() |
| 21 | { |
| 22 | custom_extension=$BBBASEDIR/lib/toaster/orm/fixtures/custom_toaster_append.sh |
| 23 | if [ -f $custom_extension ] ; then |
| 24 | $custom_extension $* |
| 25 | fi |
| 26 | } |
| 27 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 28 | databaseCheck() |
| 29 | { |
| 30 | retval=0 |
| 31 | # you can always add a superuser later via |
| 32 | # ../bitbake/lib/toaster/manage.py createsuperuser --username=<ME> |
| 33 | $MANAGE migrate --noinput || retval=1 |
| 34 | |
| 35 | if [ $retval -eq 1 ]; then |
Andrew Geissler | 7e0e3c0 | 2022-02-25 20:34:39 +0000 | [diff] [blame] | 36 | echo "Failed migrations, halting system start" 1>&2 |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 37 | return $retval |
| 38 | fi |
| 39 | # Make sure that checksettings can pick up any value for TEMPLATECONF |
| 40 | export TEMPLATECONF |
| 41 | $MANAGE checksettings --traceback || retval=1 |
| 42 | |
| 43 | if [ $retval -eq 1 ]; then |
Andrew Geissler | 7e0e3c0 | 2022-02-25 20:34:39 +0000 | [diff] [blame] | 44 | printf "\nError while checking settings; exiting\n" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 45 | return $retval |
| 46 | fi |
| 47 | |
| 48 | return $retval |
| 49 | } |
| 50 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 51 | webserverKillAll() |
| 52 | { |
| 53 | local pidfile |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 54 | if [ -f ${BUILDDIR}/.toastermain.pid ] ; then |
| 55 | custom_extention web_stop_postpend |
| 56 | else |
| 57 | custom_extention noweb_stop_postpend |
| 58 | fi |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 59 | for pidfile in ${BUILDDIR}/.toastermain.pid ${BUILDDIR}/.runbuilds.pid; do |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 60 | if [ -f ${pidfile} ]; then |
| 61 | pid=`cat ${pidfile}` |
| 62 | while kill -0 $pid 2>/dev/null; do |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 63 | kill -SIGTERM $pid 2>/dev/null |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 64 | sleep 1 |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 65 | done |
| 66 | rm ${pidfile} |
| 67 | fi |
| 68 | done |
| 69 | } |
| 70 | |
| 71 | webserverStartAll() |
| 72 | { |
| 73 | # do not start if toastermain points to a valid process |
| 74 | if ! cat "${BUILDDIR}/.toastermain.pid" 2>/dev/null | xargs -I{} kill -0 {} ; then |
| 75 | retval=1 |
| 76 | rm "${BUILDDIR}/.toastermain.pid" |
| 77 | fi |
| 78 | |
| 79 | retval=0 |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 80 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 81 | # check the database |
| 82 | databaseCheck || return 1 |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 83 | |
| 84 | echo "Starting webserver..." |
| 85 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 86 | $MANAGE runserver --noreload "$ADDR_PORT" \ |
Patrick Williams | ac13d5f | 2023-11-24 18:59:46 -0600 | [diff] [blame] | 87 | </dev/null >>${TOASTER_LOGS_DIR}/web.log 2>&1 \ |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 88 | & echo $! >${BUILDDIR}/.toastermain.pid |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 89 | |
| 90 | sleep 1 |
| 91 | |
| 92 | if ! cat "${BUILDDIR}/.toastermain.pid" | xargs -I{} kill -0 {} ; then |
| 93 | retval=1 |
| 94 | rm "${BUILDDIR}/.toastermain.pid" |
| 95 | else |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 96 | echo "Toaster development webserver started at http://$ADDR_PORT" |
| 97 | echo -e "\nYou can now run 'bitbake <target>' on the command line and monitor your build in Toaster.\nYou can also use a Toaster project to configure and run a build.\n" |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 98 | custom_extention web_start_postpend $ADDR_PORT |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 99 | fi |
| 100 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 101 | return $retval |
| 102 | } |
| 103 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 104 | INSTOPSYSTEM=0 |
| 105 | |
| 106 | # define the stop command |
| 107 | stop_system() |
| 108 | { |
| 109 | # prevent reentry |
| 110 | if [ $INSTOPSYSTEM -eq 1 ]; then return; fi |
| 111 | INSTOPSYSTEM=1 |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 112 | webserverKillAll |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 113 | # unset exported variables |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 114 | unset TOASTER_DIR |
| 115 | unset BITBAKE_UI |
| 116 | unset BBBASEDIR |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 117 | trap - SIGHUP |
| 118 | #trap - SIGCHLD |
| 119 | INSTOPSYSTEM=0 |
| 120 | } |
| 121 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 122 | verify_prereq() { |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 123 | # Verify Django version |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 124 | reqfile=$(python3 -c "import os; print(os.path.realpath('$BBBASEDIR/toaster-requirements.txt'))") |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 125 | exp='s/Django\([><=]\+\)\([^,]\+\),\([><=]\+\)\(.\+\)/' |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 126 | # expand version parts to 2 digits to support 1.10.x > 1.8 |
| 127 | # (note:helper functions hard to insert in-line) |
| 128 | exp=$exp'import sys,django;' |
| 129 | exp=$exp'version=["%02d" % int(n) for n in django.get_version().split(".")];' |
| 130 | exp=$exp'vmin=["%02d" % int(n) for n in "\2".split(".")];' |
| 131 | exp=$exp'vmax=["%02d" % int(n) for n in "\4".split(".")];' |
| 132 | exp=$exp'sys.exit(not (version \1 vmin and version \3 vmax))' |
| 133 | exp=$exp'/p' |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 134 | if ! sed -n "$exp" $reqfile | python3 - ; then |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 135 | req=`grep ^Django $reqfile` |
| 136 | echo "This program needs $req" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 137 | echo "Please install with pip3 install -r $reqfile" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 138 | return 2 |
| 139 | fi |
| 140 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 141 | return 0 |
| 142 | } |
| 143 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 144 | # read command line parameters |
| 145 | if [ -n "$BASH_SOURCE" ] ; then |
| 146 | TOASTER=${BASH_SOURCE} |
| 147 | elif [ -n "$ZSH_NAME" ] ; then |
| 148 | TOASTER=${(%):-%x} |
| 149 | else |
| 150 | TOASTER=$0 |
| 151 | fi |
| 152 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 153 | export BBBASEDIR=`dirname $TOASTER`/.. |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 154 | MANAGE="python3 $BBBASEDIR/lib/toaster/manage.py" |
Brad Bishop | c4ea075 | 2018-11-15 14:30:15 -0800 | [diff] [blame] | 155 | if [ -z "$OE_ROOT" ]; then |
| 156 | OE_ROOT=`dirname $TOASTER`/../.. |
| 157 | fi |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 158 | |
Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame] | 159 | # this is the configuraton file we are using for toaster |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 160 | # we are using the same logic that oe-setup-builddir uses |
| 161 | # (based on TEMPLATECONF and .templateconf) to determine |
| 162 | # which toasterconf.json to use. |
| 163 | # note: There are a number of relative path assumptions |
| 164 | # in the local layers that currently make using an arbitrary |
| 165 | # toasterconf.json difficult. |
| 166 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 167 | . $OE_ROOT/.templateconf |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 168 | if [ -n "$TEMPLATECONF" ]; then |
| 169 | if [ ! -d "$TEMPLATECONF" ]; then |
| 170 | # Allow TEMPLATECONF=meta-xyz/conf as a shortcut |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 171 | if [ -d "$OE_ROOT/$TEMPLATECONF" ]; then |
| 172 | TEMPLATECONF="$OE_ROOT/$TEMPLATECONF" |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 173 | fi |
| 174 | fi |
| 175 | fi |
| 176 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 177 | unset OE_ROOT |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 178 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 179 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 180 | WEBSERVER=1 |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 181 | export TOASTER_BUILDSERVER=1 |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 182 | ADDR_PORT="localhost:8000" |
Brad Bishop | 5dd7cbb | 2018-09-05 22:26:40 -0700 | [diff] [blame] | 183 | TOASTERDIR=`dirname $BUILDDIR` |
Patrick Williams | ac13d5f | 2023-11-24 18:59:46 -0600 | [diff] [blame] | 184 | # ${BUILDDIR}/toaster_logs/ became the default location for toaster logs |
| 185 | # This is needed for implemented django-log-viewer: https://pypi.org/project/django-log-viewer/ |
| 186 | # If the directory does not exist, create it. |
| 187 | TOASTER_LOGS_DIR="${BUILDDIR}/toaster_logs/" |
| 188 | if [ ! -d $TOASTER_LOGS_DIR ] |
| 189 | then |
| 190 | mkdir $TOASTER_LOGS_DIR |
| 191 | fi |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 192 | unset CMD |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 193 | for param in $*; do |
| 194 | case $param in |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 195 | noweb ) |
| 196 | WEBSERVER=0 |
| 197 | ;; |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 198 | nobuild ) |
| 199 | TOASTER_BUILDSERVER=0 |
| 200 | ;; |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 201 | start ) |
| 202 | CMD=$param |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 203 | ;; |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 204 | stop ) |
| 205 | CMD=$param |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 206 | ;; |
| 207 | webport=*) |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 208 | ADDR_PORT="${param#*=}" |
| 209 | # Split the addr:port string |
| 210 | ADDR=`echo $ADDR_PORT | cut -f 1 -d ':'` |
| 211 | PORT=`echo $ADDR_PORT | cut -f 2 -d ':'` |
| 212 | # If only a port has been speified then set address to localhost. |
| 213 | if [ $ADDR = $PORT ] ; then |
| 214 | ADDR_PORT="localhost:$PORT" |
| 215 | fi |
| 216 | ;; |
Brad Bishop | 5dd7cbb | 2018-09-05 22:26:40 -0700 | [diff] [blame] | 217 | toasterdir=*) |
| 218 | TOASTERDIR="${param#*=}" |
| 219 | ;; |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 220 | manage ) |
| 221 | CMD=$param |
| 222 | manage_cmd="" |
| 223 | ;; |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 224 | --help) |
| 225 | echo "$HELP" |
| 226 | return 0 |
| 227 | ;; |
| 228 | *) |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 229 | if [ "manage" == "$CMD" ] ; then |
| 230 | manage_cmd="$manage_cmd $param" |
| 231 | else |
| 232 | echo "$HELP" |
| 233 | exit 1 |
| 234 | fi |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 235 | ;; |
| 236 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 237 | esac |
| 238 | done |
| 239 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 240 | if [ `basename \"$0\"` = `basename \"${TOASTER}\"` ]; then |
| 241 | echo "Error: This script needs to be sourced. Please run as . $TOASTER" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 242 | return 1 |
| 243 | fi |
| 244 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 245 | verify_prereq || return 1 |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 246 | |
| 247 | # We make sure we're running in the current shell and in a good environment |
| 248 | if [ -z "$BUILDDIR" ] || ! which bitbake >/dev/null 2>&1 ; then |
| 249 | echo "Error: Build environment is not setup or bitbake is not in path." 1>&2 |
| 250 | return 2 |
| 251 | fi |
| 252 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 253 | # this defines the dir toaster will use for |
| 254 | # 1) clones of layers (in _toaster_clones ) |
| 255 | # 2) the build dir (in build) |
| 256 | # 3) the sqlite db if that is being used. |
| 257 | # 4) pid's we need to clean up on exit/shutdown |
Brad Bishop | 5dd7cbb | 2018-09-05 22:26:40 -0700 | [diff] [blame] | 258 | export TOASTER_DIR=$TOASTERDIR |
Andrew Geissler | 7e0e3c0 | 2022-02-25 20:34:39 +0000 | [diff] [blame] | 259 | export BB_ENV_PASSTHROUGH_ADDITIONS="$BB_ENV_PASSTHROUGH_ADDITIONS TOASTER_DIR" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 260 | |
| 261 | # Determine the action. If specified by arguments, fine, if not, toggle it |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 262 | if [ "$CMD" = "start" ] ; then |
| 263 | if [ -n "$BBSERVER" ]; then |
| 264 | echo " Toaster is already running. Exiting..." |
| 265 | return 1 |
| 266 | fi |
| 267 | elif [ "$CMD" = "" ]; then |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 268 | echo "No command specified" |
| 269 | echo "$HELP" |
| 270 | return 1 |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 271 | fi |
| 272 | |
| 273 | echo "The system will $CMD." |
| 274 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 275 | # Execute the commands |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 276 | custom_extention toaster_prepend $CMD $ADDR_PORT |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 277 | |
| 278 | case $CMD in |
| 279 | start ) |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 280 | # check if addr:port is not in use |
| 281 | if [ "$CMD" == 'start' ]; then |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 282 | if [ $WEBSERVER -gt 0 ]; then |
| 283 | $MANAGE checksocket "$ADDR_PORT" || return 1 |
| 284 | fi |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 285 | fi |
| 286 | |
| 287 | # Create configuration file |
| 288 | conf=${BUILDDIR}/conf/local.conf |
| 289 | line='INHERIT+="toaster buildhistory"' |
| 290 | grep -q "$line" $conf || echo $line >> $conf |
| 291 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 292 | if [ $WEBSERVER -eq 0 ] ; then |
| 293 | # Do not update the database for "noweb" unless |
| 294 | # it does not yet exist |
| 295 | if [ ! -f "$TOASTER_DIR/toaster.sqlite" ] ; then |
| 296 | if ! databaseCheck; then |
| 297 | echo "Failed ${CMD}." |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 298 | return 4 |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 299 | fi |
| 300 | fi |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 301 | custom_extention noweb_start_postpend $ADDR_PORT |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 302 | fi |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 303 | if [ $WEBSERVER -gt 0 ] && ! webserverStartAll; then |
| 304 | echo "Failed ${CMD}." |
| 305 | return 4 |
| 306 | fi |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 307 | export BITBAKE_UI='toasterui' |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 308 | if [ $TOASTER_BUILDSERVER -eq 1 ] ; then |
| 309 | $MANAGE runbuilds \ |
Patrick Williams | ac13d5f | 2023-11-24 18:59:46 -0600 | [diff] [blame] | 310 | </dev/null >>${TOASTER_LOGS_DIR}/toaster_runbuilds.log 2>&1 \ |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 311 | & echo $! >${BUILDDIR}/.runbuilds.pid |
| 312 | else |
| 313 | echo "Toaster build server not started." |
| 314 | fi |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 315 | |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 316 | # set fail safe stop system on terminal exit |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 317 | trap stop_system SIGHUP |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 318 | echo "Successful ${CMD}." |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 319 | custom_extention toaster_postpend $CMD $ADDR_PORT |
Patrick Williams | d8c66bc | 2016-06-20 12:57:21 -0500 | [diff] [blame] | 320 | return 0 |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 321 | ;; |
| 322 | stop ) |
| 323 | stop_system |
| 324 | echo "Successful ${CMD}." |
| 325 | ;; |
Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 326 | manage ) |
| 327 | cd $BBBASEDIR/lib/toaster |
| 328 | $MANAGE $manage_cmd |
| 329 | ;; |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 330 | esac |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 331 | custom_extention toaster_postpend $CMD $ADDR_PORT |
| 332 | |