diff options
| author | David Reyna <David.Reyna@windriver.com> | 2017-08-20 18:01:49 -0700 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-08-23 12:07:42 +0100 |
| commit | 9bfe460934dd9bafcfab7bdf8cbbf7ad968e9026 (patch) | |
| tree | 0dfeb6ce3e580a54c190d2f8ef1236aae321efb2 /bitbake/bin | |
| parent | 52a67cc958185266f1b982555cf019a8b4f10817 (diff) | |
| download | poky-9bfe460934dd9bafcfab7bdf8cbbf7ad968e9026.tar.gz | |
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>
Diffstat (limited to 'bitbake/bin')
| -rwxr-xr-x | bitbake/bin/toaster | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/bitbake/bin/toaster b/bitbake/bin/toaster index c2e33fe376..762451df23 100755 --- a/bitbake/bin/toaster +++ b/bitbake/bin/toaster | |||
| @@ -24,6 +24,14 @@ Usage: source toaster start|stop [webport=<address:port>] [noweb] | |||
| 24 | [webport] Set the development server (default: localhost:8000) | 24 | [webport] Set the development server (default: localhost:8000) |
| 25 | " | 25 | " |
| 26 | 26 | ||
| 27 | custom_extention() | ||
| 28 | { | ||
| 29 | custom_extension=$BBBASEDIR/lib/toaster/orm/fixtures/custom_toaster_append.sh | ||
| 30 | if [ -f $custom_extension ] ; then | ||
| 31 | $custom_extension $* | ||
| 32 | fi | ||
| 33 | } | ||
| 34 | |||
| 27 | databaseCheck() | 35 | databaseCheck() |
| 28 | { | 36 | { |
| 29 | retval=0 | 37 | retval=0 |
| @@ -50,6 +58,11 @@ databaseCheck() | |||
| 50 | webserverKillAll() | 58 | webserverKillAll() |
| 51 | { | 59 | { |
| 52 | local pidfile | 60 | local pidfile |
| 61 | if [ -f ${BUILDDIR}/.toastermain.pid ] ; then | ||
| 62 | custom_extention web_stop_postpend | ||
| 63 | else | ||
| 64 | custom_extention noweb_stop_postpend | ||
| 65 | fi | ||
| 53 | for pidfile in ${BUILDDIR}/.toastermain.pid ${BUILDDIR}/.runbuilds.pid; do | 66 | for pidfile in ${BUILDDIR}/.toastermain.pid ${BUILDDIR}/.runbuilds.pid; do |
| 54 | if [ -f ${pidfile} ]; then | 67 | if [ -f ${pidfile} ]; then |
| 55 | pid=`cat ${pidfile}` | 68 | pid=`cat ${pidfile}` |
| @@ -89,6 +102,7 @@ webserverStartAll() | |||
| 89 | else | 102 | else |
| 90 | echo "Toaster development webserver started at http://$ADDR_PORT" | 103 | echo "Toaster development webserver started at http://$ADDR_PORT" |
| 91 | 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" | 104 | 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" |
| 105 | custom_extention web_start_postpend $ADDR_PORT | ||
| 92 | fi | 106 | fi |
| 93 | 107 | ||
| 94 | return $retval | 108 | return $retval |
| @@ -168,7 +182,6 @@ fi | |||
| 168 | unset OE_ROOT | 182 | unset OE_ROOT |
| 169 | 183 | ||
| 170 | 184 | ||
| 171 | |||
| 172 | WEBSERVER=1 | 185 | WEBSERVER=1 |
| 173 | ADDR_PORT="localhost:8000" | 186 | ADDR_PORT="localhost:8000" |
| 174 | unset CMD | 187 | unset CMD |
| @@ -241,6 +254,7 @@ fi | |||
| 241 | echo "The system will $CMD." | 254 | echo "The system will $CMD." |
| 242 | 255 | ||
| 243 | # Execute the commands | 256 | # Execute the commands |
| 257 | custom_extention toaster_prepend $CMD $ADDR_PORT | ||
| 244 | 258 | ||
| 245 | case $CMD in | 259 | case $CMD in |
| 246 | start ) | 260 | start ) |
| @@ -262,9 +276,10 @@ case $CMD in | |||
| 262 | if [ ! -f "$TOASTER_DIR/toaster.sqlite" ] ; then | 276 | if [ ! -f "$TOASTER_DIR/toaster.sqlite" ] ; then |
| 263 | if ! databaseCheck; then | 277 | if ! databaseCheck; then |
| 264 | echo "Failed ${CMD}." | 278 | echo "Failed ${CMD}." |
| 265 | return 4 | 279 | return 4 |
| 266 | fi | 280 | fi |
| 267 | fi | 281 | fi |
| 282 | custom_extention noweb_start_postpend $ADDR_PORT | ||
| 268 | fi | 283 | fi |
| 269 | if [ $WEBSERVER -gt 0 ] && ! webserverStartAll; then | 284 | if [ $WEBSERVER -gt 0 ] && ! webserverStartAll; then |
| 270 | echo "Failed ${CMD}." | 285 | echo "Failed ${CMD}." |
| @@ -278,6 +293,7 @@ case $CMD in | |||
| 278 | # set fail safe stop system on terminal exit | 293 | # set fail safe stop system on terminal exit |
| 279 | trap stop_system SIGHUP | 294 | trap stop_system SIGHUP |
| 280 | echo "Successful ${CMD}." | 295 | echo "Successful ${CMD}." |
| 296 | custom_extention toaster_postpend $CMD $ADDR_PORT | ||
| 281 | return 0 | 297 | return 0 |
| 282 | ;; | 298 | ;; |
| 283 | stop ) | 299 | stop ) |
| @@ -285,3 +301,5 @@ case $CMD in | |||
| 285 | echo "Successful ${CMD}." | 301 | echo "Successful ${CMD}." |
| 286 | ;; | 302 | ;; |
| 287 | esac | 303 | esac |
| 304 | custom_extention toaster_postpend $CMD $ADDR_PORT | ||
| 305 | |||
