73 lines
2.4 KiB
Bash
73 lines
2.4 KiB
Bash
# src : https://gist.github.com/rjekic/2d04423bd167f8e7afd26f8982609378
|
|
|
|
#!/bin/bash -e
|
|
clear
|
|
echo "============================================"
|
|
echo "WordPress Install Script"
|
|
echo "============================================"
|
|
|
|
# Gathering database login credentials from user input
|
|
read -p "Database Host: " dbhost
|
|
read -p "Database Name: " dbname
|
|
read -p "Database User: " dbuser
|
|
read -sp "Database Password: " dbpass
|
|
echo
|
|
|
|
# Starting the Wordpress installation process
|
|
clear
|
|
|
|
# # Starting the Wordpress installation process using wp-cli
|
|
# echo "==================================="
|
|
# echo "Please wait while we install wp-cli"
|
|
# echo "==================================="
|
|
# curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
|
|
# chmod +x wp-cli.phar
|
|
# cp wp-cli.phar /usr/bin/wp
|
|
#
|
|
# echo "=========================="
|
|
# echo "Finished installing wp-cli"
|
|
# echo "=========================="
|
|
# echo
|
|
# read -p "Install wordpress in a new directory (y/n): " new
|
|
#
|
|
# if [ "$new" == y ] ; then
|
|
# read -p "Name of the wordpress directory: " dir_name
|
|
# mkdir -p $dir_name
|
|
# cd $dir_name
|
|
# fi
|
|
|
|
# Download the latest wordpress package using wp-cli
|
|
wp core download
|
|
# Creating wp-config file using credentials defined on lines 8-11
|
|
wp core config --dbhost=$dbhost --dbname=$dbname --dbuser=$dbuser --dbpass=$dbpass
|
|
chmod 640 wp-config.php
|
|
|
|
# Entering details of the new Wordpress site
|
|
clear
|
|
echo "======================================================="
|
|
echo "Ready to install Wordpress. Just enter few more details"
|
|
echo "======================================================="
|
|
read -p "Website url: " url
|
|
read -p "Website title: " title
|
|
read -p "Admin username: " admin_name
|
|
read -sp "Admin password: " admin_pass
|
|
echo
|
|
read -p "Admin email: " admin_email
|
|
echo
|
|
read -p "Run install? (y/n): " run_wp_install
|
|
|
|
if [ "$run_wp_install" == n ] ; then
|
|
exit
|
|
else
|
|
echo "============================================"
|
|
echo "A robot is now installing WordPress for you."
|
|
echo "============================================"
|
|
echo
|
|
# Installing Wordpress site using credentials defined on lines 71-76
|
|
wp core install --url=$url --title="$title" --admin_name=$admin_name --admin_password=$admin_pass --admin_email=$admin_email --allow-root
|
|
fi
|
|
|
|
# Themes
|
|
#wp theme install https://github.com/Automattic/_s/archive/master.zip --activate
|
|
#wp scaffold child-theme sample-theme --parent_theme=twentysixteen
|