aboutsummaryrefslogtreecommitdiffstats
path: root/bitbake/bin
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2015-12-17 16:48:54 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-12-18 13:51:54 +0000
commitb194c0c00a2d7fb96e9eaef43c770b15fcebb0b9 (patch)
treedb57945d6d6064863ce50eed28e80c53b11d9a5e /bitbake/bin
parent064d2c79841094b55007ffb101b56039c2cc34bc (diff)
downloadopenembedded-core-contrib-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/bin')
-rwxr-xr-xbitbake/bin/toaster49
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
echo "The system will $CMD."
-# check if addr:port is not in use
-if [ "$CMD" == 'start' ]; then
- $MANAGE checksocket "0.0.0.0:$WEB_PORT" || return 1
-fi
-
-# Make sure it's safe to run by checking bitbake lock
-
-lock=1
-if [ -e $BUILDDIR/bitbake.lock ]; then
- python -c "import fcntl; fcntl.flock(open(\"$BUILDDIR/bitbake.lock\"), fcntl.LOCK_EX|fcntl.LOCK_NB)" 2>/dev/null || lock=0
-fi
-
-if [ ${CMD} = 'start' ] && [ $lock -eq 0 ]; then
- echo "Error: bitbake lock state error. File locks show that the system is on." 1>&2
- echo "Please wait for the current build to finish, stop and then start the system again." 1>&2
- return 3
-fi
-
-if [ ${CMD} = 'start' ] && [ -e $BUILDDIR/.toastermain.pid ] && kill -0 `cat $BUILDDIR/.toastermain.pid`; then
- echo "Warning: bitbake appears to be dead, but the Toaster web server is running." 1>&2
- echo " Something fishy is going on." 1>&2
- echo "Cleaning up the web server to start from a clean slate."
- webserverKillAll
-fi
-
-
# Execute the commands
case $CMD in
start )
+ # check if addr:port is not in use
+ if [ "$CMD" == 'start' ]; then
+ $MANAGE checksocket "0.0.0.0:$WEB_PORT" || return 1
+ fi
+
+ # Make sure it's safe to start by checking bitbake lock
+ if [ -e $BUILDDIR/bitbake.lock ]; then
+ python -c "import fcntl; fcntl.flock(open(\"$BUILDDIR/bitbake.lock\"), fcntl.LOCK_EX|fcntl.LOCK_NB)" 2>/dev/null
+ if [ $? -ne 0 ] ; then
+ echo "Error: bitbake lock state error. File locks show that the system is on." 1>&2
+ echo "Please wait for the current build to finish, stop and then start the system again." 1>&2
+ return 3
+ fi
+ fi
+
+ # kill Toaster web server if it's alive
+ if [ -e $BUILDDIR/.toastermain.pid ] && kill -0 `cat $BUILDDIR/.toastermain.pid`; then
+ echo "Warning: bitbake appears to be dead, but the Toaster web server is running." 1>&2
+ echo " Something fishy is going on." 1>&2
+ echo "Cleaning up the web server to start from a clean slate."
+ webserverKillAll
+ fi
+
# Create configuration file
conf=${BUILDDIR}/conf/toaster.conf
echo "# Created by toaster start script" > $conf