This repository has been archived on 2024-08-08. You can view files and clone it, but cannot push or open issues or pull requests.
joomla/bin/setup_joomla_installer.sh

51 lines
1.4 KiB
Bash
Raw Normal View History

2023-05-20 13:37:56 -07:00
#!/bin/bash
PROJECTNAME=$(basename "$(pwd)")
# Are you root?
if [ "$EUID" -ne 0 ]; then
echo -e "\033[0;31mThis script must be run as root.\033[0m"
exit 1
fi
##################################################################
# 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
##################################################################
# create json file
##################################################################
DB_PREFIX=$(echo $RANDOM | md5sum | awk '{print substr($1, 1, 3)}')_
docker-compose exec -u www-data joomla sh -c "echo '{
\"language\":\"en-GB\",
\"site_name\":\"$PROJECTNAME\",
\"admin_email\":\"$EMAIL\",
\"admin_user\":\"$JOOMLA_USER\",
\"admin_password\":\"$JOOMLA_PASSWORD\",
\"db_type\":\"mysql\",
\"db_host\":\"mariadb\",
\"db_user\":\"$MYSQL_USER\",
\"db_pass\":\"$MYSQL_PASSWORD\",
\"db_name\":\"$MYSQL_DATABASE\",
\"db_prefix\":\"$DB_PREFIX\",
\"db_old\":\"remove\",
\"helpurl\":\"https://joomla.org\"
}' > config.json"
##################################################################
# run the installer
##################################################################
docker-compose exec -u www-data joomla php cli/joomla.php core:install --file=config.json