2019-07-19 10:07:43 +02:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
|
2020-02-10 14:32:27 +01:00
|
|
|
# if EGW_APC_SHM_SIZE is set in environment, propagate value to apcu.ini
|
|
|
|
test -n "$EGW_APC_SHM_SIZE" && {
|
|
|
|
grep "apc.shm_size" /etc/php/7.3/fpm/conf.d/20-apcu.ini >/dev/null && \
|
|
|
|
sed -e "s/^;\?apc.shm_size.*/apc.shm_size=$EGW_APC_SHM_SIZE/g" \
|
|
|
|
-i /etc/php/7.3/fpm/conf.d/20-apcu.ini || \
|
|
|
|
echo "apc.shm_size=$EGW_APC_SHM_SIZE" >> /etc/php/7.3/fpm/conf.d/20-apcu.ini \
|
|
|
|
}
|
|
|
|
|
2019-10-31 13:02:49 +01:00
|
|
|
# if EGW_SESSION_TIMEOUT is set in environment, propagate value to php.ini
|
2020-02-10 14:32:27 +01:00
|
|
|
test -n "$EGW_SESSION_TIMEOUT" && test "$EGW_SESSION_TIMEOUT" -ge 1440 && \
|
2019-11-19 14:15:18 +01:00
|
|
|
sed -e "s/^;\?session.gc_maxlifetime.*/session.gc_maxlifetime=$EGW_SESSION_TIMEOUT/g" \
|
2019-10-31 13:02:49 +01:00
|
|
|
-i /etc/php/7.3/fpm/php.ini
|
|
|
|
|
2019-07-19 10:07:43 +02:00
|
|
|
# ToDo check version before copy
|
|
|
|
rsync -a --delete /usr/share/egroupware-sources/ /usr/share/egroupware/
|
|
|
|
|
|
|
|
# sources of extra apps merged into our sources (--ignore-existing to NOT overwrite any regular sources!)
|
|
|
|
test -d /usr/share/egroupware-extra && \
|
|
|
|
rsync -a --ignore-existing /usr/share/egroupware-extra/ /usr/share/egroupware/
|
|
|
|
|
|
|
|
# check and if necessary change ownership of /var/lib/egroupware
|
|
|
|
test $(stat -c '%U' /var/lib/egroupware) = "www-data" || \
|
|
|
|
chown -R www-data:www-data /var/lib/egroupware
|
|
|
|
|
2019-08-06 12:20:21 +02:00
|
|
|
# add private CA so egroupware can validate your certificate to talk to Collabora or Rocket.Chat
|
|
|
|
test -f /usr/local/share/ca-certificates/private-ca.crt &&
|
|
|
|
update-ca-certificates
|
|
|
|
|
2019-07-19 10:07:43 +02:00
|
|
|
# write install-log in /var/lib/egroupware (only readable by root!)
|
|
|
|
LOG=/var/lib/egroupware/egroupware-docker-install.log
|
|
|
|
touch $LOG
|
|
|
|
chmod 600 $LOG
|
|
|
|
|
|
|
|
max_retries=10
|
2019-07-23 19:49:18 +02:00
|
|
|
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 \
|
2019-07-19 10:07:43 +02:00
|
|
|
--start_webserver "" --autostart_webserver "" \
|
|
|
|
--start_db "" --autostart_db "" \
|
|
|
|
--db_type "${EGW_DB_TYPE:-mysqli}" \
|
|
|
|
--db_host "${EGW_DB_HOST:-localhost}" \
|
2019-08-07 21:53:31 +02:00
|
|
|
--db_grant_host "${EGW_DB_GRANT_HOST:-localhost}" \
|
2019-07-19 10:07:43 +02:00
|
|
|
--db_root "${EGW_DB_ROOT:-root}" \
|
|
|
|
--db_root_pw "${EGW_DB_ROOT_PW:-}" \
|
|
|
|
--db_name "${EGW_DB_NAME:-egroupware}" \
|
|
|
|
--db_user "${EGW_DB_USER:-egroupware}" \
|
2019-07-23 19:49:18 +02:00
|
|
|
--db_pass "${EGW_DB_PASS:-}"
|
2019-07-19 10:07:43 +02:00
|
|
|
do
|
2019-07-23 19:49:18 +02:00
|
|
|
if [ "$try" -gt "$max_retries" ]; then
|
|
|
|
echo "Installing of EGroupware failed!"
|
|
|
|
break
|
|
|
|
fi
|
2019-07-19 10:07:43 +02:00
|
|
|
echo "Retrying EGroupware installation in 3 seconds ..."
|
|
|
|
try=$((try+1))
|
|
|
|
sleep 3s
|
|
|
|
done 2>&1 | tee -a $LOG
|
|
|
|
|
2019-07-23 19:49:18 +02:00
|
|
|
# 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
|
2019-07-19 10:07:43 +02:00
|
|
|
|
|
|
|
# to run async jobs
|
|
|
|
service cron start
|
|
|
|
|
|
|
|
exec "$@"
|