Created
March 27, 2019 08:45
-
-
Save singhshivam/aff994615395a94eaade19b52da0ea1e to your computer and use it in GitHub Desktop.
WordPress creator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
for i in "$@" | |
do | |
case $i in | |
-p=*|--path=*) | |
path="${i#*=}" | |
shift # past argument=value | |
;; | |
-u=*|--url=*) | |
url="${i#*=}" | |
shift # past argument=value | |
;; | |
-t=*|--title=*) | |
title="${i#*=}" | |
shift # past argument=value | |
;; | |
-u=*|--admin_user=*) | |
admin_user="${i#*=}" | |
shift # past argument=value | |
;; | |
-p=*|--admin_password=*) | |
admin_password="${i#*=}" | |
shift # past argument=value | |
;; | |
-e=*|--admin_email=*) | |
admin_email="${i#*=}" | |
shift # past argument=value | |
;; | |
*) | |
# unknown option | |
;; | |
esac | |
done | |
if [ -z "$path" ] || [ -z "$url" ] || [ -z "$title" ] || [ -z "$admin_user" ] || [ -z "$admin_password" ] || [ -z "$admin_email" ]; then | |
printf "Arguments missing! \n" | |
printf "Mandatory arguments: \e[1m--path --url --title --admin_user --admin_password --admin_email\n" | |
exit | |
fi | |
if [ -d "$path" ] | |
then | |
printf "\n\n\nCleaning dir: $path\n" | |
printf "=================\n" | |
rm -rf "$path" | |
fi | |
mkdir -p "$path" | |
cd "$path" | |
printf "\n\n\nDownloading latest wordpress\n" | |
printf "=================\n" | |
wp core download --path="$path" | |
printf "\n\n\nCreating Config\n" | |
printf "=================\n" | |
wp config create --dbname="$title" --dbuser=shivam --dbpass=password | |
wp config set FS_METHOD direct | |
wp config set WP_DEBUG true --raw | |
wp config set BV_APP_URL http://localhost:3000 | |
wp config set BV_APP_HOST localhost | |
wp config set BV_APP_PORT 3000 --raw | |
printf "\n\n\nCreating Database\n" | |
printf "=================\n" | |
wp db create | |
printf "\n\n\nInstalling WordPress\n" | |
printf "=================\n" | |
wp core install --url="$url" --title="$title" --admin_user="$admin_user" --admin_password="$admin_password" --admin_email="$admin_email" | |
printf "\n\n\nInstalled WP VERSION: $(wp core version)\n" | |
printf "=================\n" | |
printf "\n\n\nInstalling BlogVault:\n" | |
printf "=================\n" | |
wp plugin install blogvault-real-time-backup --activate | |
printf "\n\n\nInstalling FakerPress:\n" | |
printf "=================\n" | |
wp plugin install fakerpress --activate | |
printf "\n\n\n\e[32mAll Done!\n" | |
printf "=================\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment