52 lines
1.8 KiB
Bash
Executable File
52 lines
1.8 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
set -eu
|
|
|
|
mkdir -p /run/php/session
|
|
|
|
if ! [ -f /app/data/.installed ]; then
|
|
echo "==> Fresh installation, setting up..."
|
|
rsync -a /app/code/data-orig/ /app/data/
|
|
php cli/do-install.php \
|
|
--environment production --default_user admin \
|
|
--db-type mysql --db-host "${CLOUDRON_MYSQL_HOST}" \
|
|
--db-user "${CLOUDRON_MYSQL_USERNAME}" --db-password "${CLOUDRON_MYSQL_PASSWORD}" \
|
|
--db-base "${CLOUDRON_MYSQL_DATABASE}" --db-prefix "" \
|
|
--disable_update
|
|
php cli/create-user.php --user admin --password changeme --language en
|
|
touch /app/data/.installed
|
|
echo "==> Done."
|
|
fi
|
|
|
|
if [[ ! -f /app/data/php.ini ]]; then
|
|
echo -e "; Add custom PHP configuration in this file\n; Settings here are merged with the package's built-in php.ini\n\n" > /app/data/php.ini
|
|
fi
|
|
|
|
echo "==> Symlinking log file"
|
|
rm -f /app/data/users/_/log_api.txt
|
|
touch /tmp/log_api.txt
|
|
ln -s /tmp/log_api.txt /app/data/users/_/log_api.txt
|
|
|
|
# We have to copy instead of symlinking extensions (see #2)
|
|
echo "==> Copying packaged extensions"
|
|
mkdir -p /app/data/extensions
|
|
for f in $(ls /app/code/extensions-orig); do
|
|
rm -rf "/app/data/extensions/$f"
|
|
cp -r "/app/code/extensions-orig/$f" "/app/data/extensions"
|
|
done
|
|
|
|
echo "==> Updating config file"
|
|
php cli/reconfigure.php --default_user admin --base_url "https://${CLOUDRON_APP_DOMAIN}" \
|
|
--db-type mysql --db-host "${CLOUDRON_MYSQL_HOST}" \
|
|
--db-user "${CLOUDRON_MYSQL_USERNAME}" --db-password "${CLOUDRON_MYSQL_PASSWORD}" \
|
|
--db-base "${CLOUDRON_MYSQL_DATABASE}" --db-prefix "" \
|
|
--disable_update
|
|
|
|
echo "==> Setting permissions"
|
|
chown -R www-data.www-data /run/php /app/data /tmp/log_api.txt
|
|
|
|
echo "==> Starting apache"
|
|
APACHE_CONFDIR="" source /etc/apache2/envvars
|
|
rm -f "${APACHE_PID_FILE}"
|
|
exec /usr/sbin/apache2 -DFOREGROUND
|