mirror of
https://git.yoctoproject.org/poky
synced 2026-06-02 01:19:52 +00:00
bitbake: Toaster: custom start and stop actions
Toaster needs the ability to allow custom extensions to execute when Toaster is started and stopped. Toaster will look for a custom extension script in the fixtures directory and execute any applicable hooks. [YOCTO #11938] (Bitbake rev: 12a73f6914488029f2b9dd680e004fba7dde41af) Signed-off-by: David Reyna <David.Reyna@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
52a67cc958
commit
9bfe460934
+20
-2
@@ -24,6 +24,14 @@ Usage: source toaster start|stop [webport=<address:port>] [noweb]
|
|||||||
[webport] Set the development server (default: localhost:8000)
|
[webport] Set the development server (default: localhost:8000)
|
||||||
"
|
"
|
||||||
|
|
||||||
|
custom_extention()
|
||||||
|
{
|
||||||
|
custom_extension=$BBBASEDIR/lib/toaster/orm/fixtures/custom_toaster_append.sh
|
||||||
|
if [ -f $custom_extension ] ; then
|
||||||
|
$custom_extension $*
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
databaseCheck()
|
databaseCheck()
|
||||||
{
|
{
|
||||||
retval=0
|
retval=0
|
||||||
@@ -50,6 +58,11 @@ databaseCheck()
|
|||||||
webserverKillAll()
|
webserverKillAll()
|
||||||
{
|
{
|
||||||
local pidfile
|
local pidfile
|
||||||
|
if [ -f ${BUILDDIR}/.toastermain.pid ] ; then
|
||||||
|
custom_extention web_stop_postpend
|
||||||
|
else
|
||||||
|
custom_extention noweb_stop_postpend
|
||||||
|
fi
|
||||||
for pidfile in ${BUILDDIR}/.toastermain.pid ${BUILDDIR}/.runbuilds.pid; do
|
for pidfile in ${BUILDDIR}/.toastermain.pid ${BUILDDIR}/.runbuilds.pid; do
|
||||||
if [ -f ${pidfile} ]; then
|
if [ -f ${pidfile} ]; then
|
||||||
pid=`cat ${pidfile}`
|
pid=`cat ${pidfile}`
|
||||||
@@ -89,6 +102,7 @@ webserverStartAll()
|
|||||||
else
|
else
|
||||||
echo "Toaster development webserver started at http://$ADDR_PORT"
|
echo "Toaster development webserver started at http://$ADDR_PORT"
|
||||||
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"
|
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"
|
||||||
|
custom_extention web_start_postpend $ADDR_PORT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
return $retval
|
return $retval
|
||||||
@@ -168,7 +182,6 @@ fi
|
|||||||
unset OE_ROOT
|
unset OE_ROOT
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
WEBSERVER=1
|
WEBSERVER=1
|
||||||
ADDR_PORT="localhost:8000"
|
ADDR_PORT="localhost:8000"
|
||||||
unset CMD
|
unset CMD
|
||||||
@@ -241,6 +254,7 @@ fi
|
|||||||
echo "The system will $CMD."
|
echo "The system will $CMD."
|
||||||
|
|
||||||
# Execute the commands
|
# Execute the commands
|
||||||
|
custom_extention toaster_prepend $CMD $ADDR_PORT
|
||||||
|
|
||||||
case $CMD in
|
case $CMD in
|
||||||
start )
|
start )
|
||||||
@@ -262,9 +276,10 @@ case $CMD in
|
|||||||
if [ ! -f "$TOASTER_DIR/toaster.sqlite" ] ; then
|
if [ ! -f "$TOASTER_DIR/toaster.sqlite" ] ; then
|
||||||
if ! databaseCheck; then
|
if ! databaseCheck; then
|
||||||
echo "Failed ${CMD}."
|
echo "Failed ${CMD}."
|
||||||
return 4
|
return 4
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
custom_extention noweb_start_postpend $ADDR_PORT
|
||||||
fi
|
fi
|
||||||
if [ $WEBSERVER -gt 0 ] && ! webserverStartAll; then
|
if [ $WEBSERVER -gt 0 ] && ! webserverStartAll; then
|
||||||
echo "Failed ${CMD}."
|
echo "Failed ${CMD}."
|
||||||
@@ -278,6 +293,7 @@ case $CMD in
|
|||||||
# set fail safe stop system on terminal exit
|
# set fail safe stop system on terminal exit
|
||||||
trap stop_system SIGHUP
|
trap stop_system SIGHUP
|
||||||
echo "Successful ${CMD}."
|
echo "Successful ${CMD}."
|
||||||
|
custom_extention toaster_postpend $CMD $ADDR_PORT
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
stop )
|
stop )
|
||||||
@@ -285,3 +301,5 @@ case $CMD in
|
|||||||
echo "Successful ${CMD}."
|
echo "Successful ${CMD}."
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
custom_extention toaster_postpend $CMD $ADDR_PORT
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,49 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Copyright (C) 2017 Intel Corp.
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License version 2 as
|
||||||
|
# published by the Free Software Foundation.
|
||||||
|
#
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
|
||||||
|
# This is sample software. Rename it to 'custom_toaster_append.sh' and
|
||||||
|
# enable the respective custom sections.
|
||||||
|
|
||||||
|
verbose=0
|
||||||
|
if [ $verbose -ne 0 ] ; then
|
||||||
|
echo "custom_toaster_append.sh:$*"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "toaster_prepend" = "$1" ] ; then
|
||||||
|
echo "Add custom actions here when Toaster script is started"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "web_start_postpend" = "$1" ] ; then
|
||||||
|
echo "Add custom actions here after Toaster web service is started"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "web_stop_postpend" = "$1" ] ; then
|
||||||
|
echo "Add custom actions here after Toaster web service is stopped"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "noweb_start_postpend" = "$1" ] ; then
|
||||||
|
echo "Add custom actions here after Toaster (no web) service is started"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "noweb_stop_postpend" = "$1" ] ; then
|
||||||
|
echo "Add custom actions here after Toaster (no web) service is stopped"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "toaster_postpend" = "$1" ] ; then
|
||||||
|
echo "Add custom actions here after Toaster script is done"
|
||||||
|
fi
|
||||||
|
|
||||||
Reference in New Issue
Block a user