diff options
Diffstat (limited to 'bitbake/bin/toaster')
-rwxr-xr-x | bitbake/bin/toaster | 49 |
1 files changed, 23 insertions, 26 deletions
diff --git a/bitbake/bin/toaster b/bitbake/bin/toaster index 1f4c400fdf..6dd20c11d1 100755 --- a/bitbake/bin/toaster +++ b/bitbake/bin/toaster | |||
@@ -288,36 +288,33 @@ fi | |||
288 | 288 | ||
289 | echo "The system will $CMD." | 289 | echo "The system will $CMD." |
290 | 290 | ||
291 | # check if addr:port is not in use | ||
292 | if [ "$CMD" == 'start' ]; then | ||
293 | $MANAGE checksocket "0.0.0.0:$WEB_PORT" || return 1 | ||
294 | fi | ||
295 | |||
296 | # Make sure it's safe to run by checking bitbake lock | ||
297 | |||
298 | lock=1 | ||
299 | if [ -e $BUILDDIR/bitbake.lock ]; then | ||
300 | python -c "import fcntl; fcntl.flock(open(\"$BUILDDIR/bitbake.lock\"), fcntl.LOCK_EX|fcntl.LOCK_NB)" 2>/dev/null || lock=0 | ||
301 | fi | ||
302 | |||
303 | if [ ${CMD} = 'start' ] && [ $lock -eq 0 ]; then | ||
304 | echo "Error: bitbake lock state error. File locks show that the system is on." 1>&2 | ||
305 | echo "Please wait for the current build to finish, stop and then start the system again." 1>&2 | ||
306 | return 3 | ||
307 | fi | ||
308 | |||
309 | if [ ${CMD} = 'start' ] && [ -e $BUILDDIR/.toastermain.pid ] && kill -0 `cat $BUILDDIR/.toastermain.pid`; then | ||
310 | echo "Warning: bitbake appears to be dead, but the Toaster web server is running." 1>&2 | ||
311 | echo " Something fishy is going on." 1>&2 | ||
312 | echo "Cleaning up the web server to start from a clean slate." | ||
313 | webserverKillAll | ||
314 | fi | ||
315 | |||
316 | |||
317 | # Execute the commands | 291 | # Execute the commands |
318 | 292 | ||
319 | case $CMD in | 293 | case $CMD in |
320 | start ) | 294 | start ) |
295 | # check if addr:port is not in use | ||
296 | if [ "$CMD" == 'start' ]; then | ||
297 | $MANAGE checksocket "0.0.0.0:$WEB_PORT" || return 1 | ||
298 | fi | ||
299 | |||
300 | # Make sure it's safe to start by checking bitbake lock | ||
301 | if [ -e $BUILDDIR/bitbake.lock ]; then | ||
302 | python -c "import fcntl; fcntl.flock(open(\"$BUILDDIR/bitbake.lock\"), fcntl.LOCK_EX|fcntl.LOCK_NB)" 2>/dev/null | ||
303 | if [ $? -ne 0 ] ; then | ||
304 | echo "Error: bitbake lock state error. File locks show that the system is on." 1>&2 | ||
305 | echo "Please wait for the current build to finish, stop and then start the system again." 1>&2 | ||
306 | return 3 | ||
307 | fi | ||
308 | fi | ||
309 | |||
310 | # kill Toaster web server if it's alive | ||
311 | if [ -e $BUILDDIR/.toastermain.pid ] && kill -0 `cat $BUILDDIR/.toastermain.pid`; then | ||
312 | echo "Warning: bitbake appears to be dead, but the Toaster web server is running." 1>&2 | ||
313 | echo " Something fishy is going on." 1>&2 | ||
314 | echo "Cleaning up the web server to start from a clean slate." | ||
315 | webserverKillAll | ||
316 | fi | ||
317 | |||
321 | # Create configuration file | 318 | # Create configuration file |
322 | conf=${BUILDDIR}/conf/toaster.conf | 319 | conf=${BUILDDIR}/conf/toaster.conf |
323 | echo "# Created by toaster start script" > $conf | 320 | echo "# Created by toaster start script" > $conf |