implement EGW_SKIP_INSTALL for entrypoint to skip automatic install

also fixed not working exit on failed install
This commit is contained in:
Ralf Becker 2019-07-23 19:49:18 +02:00
parent 53c3dc2e35
commit eb57d7317f

View File

@ -1,6 +1,5 @@
#!/bin/bash #!/bin/bash
set -e set -e
set -x
# ToDo check version before copy # ToDo check version before copy
rsync -a --delete /usr/share/egroupware-sources/ /usr/share/egroupware/ rsync -a --delete /usr/share/egroupware-sources/ /usr/share/egroupware/
@ -19,8 +18,10 @@ touch $LOG
chmod 600 $LOG chmod 600 $LOG
max_retries=10 max_retries=10
try=0 export try=0
until php /usr/share/egroupware/doc/rpm-build/post_install.php \ # 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_webserver "" --autostart_webserver "" \
--start_db "" --autostart_db "" \ --start_db "" --autostart_db "" \
--db_type "${EGW_DB_TYPE:-mysqli}" \ --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_root_pw "${EGW_DB_ROOT_PW:-}" \
--db_name "${EGW_DB_NAME:-egroupware}" \ --db_name "${EGW_DB_NAME:-egroupware}" \
--db_user "${EGW_DB_USER:-egroupware}" \ --db_user "${EGW_DB_USER:-egroupware}" \
--db_pass "${EGW_DB_PASS:-}" || [ "$try" -gt "$max_retries" ] --db_pass "${EGW_DB_PASS:-}"
do do
if [ "$try" -gt "$max_retries" ]; then
echo "Installing of EGroupware failed!"
break
fi
echo "Retrying EGroupware installation in 3 seconds ..." echo "Retrying EGroupware installation in 3 seconds ..."
try=$((try+1)) try=$((try+1))
sleep 3s sleep 3s
done 2>&1 | tee -a $LOG done 2>&1 | tee -a $LOG
if [ "$try" -gt "$max_retries" ]; then # as we can NOT exit from until (runs a subshell), we need to check and do it here
echo "Installing of EGroupware failed!" | tee -a $LOG [ "$(tail -1 $LOG)" = "Installing of EGroupware failed!" ] && exit 1
exit 1
fi
# to run async jobs # to run async jobs
service cron start service cron start