#!/bin/bash

# enable this because univention-system-setup installed a config with rewriteRules but did not activate the module
# and left the apache config in a broken state
a2enmod rewrite

# tine20-base package puts a link into this directory, but does not check for existence
mkdir -p /etc/php5/conf.d/

/usr/share/univention-docker-container-mode/setup "$@"

if [ -e /usr/share/tine20/setup.php -a -e /etc/tine20/config.inc.php ]; then
    php /usr/share/tine20/setup.php --config=/etc/tine20/config.inc.php --update
fi

if [ -e /var/log/tine20/tine20.log ]; then
    chown www-data:www-data /var/log/tine20/tine20.log
fi