mirror of
https://github.com/zokradonh/kopano-docker.git
synced 2026-08-21 21:33:02 +00:00
add Kdav (#83)
* add a kdav image * do not install composer into the docker image instead use a multi stage build that copies the resulting directory into the final image * set default version in compose resolves #54
This commit is contained in:
Executable
+46
@@ -0,0 +1,46 @@
|
||||
#!/bin/bash
|
||||
|
||||
# define default value for serverhostname and serverport if not passed into container
|
||||
KCCONF_SERVERHOSTNAME=${KCCONF_SERVERHOSTNAME:-127.0.0.1}
|
||||
KCCONF_SERVERPORT=${KCCONF_SERVERPORT:-236}
|
||||
ADDITIONAL_KOPANO_PACKAGES=${ADDITIONAL_KOPANO_PACKAGES:-""}
|
||||
|
||||
set -eu # unset variables are errors & non-zero return values exit the whole script
|
||||
|
||||
[ ! -z "$ADDITIONAL_KOPANO_PACKAGES" ] && apt update
|
||||
[ ! -z "$ADDITIONAL_KOPANO_PACKAGES" ] && for installpkg in "$ADDITIONAL_KOPANO_PACKAGES"; do
|
||||
if [ $(dpkg-query -W -f='${Status}' $installpkg 2>/dev/null | grep -c "ok installed") -eq 0 ]; then
|
||||
apt --assume-yes install $installpkg;
|
||||
fi
|
||||
done
|
||||
|
||||
echo "Ensure directories"
|
||||
mkdir -p /run/sessions
|
||||
|
||||
if [ "$KCCONF_SERVERHOSTNAME" == "127.0.0.1" ]; then
|
||||
echo "kDAV is using the default: connection"
|
||||
else
|
||||
echo "kDAV is using an ip connection"
|
||||
sed -e "s#define([\"']MAPI_SERVER[\"'],\s*[\"']default:[\"'])#define('MAPI_SERVER', 'https://${KCCONF_SERVERHOSTNAME}:${KCCONF_SERVERPORT}/kopano')#" \
|
||||
-i /usr/share/kdav/config.php
|
||||
fi
|
||||
|
||||
# change root uri to /kdav
|
||||
sed -e "s#define('DAV_ROOT_URI', '/');#define('DAV_ROOT_URI', '/kdav/');#" -i /usr/share/kdav/config.php
|
||||
|
||||
echo "Ensure config ownership"
|
||||
chown -R www-data:www-data /run/sessions
|
||||
|
||||
touch /var/log/kdav/kdav.log
|
||||
touch /var/log/kdav/kdav-error.log
|
||||
chown www-data:www-data /var/log/kdav/kdav.log /var/log/kdav/kdav-error.log
|
||||
tail --pid=$$ -F --lines=0 -q /var/log/kdav/kdav.log &
|
||||
tail --pid=$$ -F --lines=0 -q /var/log/kdav/kdav-error.log &
|
||||
|
||||
echo "Starting Apache"
|
||||
rm -f /run/apache2/apache2.pid
|
||||
set +u
|
||||
source /etc/apache2/envvars
|
||||
# cleaning up env variables
|
||||
unset "${!KCCONF_@}"
|
||||
exec /usr/sbin/apache2 -DFOREGROUND
|
||||
Reference in New Issue
Block a user