Skip to content

Instantly share code, notes, and snippets.

@palpalani
Last active December 22, 2015 22:09
Show Gist options
  • Save palpalani/6538489 to your computer and use it in GitHub Desktop.
Save palpalani/6538489 to your computer and use it in GitHub Desktop.
WordPress sandbox install
#!/bin/sh
# WordPress Sandbox
# palPalani
# m3webware.com
# requires wp-cli
# usage: wordpress-sandbox
# or: ./wordpress-sandbox.sh
# Download WordPress
read -p "Project name (lowercase):" PROJECT
cd /var/www/wp
mkdir $PROJECT && cd $_
wp core download
# wp-config
read -p "Database Name: " DBNAME
read -p "Database User: " DBUSER
read -p "Database Password: " DBPASS
#wp core config --dbhost=$DBHOST --dbname=$DBNAME --dbuser=$DBUSER --dbpass=$DBPASS
wp core config --dbname=$DBNAME --dbuser=$DBUSER --dbpass=$DBPASS
# Install site
read -p "Url: " SITEURL
read -p "Title: " SITETITLE
read -p "Login name: " ADMIN_NAME
read -p "E-mail: " SITEMAIL
read -p "Site Password: " SITEPASS
read -p "Install site? (y/n)" SITERUN
if [ "$SITERUN" != "y" ] ; then
exit
else
wp core install --url=$SITEURL --title=$SITETITLE --admin_name=$ADMIN_NAME --admin_email=$SITEMAIL --admin_password=$SITEPASS
#Promt default plugin deletion
read -p "Do you wish to delete default plugins? (y/n) " plugdel
if [ "$plugdel" = "y" ]; then
wp plugin delete akismet
wp plugin delete hello-dolly
echo 'Plugins deleted!'
fi
#Promt default theme deletion
read -p "Do you wish to delete default themes? (y/n) " themedel
if [ "$themedel" = "y" ]; then
wp theme delete twentyten
wp theme delete twentyeleven
wp theme delete twentytwelve
wp theme delete twentythirteen
echo 'Themes deleted!'
fi
#promt aggresive cache
read -p "Do you wish to install SEO plugins with aggressive cache? (y/n) " plugaggr
if [ "$plugaggr" = "y" ]; then
wp plugin install jetpack --activate
wp plugin install wordpress-seo --activate
wp plugin install seo-image --activate
wp plugin install w3-total-cache --activate
wp plugin install backwpup --activate
fi
#promt lite cache
read -p "Do you wish to install SEO plugins with lite cache? (y/n) " pluglite
if [ "$pluglite" = "y" ]; then
wp plugin install jetpack --activate
wp plugin install wordpress-seo --activate
wp plugin install w3-total-cache --activate
wp plugin install wp-super-cache --activate
fi
#Analytics
read -p "Do you wish to install Google Analytics? (y/n) " analytics
if [ "$analytics" = "y" ]; then
wp plugin install google-analytics-for-wordpress --activate
fi
#Ninja
read -p "Do you wish to install Forms? (y/n) " ninja
if [ "$ninja" = "y" ]; then
wp plugin install ninja-forms --activate
fi
#Genesis
#WPgeeks starter/sandbox theme
#cd wp-content/themes && wget https://github.com/eddiemachado/bones/zipball/master && unzip master && mv eddie* $PROJECT && rm master && cd /var/www/$PROJECT
#wp theme activate bones
wget --http-user=palpalani --http-password=password http://m3webware.com/wp/genesis.tar.gz
mv genesis.tar.gz wp-content/themes/
tar -xzf wp-content/themes/genesis.tar.gz
rm wp-content/themes/genesis.tar.gz
wget --http-user=palpalani --http-password=password http://m3webware.com/wp/wpgeeks.tar.gz
mv genesis.tar.gz wp-content/themes/
tar -xzf wp-content/themes/wpgeeks.tar.gz
rm wp-content/themes/wpgeeks.tar.gz
wp theme activate wpgeeks
#Admin brandling from plugin
wget --http-user=palpalani --http-password=password http://m3webware.com/wp/wpgeeks-tools.tar.gz
mv wpgeeks-tools.tar.gz wp-content/plugins/
tar -xzf wp-content/plugins/wpgeeks-tools.tar.gz
rm wp-content/plugins/wpgeeks-tools.tar.gz
#Create user
read -p "Enter username:" username
read -p "Enter email:" email
if [ -n "$pluglite"]; then
wp user create $username $email
fi
# Need to find the solution for adding this in to wp-config.php
define('FS_METHOD', 'direct');
define('FS_CHMOD_DIR', 0775);
define('FS_CHMOD_FILE', 0664);
//Show Them status
wp theme status
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment