change entrypoint of nextcloud container to root

Signed-off-by: szaimen <szaimen@e.mail.de>
This commit is contained in:
szaimen 2022-10-11 20:29:52 +02:00
parent ce47fab555
commit d3d8b11e28
6 changed files with 27 additions and 20 deletions

View file

@ -1,7 +1,7 @@
#!/bin/bash
# Only start container if database is accessible
while ! nc -z "$POSTGRES_HOST" 5432; do
while ! sudo -u www-data nc -z "$POSTGRES_HOST" 5432; do
echo "Waiting for database to start..."
sleep 5
done
@ -13,7 +13,7 @@ export POSTGRES_USER
# Fix false database connection on old instances
if [ -f "/var/www/html/config/config.php" ]; then
sleep 2
while ! psql -d "postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST:5432/$POSTGRES_DB" -c "select now()"; do
while ! sudo -u www-data psql -d "postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST:5432/$POSTGRES_DB" -c "select now()"; do
echo "Waiting for the database to start..."
sleep 5
done
@ -28,8 +28,16 @@ if [ -n "$TRUSTED_CACERTS_DIR" ]; then
update-ca-certificates
fi
# Check datadir permissions
sudo -u www-data touch "$NEXTCLOUD_DATA_DIR/this-is-a-test-file" &>/dev/null
if ! [ -f "$NEXTCLOUD_DATA_DIR/this-is-a-test-file" ]; then
chown -R www-data:root "$NEXTCLOUD_DATA_DIR"
chmod 750 -R "$NEXTCLOUD_DATA_DIR"
fi
rm -f "$NEXTCLOUD_DATA_DIR/this-is-a-test-file"
# Run original entrypoint
if ! bash /entrypoint.sh; then
if ! sudo -u www-data bash /entrypoint.sh; then
exit 1
fi