Skip to content

Instantly share code, notes, and snippets.

@jmslbam
Created November 1, 2012 22:58
Show Gist options
  • Save jmslbam/3997299 to your computer and use it in GitHub Desktop.
Save jmslbam/3997299 to your computer and use it in GitHub Desktop.
Wordpress wp-cli install bash
#!/bin/bash
#
# This script has been adapted from the drush wrapper script
# and all credit should go to the authors of that project:
# http://drupal.org/project/drush
# Get the absolute path of this executable
ORIGDIR=$(pwd)
SELF_PATH=$(cd -P -- "$(dirname -- "$0")" && pwd -P) && SELF_PATH=$SELF_PATH/$(basename -- "$0")
# Resolve symlinks - this is the equivalent of "readlink -f", but also works with non-standard OS X readlink.
while [ -h "$SELF_PATH" ]; do
# 1) cd to directory of the symlink
# 2) cd to the directory of where the symlink points
# 3) Get the pwd
# 4) Append the basename
DIR=$(dirname -- "$SELF_PATH")
SYM=$(readlink $SELF_PATH)
SELF_PATH=$(cd $DIR && cd $(dirname -- "$SYM") && pwd)/$(basename -- "$SYM")
done
cd "$ORIGDIR"
echo "$ORIGDIR"
echo "making httpdocs"
mkdir "$ORIGDIR/httpdocs"
echo "httpdocs created"
echo "Creating cnf directory"
mkdir "$ORIGDIR/cnf"
cd cnf
touch > 'settings.php'
echo "cnf created"
echo "Running wp core download in httpdocs";
cd "$ORIGDIR/httpdocs"
wp core download
echo "WordPress Core downloaded";
echo "Installing first install WordPress"
echo "Asking for database credentials"
echo "Enter dbname"
read dbname
echo "Enter dbuser"
read dbuser
#while read dbuser && [[ -z "${dbuser}" ]]; do
# read dbuser
#done
echo "Enter dbpass"
read dbpass
wp core config --dbname=dbname --dbuser=dbuser --dbpass=dbpass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment