diff options
author | Michael Wood <michael.g.wood@intel.com> | 2016-04-21 14:22:05 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-05-06 10:12:17 +0100 |
commit | 93853e06fba4a1f09a3cceac344f1341b177a5b3 (patch) | |
tree | eb0f409df75eb7fb29edada898c1a4feed523571 /bitbake/bin/toaster | |
parent | 4446b351388825820ce2ef634383368920648bce (diff) | |
download | poky-93853e06fba4a1f09a3cceac344f1341b177a5b3.tar.gz |
bitbake: toaster: bin/toaster Add ability to specify port and address to bind to
Allow binding to a specified address and port to start the django
development server on.
Remove the assumption that you want to bind to 0.0.0.0 and set the
default to localhost.
Add some additional help text after Toaster webserver has started
(Bitbake rev: ef3c88a57313947feb5ef08c4fea6fd110cde1e7)
Signed-off-by: Michael Wood <michael.g.wood@intel.com>
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/bin/toaster')
-rwxr-xr-x | bitbake/bin/toaster | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/bitbake/bin/toaster b/bitbake/bin/toaster index 2d07255d9b..9540fc9e6c 100755 --- a/bitbake/bin/toaster +++ b/bitbake/bin/toaster | |||
@@ -69,7 +69,7 @@ webserverStartAll() | |||
69 | 69 | ||
70 | echo "Starting webserver..." | 70 | echo "Starting webserver..." |
71 | 71 | ||
72 | $MANAGE runserver "0.0.0.0:$WEB_PORT" \ | 72 | $MANAGE runserver "$ADDR_PORT" \ |
73 | </dev/null >>${BUILDDIR}/toaster_web.log 2>&1 \ | 73 | </dev/null >>${BUILDDIR}/toaster_web.log 2>&1 \ |
74 | & echo $! >${BUILDDIR}/.toastermain.pid | 74 | & echo $! >${BUILDDIR}/.toastermain.pid |
75 | 75 | ||
@@ -79,7 +79,8 @@ webserverStartAll() | |||
79 | retval=1 | 79 | retval=1 |
80 | rm "${BUILDDIR}/.toastermain.pid" | 80 | rm "${BUILDDIR}/.toastermain.pid" |
81 | else | 81 | else |
82 | echo "Webserver address: http://0.0.0.0:$WEB_PORT/" | 82 | echo "Toaster development webserver started at http://$ADDR_PORT" |
83 | 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" | ||
83 | fi | 84 | fi |
84 | 85 | ||
85 | return $retval | 86 | return $retval |
@@ -180,7 +181,7 @@ fi | |||
180 | export TOASTER_DIR=`pwd` | 181 | export TOASTER_DIR=`pwd` |
181 | 182 | ||
182 | WEBSERVER=1 | 183 | WEBSERVER=1 |
183 | WEB_PORT="8000" | 184 | ADDR_PORT="localhost:8000" |
184 | unset CMD | 185 | unset CMD |
185 | for param in $*; do | 186 | for param in $*; do |
186 | case $param in | 187 | case $param in |
@@ -194,7 +195,14 @@ for param in $*; do | |||
194 | CMD=$param | 195 | CMD=$param |
195 | ;; | 196 | ;; |
196 | webport=*) | 197 | webport=*) |
197 | WEB_PORT="${param#*=}" | 198 | ADDR_PORT="${param#*=}" |
199 | # Split the addr:port string | ||
200 | ADDR=`echo $ADDR_PORT | cut -f 1 -d ':'` | ||
201 | PORT=`echo $ADDR_PORT | cut -f 2 -d ':'` | ||
202 | # If only a port has been speified then set address to localhost. | ||
203 | if [ $ADDR = $PORT ] ; then | ||
204 | ADDR_PORT="localhost:$PORT" | ||
205 | fi | ||
198 | ;; | 206 | ;; |
199 | *) | 207 | *) |
200 | echo "$HELP" | 208 | echo "$HELP" |
@@ -247,7 +255,7 @@ case $CMD in | |||
247 | start ) | 255 | start ) |
248 | # check if addr:port is not in use | 256 | # check if addr:port is not in use |
249 | if [ "$CMD" == 'start' ]; then | 257 | if [ "$CMD" == 'start' ]; then |
250 | $MANAGE checksocket "0.0.0.0:$WEB_PORT" || return 1 | 258 | $MANAGE checksocket "$ADDR_PORT" || return 1 |
251 | fi | 259 | fi |
252 | 260 | ||
253 | # kill Toaster web server if it's alive | 261 | # kill Toaster web server if it's alive |