2023-05-20 23:06:24 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Are you root?
|
|
|
|
if [ "$EUID" -ne 0 ]; then
|
|
|
|
echo -e "\033[0;31mThis script must be run as root.\033[0m"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2023-06-07 21:16:31 +00:00
|
|
|
##################################################################
|
|
|
|
# ENV file
|
|
|
|
##################################################################
|
|
|
|
# Verify the .env file exists
|
|
|
|
if [ ! -f ".env" ]; then
|
|
|
|
echo "Error: The .env file does not exist."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Load environment variables from .env file
|
|
|
|
set -o allexport
|
|
|
|
source .env
|
|
|
|
set +o allexport
|
|
|
|
|
|
|
|
##################################################################
|
|
|
|
# Variables
|
|
|
|
##################################################################
|
2023-05-20 23:06:24 +00:00
|
|
|
PROJECTNAME=$(basename "$(pwd)")
|
|
|
|
|
2023-06-07 21:16:31 +00:00
|
|
|
# Joomla Configuration Defaults
|
|
|
|
if [ -z "$JCONFIG_REPORTING" ]; then
|
|
|
|
JCONFIG_REPORTING='none'
|
|
|
|
fi
|
|
|
|
if [ -z "$JCONFIG_TIMEZONE" ]; then
|
|
|
|
JCONFIG_TIMEZONE='America/Vancouver'
|
|
|
|
fi
|
|
|
|
if [ -z "$JCONFIG_SEF" ]; then
|
|
|
|
JCONFIG_SEF=true
|
|
|
|
fi
|
|
|
|
# SMTP ENV CHECK
|
|
|
|
if [ -z "$SMTP_MAILER" ]; then
|
|
|
|
SMTP_MAILER='/usr/sbin/sendmail'
|
|
|
|
fi
|
|
|
|
if [ -z "$SMTP_USER" ]; then
|
|
|
|
SMTP_USER=null
|
|
|
|
fi
|
|
|
|
if [ -z "$SMTP_PASS" ]; then
|
|
|
|
SMTP_PASS=null
|
|
|
|
fi
|
|
|
|
if [ -n "$SMTP_PASS" ]; then
|
|
|
|
SMTP_AUTH=true
|
|
|
|
else
|
|
|
|
SMTP_AUTH=false
|
|
|
|
fi
|
|
|
|
if [ -z "$SMTP_HOST" ]; then
|
|
|
|
SMTP_HOST='mailhog'
|
|
|
|
fi
|
|
|
|
if [ -z "$SMTP_SECURITY" ]; then
|
|
|
|
SMTP_SECURITY='None'
|
|
|
|
fi
|
|
|
|
if [ -z "$SMTP_PORT" ]; then
|
|
|
|
SMTP_PORT=1025
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Set configuration.php
|
|
|
|
docker-compose exec -u www-data joomla php cli/joomla.php config:set error_reporting="${JCONFIG_REPORTING}"
|
|
|
|
docker-compose exec -u www-data joomla php cli/joomla.php config:set offset="${JCONFIG_TIMEZONE}"
|
|
|
|
docker-compose exec -u www-data joomla php cli/joomla.php config:set sef_rewrite="${JCONFIG_SEF}"
|
|
|
|
#SMTP
|
2023-06-10 06:45:43 +00:00
|
|
|
docker-compose exec -u www-data joomla php cli/joomla.php config:set mailer=smtp
|
2023-06-07 21:16:31 +00:00
|
|
|
docker-compose exec -u www-data joomla php cli/joomla.php config:set sendmail="${SMTP_MAILER}"
|
|
|
|
docker-compose exec -u www-data joomla php cli/joomla.php config:set smtpuser="${SMTP_USER}"
|
|
|
|
docker-compose exec -u www-data joomla php cli/joomla.php config:set smtppass="${SMTP_PASS}"
|
|
|
|
docker-compose exec -u www-data joomla php cli/joomla.php config:set smtpauth="${SMTP_AUTH}"
|
|
|
|
docker-compose exec -u www-data joomla php cli/joomla.php config:set smtphost="${SMTP_HOST}"
|
|
|
|
docker-compose exec -u www-data joomla php cli/joomla.php config:set smtpsecure="${SMTP_SECURITY}"
|
|
|
|
docker-compose exec -u www-data joomla php cli/joomla.php config:set smtpport="${SMTP_PORT}"
|
|
|
|
|
|
|
|
# Remove uneeded Joomla files
|
2023-05-20 23:06:24 +00:00
|
|
|
rm -f html/web.config.txt
|
|
|
|
rm -f html/htaccess.txt
|
|
|
|
rm -f html/LICENSE.txt
|
2023-05-24 17:43:00 +00:00
|
|
|
rm -f html/README.txt
|
2023-05-20 23:06:24 +00:00
|
|
|
|
2023-06-07 21:16:31 +00:00
|
|
|
# Remove Install helper scripts
|
2023-05-20 23:06:24 +00:00
|
|
|
rm -rf bin/inc_new_project
|
2023-07-10 06:34:46 +00:00
|
|
|
rm -rf bin/joomla_new_project.sh
|
|
|
|
rm -rf bin/joomla_install.sh
|
2023-12-19 21:17:56 +00:00
|
|
|
rm -rf bin/install_extensions.sh
|
|
|
|
|
|
|
|
rm $0
|
2023-05-20 23:06:24 +00:00
|
|
|
|
2023-06-07 21:16:31 +00:00
|
|
|
echo "Now check the results and commit them to Git"
|