[PATCH 1/1] docker: Remove bashisms

Stephen Finucane stephen at that.guru
Fri Aug 31 20:52:06 AEST 2018


On Thu, 2018-08-30 at 18:08 +0200, Petr Vorel wrote:
> NOTE: --shell still execute bash (instead of sh)
> 
> Signed-off-by: Petr Vorel <petr.vorel at gmail.com>

I applied this and build/ran the docker environment. It failed with:

  patchwork_web_1 exited with code 2

I'm guessing there's a syntax error here but I haven't looked into it
yet. Any chance you could investigate?

Stephen

> ---
>  tools/docker/entrypoint.sh | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/tools/docker/entrypoint.sh b/tools/docker/entrypoint.sh
> index afa8533..d11871e 100755
> --- a/tools/docker/entrypoint.sh
> +++ b/tools/docker/entrypoint.sh
> @@ -1,4 +1,4 @@
> -#!/bin/bash
> +#!/bin/sh
>  set -euo pipefail
>  
>  PW_TEST_DB_TYPE=${PW_TEST_DB_TYPE:-mysql}
> @@ -84,7 +84,7 @@ if ! test_db_connection; then
>      if ! test_db_connection; then
>          echo "Still cannot connect to database."
>          echo "Maybe you are starting the db for the first time. Waiting up to 60 seconds."
> -        for i in {0..9}; do
> +        for i in $(seq 0 9); do
>              sleep 5
>              if test_db_connection; then
>                  break
> @@ -100,7 +100,7 @@ fi
>  
>  # rebuild db
>  # do this on --reset or if the db doesn't exist
> -if [[ "$1" == "--reset" ]]; then
> +if [ "$1" = "--reset" ]; then
>      shift
>      reset_data
>  elif ! test_database; then
> @@ -113,12 +113,12 @@ if [ $# -eq 0 ]; then
>      # we probably ran with --reset and nothing else
>      # just exit cleanly
>      exit 0
> -elif [ "$1" == "--shell" ]; then
> +elif [ "$1" = "--shell" ]; then
>      exec bash
> -elif [ "$1" == "--test" ] || [ "$1" == "--quick-test" ]; then
> +elif [ "$1" = "--test" ] || [ "$1" = "--quick-test" ]; then
>      shift
>      python3 manage.py test $@
> -elif [ "$1" == "--tox" ] || [ "$1" == "--quick-tox" ]; then
> +elif [ "$1" = "--tox" ] || [ "$1" = "--quick-tox" ]; then
>      shift
>      tox $@
>  else # run whatever CMD is set to




More information about the Patchwork mailing list