Mercurial > p > roundup > code
comparison scripts/Docker/roundup_start @ 6638:e1588ae185dc issue2550923_computed_property
merge from default branch. Fix travis.ci so CI builds don't error out
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Thu, 21 Apr 2022 16:54:17 -0400 |
| parents | b5fb268b7f04 |
| children | 7b9bddda9d2d |
comparison
equal
deleted
inserted
replaced
| 6508:85db90cc1705 | 6638:e1588ae185dc |
|---|---|
| 1 #! /bin/sh | |
| 2 | |
| 3 # When container starts verify that the trackers are configured. | |
| 4 # If they are, start the server otherwise run roundup-admin | |
| 5 # for installation and initialization. | |
| 6 | |
| 7 # "$@" should be a set of tracker=directory pairs. | |
| 8 | |
| 9 if ! [ -z "$SHELL_DEBUG" ]; then | |
| 10 set -xv | |
| 11 fi | |
| 12 | |
| 13 trap exit INT | |
| 14 | |
| 15 do_exit=0 | |
| 16 | |
| 17 for tracker_spec in "$@"; do | |
| 18 # IFS== set a=b doesn't assign $1 and $2 in busybox ash | |
| 19 # it also clobbers '$@'. 'echo mumble | read' starts read in a | |
| 20 # subshell so vars are not available in parent. | |
| 21 IFS="=" read tracker directory <<- EOE | |
| 22 $tracker_spec | |
| 23 EOE | |
| 24 # ^ is a tab for use with <<- | |
| 25 | |
| 26 # was $tracker_spec in the form of a=b, if not ignore it. | |
| 27 # allows setting CMD to -i index_template issue=tracker for example. | |
| 28 if [ -z "$directory" ]; then continue; fi | |
| 29 | |
| 30 # something is specified or built wrong. Don't start. | |
| 31 if [ ! -d "$directory" ]; then | |
| 32 printf "Unable to find directory %s. Exiting\n" "$directory" | |
| 33 exit 1 | |
| 34 fi | |
| 35 | |
| 36 # user must define web in config.ini. | |
| 37 if ! grep '^\s*web\s\s*=\s\s*' "$directory/config.ini" > /dev/null; then | |
| 38 roundup-admin -i "$directory" install | |
| 39 do_exit=1 | |
| 40 fi | |
| 41 | |
| 42 # we have a valid config.ini so init database if not done | |
| 43 if [ $do_exit == 0 -a ! -e "$directory/.init_done" ]; then | |
| 44 if roundup-admin -i "$directory" init; then | |
| 45 cat > "$directory/.init_done" <<- EOD | |
| 46 Don't delete this file. The docker startup needs it so it won't | |
| 47 re-initialze the database destroying all the data. | |
| 48 EOD | |
| 49 else | |
| 50 do_exit=1 | |
| 51 fi | |
| 52 fi | |
| 53 done | |
| 54 | |
| 55 # if any config.ini needs editing don't start up. | |
| 56 if [ $do_exit == 0 ]; then | |
| 57 # make roundup-server process 1 with exec | |
| 58 exec roundup-server -n 0.0.0.0 "$@" | |
| 59 fi | |
| 60 | |
| 61 exit 0 |
