Bash script for building Drupal distributions
Bash script for building Drupal distributions
I posted this as a gist, but I thought a usage tutorial was in order.
Source the file from your .bash_profile (or .zshrc if that's what you're using):source /path/to/custom/scripts/dice.sh
The contents of the script:
# sourced from .zshrc (or .bash_profile)
# Usage: dice makefile docroot dbuser dbpass dbname sitename install-profile
drupal_install_clean_env() {
if [[ -r $2 ]]; then
sudo rm -r $2
cd ~/
fi
if [[ -r $1 ]]; then
drush make $1 $2
cd $2
drush si $7 --db-url=mysql://$3:$4@localhost:3306/$5 --db-su=$3 --db-su-pw=$4 --site-name="$6" --account-name=admin --account-pass=admin -y
# Files directory (local dev)
sudo chmod -R 777 $2/sites/default/files
# Files directory (remote dev/stage/prod)
#sudo chown -R _www:_www $2/sites/default/files
fi
}
alias dice=drupal_install_clean_env
Example usage
Download Drupal Commons:git clone --branch 7.x-3.x http://git.drupal.org/project/commons.git
cd commons
Run the script, replacing the [arguments] in brackets with your own environmental variables:dice build-commons.make ~/Sites/commons [dbuser] [dbpass] [database] [sitename] commons