diff options
author | Ed Bartosh <ed.bartosh@linux.intel.com> | 2015-12-17 16:48:54 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-12-18 13:51:54 +0000 |
commit | b194c0c00a2d7fb96e9eaef43c770b15fcebb0b9 (patch) | |
tree | db57945d6d6064863ce50eed28e80c53b11d9a5e /bitbake | |
parent | 064d2c79841094b55007ffb101b56039c2cc34bc (diff) | |
download | poky-b194c0c00a2d7fb96e9eaef43c770b15fcebb0b9.tar.gz |
bitbake: toaster: move startup checks to a better place
Moved addr:port, bitbake.lock and toastermain.pid checks
to the place where the rest of Toaster starting happens.
(Bitbake rev: 0e7812b5512e609ea815db30be1d7caca896ab60)
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-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 |