From eb57d7317f4c1bbee24516323230c4cd45792b08 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Tue, 23 Jul 2019 19:49:18 +0200 Subject: [PATCH] implement EGW_SKIP_INSTALL for entrypoint to skip automatic install also fixed not working exit on failed install --- doc/docker/fpm/entrypoint.sh | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/doc/docker/fpm/entrypoint.sh b/doc/docker/fpm/entrypoint.sh index 3c78789aec..8fd887d3c4 100755 --- a/doc/docker/fpm/entrypoint.sh +++ b/doc/docker/fpm/entrypoint.sh @@ -1,6 +1,5 @@ #!/bin/bash set -e -set -x # ToDo check version before copy rsync -a --delete /usr/share/egroupware-sources/ /usr/share/egroupware/ @@ -19,8 +18,10 @@ touch $LOG chmod 600 $LOG max_retries=10 -try=0 -until php /usr/share/egroupware/doc/rpm-build/post_install.php \ +export try=0 +# EGW_SKIP_INSTALL=true skips initial installation (no header.inc.php yet) +until [ -n "$EGW_SKIP_INSTALL" -a ! -f /var/lib/egroupware/header.inc.php ] || \ + php /usr/share/egroupware/doc/rpm-build/post_install.php \ --start_webserver "" --autostart_webserver "" \ --start_db "" --autostart_db "" \ --db_type "${EGW_DB_TYPE:-mysqli}" \ @@ -30,17 +31,19 @@ until php /usr/share/egroupware/doc/rpm-build/post_install.php \ --db_root_pw "${EGW_DB_ROOT_PW:-}" \ --db_name "${EGW_DB_NAME:-egroupware}" \ --db_user "${EGW_DB_USER:-egroupware}" \ - --db_pass "${EGW_DB_PASS:-}" || [ "$try" -gt "$max_retries" ] + --db_pass "${EGW_DB_PASS:-}" do + if [ "$try" -gt "$max_retries" ]; then + echo "Installing of EGroupware failed!" + break + fi echo "Retrying EGroupware installation in 3 seconds ..." try=$((try+1)) sleep 3s done 2>&1 | tee -a $LOG -if [ "$try" -gt "$max_retries" ]; then - echo "Installing of EGroupware failed!" | tee -a $LOG - exit 1 -fi +# as we can NOT exit from until (runs a subshell), we need to check and do it here +[ "$(tail -1 $LOG)" = "Installing of EGroupware failed!" ] && exit 1 # to run async jobs service cron start