nextcloud/entrypoint.sh.tmpl

34 lines
945 B
Bash

#!/bin/bash
echo "Giving the db container some time to come up"; sleep 20
# see this issue with postgres db https://github.com/nextcloud/docker/issues/1204
{{ if eq (env "X_FRAME_OPTIONS_ENABLED") "1" }}
if ! [[ $(grep {{ env "X_FRAME_OPTIONS_ALLOW_FROM" }} lib/public/AppFramework/Http/ContentSecurityPolicy.php) ]]; then
sed -i "91 a\\\t\t'{{ env "X_FRAME_OPTIONS_ALLOW_FROM" }}', " lib/public/AppFramework/Http/ContentSecurityPolicy.php
fi
{{ end }}
run_occ(){
su -p www-data -s /bin/sh -c "/var/www/html/occ $@"
}
if [ ! -f /var/www/html/version.php ]
then
# Install nextcloud, without executing php-fpm
sed 's/exec "$@"/#exec "$@"/' -i /entrypoint.sh
/entrypoint.sh php-fpm
sed 's/#exec "$@"/exec "$@"/' -i /entrypoint.sh
fi
installed=$(run_occ status | grep installed | grep true)
if [[ -n $installed ]]
then
for app in $APPS
do
run_occ "app:install $app"
done
fi
/entrypoint.sh php-fpm