diff options
| -rwxr-xr-x | bitbake/bin/toaster | 50 |
1 files changed, 35 insertions, 15 deletions
diff --git a/bitbake/bin/toaster b/bitbake/bin/toaster index fd6cabf378..61a4a0f85d 100755 --- a/bitbake/bin/toaster +++ b/bitbake/bin/toaster | |||
| @@ -24,6 +24,29 @@ Usage: source toaster start|stop [webport=<address:port>] [noweb] | |||
| 24 | [webport] Set the development server (default: localhost:8000) | 24 | [webport] Set the development server (default: localhost:8000) |
| 25 | " | 25 | " |
| 26 | 26 | ||
| 27 | databaseCheck() | ||
| 28 | { | ||
| 29 | retval=0 | ||
| 30 | # you can always add a superuser later via | ||
| 31 | # ../bitbake/lib/toaster/manage.py createsuperuser --username=<ME> | ||
| 32 | $MANAGE migrate --noinput || retval=1 | ||
| 33 | |||
| 34 | if [ $retval -eq 1 ]; then | ||
| 35 | echo "Failed migrations, aborting system start" 1>&2 | ||
| 36 | return $retval | ||
| 37 | fi | ||
| 38 | # Make sure that checksettings can pick up any value for TEMPLATECONF | ||
| 39 | export TEMPLATECONF | ||
| 40 | $MANAGE checksettings --traceback || retval=1 | ||
| 41 | |||
| 42 | if [ $retval -eq 1 ]; then | ||
| 43 | printf "\nError while checking settings; aborting\n" | ||
| 44 | return $retval | ||
| 45 | fi | ||
| 46 | |||
| 47 | return $retval | ||
| 48 | } | ||
| 49 | |||
| 27 | webserverKillAll() | 50 | webserverKillAll() |
| 28 | { | 51 | { |
| 29 | local pidfile | 52 | local pidfile |
| @@ -48,22 +71,9 @@ webserverStartAll() | |||
| 48 | fi | 71 | fi |
| 49 | 72 | ||
| 50 | retval=0 | 73 | retval=0 |
| 51 | # you can always add a superuser later via | ||
| 52 | # ../bitbake/lib/toaster/manage.py createsuperuser --username=<ME> | ||
| 53 | $MANAGE migrate --noinput || retval=1 | ||
| 54 | 74 | ||
| 55 | if [ $retval -eq 1 ]; then | 75 | # check the database |
| 56 | echo "Failed migrations, aborting system start" 1>&2 | 76 | databaseCheck || return 1 |
| 57 | return $retval | ||
| 58 | fi | ||
| 59 | # Make sure that checksettings can pick up any value for TEMPLATECONF | ||
| 60 | export TEMPLATECONF | ||
| 61 | $MANAGE checksettings --traceback || retval=1 | ||
| 62 | |||
| 63 | if [ $retval -eq 1 ]; then | ||
| 64 | printf "\nError while checking settings; aborting\n" | ||
| 65 | return $retval | ||
| 66 | fi | ||
| 67 | 77 | ||
| 68 | echo "Starting webserver..." | 78 | echo "Starting webserver..." |
| 69 | 79 | ||
| @@ -240,6 +250,16 @@ case $CMD in | |||
| 240 | line='INHERIT+="toaster buildhistory"' | 250 | line='INHERIT+="toaster buildhistory"' |
| 241 | grep -q "$line" $conf || echo $line >> $conf | 251 | grep -q "$line" $conf || echo $line >> $conf |
| 242 | 252 | ||
| 253 | if [ $WEBSERVER -eq 0 ] ; then | ||
| 254 | # Do not update the database for "noweb" unless | ||
| 255 | # it does not yet exist | ||
| 256 | if [ ! -f "$TOASTER_DIR/toaster.sqlite" ] ; then | ||
| 257 | if ! databaseCheck; then | ||
| 258 | echo "Failed ${CMD}." | ||
| 259 | return 4 | ||
| 260 | fi | ||
| 261 | fi | ||
| 262 | fi | ||
| 243 | if [ $WEBSERVER -gt 0 ] && ! webserverStartAll; then | 263 | if [ $WEBSERVER -gt 0 ] && ! webserverStartAll; then |
| 244 | echo "Failed ${CMD}." | 264 | echo "Failed ${CMD}." |
| 245 | return 4 | 265 | return 4 |
