47 lines
1.2 KiB
Bash
47 lines
1.2 KiB
Bash
#!/bin/sh
|
|
|
|
# This script is used to install WordPress and configure it with a MariaDB database.
|
|
# It checks for the presence of a database and user, creates them if they don't exist,
|
|
# and sets up the WordPress configuration file with the database connection details.
|
|
echo "Installing WordPress..."
|
|
sleep 10
|
|
|
|
# Check if the database exists
|
|
|
|
echo "wp core download --allow-root --path=/var/www/html"
|
|
wp core download --allow-root --path=/var/www/html
|
|
|
|
echo "wp config create --allow-root"
|
|
wp config create --allow-root \
|
|
--dbname=$MYSQL_DATABASE \
|
|
--dbuser=$MYSQL_USER \
|
|
--dbpass=$MYSQL_PASSWORD \
|
|
--dbhost=$DB_HOST \
|
|
--path=/var/www/html
|
|
|
|
echo "wp core install --allow-root"
|
|
wp core install --allow-root \
|
|
--url=$DOMAIN_NAME \
|
|
--title=$WP_TITLE \
|
|
--admin_user=$WP_ADMIN \
|
|
--admin_password=$WP_ADMIN_PASSWORD \
|
|
--admin_email=$WP_ADMIN_EMAIL \
|
|
--path=/var/www/html
|
|
|
|
echo "wp user create --allow-root"
|
|
wp user create --allow-root \
|
|
$WP_USER \
|
|
$WP_USER_EMAIL \
|
|
--role=author \
|
|
--user_pass=$WP_USER_PASSWORD \
|
|
--path=/var/www/html
|
|
|
|
echo "wp theme install --allow-root"
|
|
wp theme install --allow-root \
|
|
$WP_THEME \
|
|
--activate \
|
|
--path=/var/www/html
|
|
|
|
echo "WordPress installation completed."
|
|
|
|
exec "$@" |