Created
April 28, 2015 11:53
-
-
Save tormjens/de6494cdbcaf7e41314e to your computer and use it in GitHub Desktop.
Simple shell script to copy a Roots bedrock template
This file contains 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/sh | |
# default path | |
dir="$PWD" | |
parentdir="$(dirname "$dir")" | |
template="$dir/template" | |
subdomains="$parentdir/subdomains" | |
domain="dev.anunatak.com" | |
# ask for template path | |
echo "Where is the template bedrock located? [default: $template]" | |
read path_input | |
# ask which user owns the account | |
echo "Who owns the site?" | |
read owner | |
# if used supplied a path, lets use it | |
if [ -n "$path_input" ] | |
then | |
template=$path_input | |
fi | |
# ask for name of site | |
echo "Site name (slug):" | |
read site_name | |
sitedir="$dir/$site_name" | |
# ask for database name | |
echo "Database name:" | |
read database_name | |
# ask for database user | |
echo "Database user:" | |
read database_user | |
# ask for database password | |
echo "Database password:" | |
read database_pass | |
# copy the the template to the site name folder | |
cp -r $template $sitedir | |
chown -R $owner:$owner $sitedir | |
# create a symbiotic link to the sitedir to the subdomain | |
ln -s "$dir/$site_name/web" "$subdomains/$site_name" | |
# write to .env file | |
echo "WP_ENV=development | |
DB_USER=$database_user | |
DB_NAME=$database_name | |
DB_PASSWORD=$database_pass | |
WP_SITEURL=http://$site_name.$domain/wp | |
WP_HOME=http://$site_name.$domain/ | |
" > "$dir/$site_name/.env" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment