diff options
| -rwxr-xr-x | bitbake/bin/toaster | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/bitbake/bin/toaster b/bitbake/bin/toaster index 16de52b115..cc631f6f56 100755 --- a/bitbake/bin/toaster +++ b/bitbake/bin/toaster | |||
| @@ -49,6 +49,19 @@ function webserverStartAll() | |||
| 49 | return $retval | 49 | return $retval |
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | # define the stop command | ||
| 53 | function stop_system() | ||
| 54 | { | ||
| 55 | if [ -f ${BUILDDIR}/.toasterui.pid ]; then | ||
| 56 | kill $(< ${BUILDDIR}/.toasterui.pid ) | ||
| 57 | rm ${BUILDDIR}/.toasterui.pid | ||
| 58 | fi | ||
| 59 | BBSERVER=localhost:8200 bitbake -m | ||
| 60 | unset BBSERVER | ||
| 61 | webserverKillAll | ||
| 62 | # force stop any misbehaving bitbake server | ||
| 63 | lsof bitbake.lock | awk '{print $2}' | grep "[0-9]\+" | xargs -n1 -r kill | ||
| 64 | } | ||
| 52 | 65 | ||
| 53 | # We make sure we're running in the current shell and in a good environment | 66 | # We make sure we're running in the current shell and in a good environment |
| 54 | 67 | ||
| @@ -116,6 +129,9 @@ and | |||
| 116 | fi | 129 | fi |
| 117 | 130 | ||
| 118 | 131 | ||
| 132 | |||
| 133 | |||
| 134 | |||
| 119 | # Execute the commands | 135 | # Execute the commands |
| 120 | 136 | ||
| 121 | case $CMD in | 137 | case $CMD in |
| @@ -127,17 +143,12 @@ case $CMD in | |||
| 127 | if [ $NOTOASTERUI == 0 ]; then # we start the TOASTERUI only if not inhibited | 143 | if [ $NOTOASTERUI == 0 ]; then # we start the TOASTERUI only if not inhibited |
| 128 | bitbake --observe-only -u toasterui >${BUILDDIR}/toaster_ui.log 2>&1 & echo $! >${BUILDDIR}/.toasterui.pid | 144 | bitbake --observe-only -u toasterui >${BUILDDIR}/toaster_ui.log 2>&1 & echo $! >${BUILDDIR}/.toasterui.pid |
| 129 | fi | 145 | fi |
| 146 | # stop system on terminal exit | ||
| 147 | trap stop_system SIGHUP | ||
| 130 | ;; | 148 | ;; |
| 131 | stop ) | 149 | stop ) |
| 132 | if [ -f ${BUILDDIR}/.toasterui.pid ]; then | 150 | stop_system |
| 133 | kill $(< ${BUILDDIR}/.toasterui.pid ) | 151 | trap '' SIGHUP |
| 134 | rm ${BUILDDIR}/.toasterui.pid | ||
| 135 | fi | ||
| 136 | bitbake -m | ||
| 137 | unset BBSERVER | ||
| 138 | webserverKillAll | ||
| 139 | # force stop any misbehaving bitbake server | ||
| 140 | lsof bitbake.lock | awk '{print $2}' | grep "[0-9]\+" | xargs -n1 -r kill | ||
| 141 | ;; | 152 | ;; |
| 142 | esac | 153 | esac |
| 143 | 154 | ||
