2018-01-17 20:31:32 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
sed -i -e "s/<APC_SHM_SIZE>/$APC_SHM_SIZE/g" /php/conf.d/apcu.ini \
|
|
|
|
-e "s/<OPCACHE_MEM_SIZE>/$OPCACHE_MEM_SIZE/g" /php/conf.d/opcache.ini \
|
|
|
|
-e "s/<CRON_MEMORY_LIMIT>/$CRON_MEMORY_LIMIT/g" /etc/s6.d/cron/run \
|
|
|
|
-e "s/<CRON_PERIOD>/$CRON_PERIOD/g" /etc/s6.d/cron/run \
|
|
|
|
-e "s/<MEMORY_LIMIT>/$MEMORY_LIMIT/g" /usr/local/bin/occ \
|
|
|
|
-e "s/<UPLOAD_MAX_SIZE>/$UPLOAD_MAX_SIZE/g" /nginx/conf/nginx.conf /php/etc/php-fpm.conf \
|
|
|
|
-e "s/<MEMORY_LIMIT>/$MEMORY_LIMIT/g" /php/etc/php-fpm.conf
|
|
|
|
|
|
|
|
# Put the configuration and apps into volumes
|
|
|
|
ln -sf /config/config.php /nextcloud/config/config.php &>/dev/null
|
|
|
|
ln -sf /apps2 /nextcloud &>/dev/null
|
2018-02-18 21:01:02 +01:00
|
|
|
chown -h $UID:$GID /nextcloud/config/config.php /nextcloud/apps2
|
2018-01-17 20:31:32 +00:00
|
|
|
|
|
|
|
# Create folder for php sessions if not exists
|
|
|
|
if [ ! -d /data/session ]; then
|
|
|
|
mkdir -p /data/session;
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Updating permissions..."
|
|
|
|
for dir in /nextcloud /data /config /apps2 /var/log /php /nginx /tmp /etc/s6.d; do
|
|
|
|
if $(find $dir ! -user $UID -o ! -group $GID|egrep '.' -q); then
|
|
|
|
echo "Updating permissions in $dir..."
|
|
|
|
chown -R $UID:$GID $dir
|
|
|
|
else
|
|
|
|
echo "Permissions in $dir are correct."
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
echo "Done updating permissions."
|
|
|
|
|
2020-10-17 16:51:38 +02:00
|
|
|
echo "Check for UserId ${UID}"
|
|
|
|
grep ":${UID}:" /etc/passwd 1>/dev/null 2>&1
|
|
|
|
ERRORCODE=$?
|
|
|
|
|
|
|
|
if [ $ERRORCODE -ne 0 ]; then
|
|
|
|
echo "Creating user nextcloud with UID=${UID} and GID=${GID}"
|
|
|
|
/usr/sbin/adduser -g ${GID} -u ${UID} --disabled-password --gecos "" nextcloud
|
|
|
|
else
|
|
|
|
echo "An existing user with UID=${UID} was found, nothing to do"
|
|
|
|
fi
|
|
|
|
|
2018-01-17 20:31:32 +00:00
|
|
|
if [ ! -f /config/config.php ]; then
|
|
|
|
# New installation, run the setup
|
|
|
|
/usr/local/bin/setup.sh
|
|
|
|
else
|
|
|
|
occ upgrade
|
|
|
|
fi
|
|
|
|
|
|
|
|
exec su-exec $UID:$GID /bin/s6-svscan /etc/s6.d
|