Skip to content

Instantly share code, notes, and snippets.

@cravecode
Created August 3, 2011 17:08
Show Gist options
  • Save cravecode/1123162 to your computer and use it in GitHub Desktop.
Save cravecode/1123162 to your computer and use it in GitHub Desktop.
Shell Drush Install Script
#!/bin/bash
# Update user
echo "Drush is now downloading via HTTP"
# move to home dir
cd ~
# remove current drush (if existent)
rm -rf ~/.drush/
# create drush directory (and hide it)
mkdir ~/.drush/
# move to new dir
cd ~/.drush/
# get Drush
curl -C - -O -s http://ftp.drupal.org/files/projects/drush-7.x-4.4.tar.gz
# extract Drush v3
tar -xf drush*.tar.gz
# bin Drush tar
sudo rm -f drush-All*.tar.gz
# get Pear Console Table library
# This is to be depreciated in favour of a more reliable way
# pear install console_table
cd drush/includes
curl -C - -O -s http://download.pear.php.net/package/Console_Table-1.1.3.tgz
# extract Pear
tar -xf Console_Table*.tgz
# copy the file we need
sudo cp Console_Table-1.1.3/Table.php table.inc
# bin Console_Table tar
sudo rm -r Console_Table-1.1.3
sudo rm -f Console_Table*.tgz
# make drush command executable
cd ~/.drush/
#sudo chmod u+x drush/drush
chmod u+x drush/drush
# create symlink in path
sudo ln -s /home/$(whoami)/.drush/drush/drush /usr/local/bin/drush
# Update user on install
echo "Drush has been installed"
# Update Drush using Drush
~/.drush/drush/drush dl drush
# update drush_make in drush/commands
~/.drush/drush/drush dl drush_make
# move updated additions to correct directory
mv ~/.drush/drush_make ~/.drush/drush/commands/
# everything is installed, tell the user
cd ~
sudo drush dl drupal-7.x --drupal-project-rename=drupal
APACHEUSR=$(ps axho user,comm|grep -E "httpd|apache" | tail -n 1 | awk '{print $1}')
sudo chown -R $APACHEUSR /home/$(whoami)/drupal
cd ~/drupal
find . -type d -print0 | xargs -0r sudo chmod 755
find . -type f -print0 | xargs -0r sudo chmod 644
cd ~/.drush/drush/commands
sudo wget https://github.com/diversen/densite/tarball/x.x-1.8 -O densite-x.x-1.8-0.tar.gz
sudo tar -xf densite*.gz
sudo mv div* densite
sudo rm densite*.gz
#git clone git://github.com/diversen/densite.git
mkdir /home/$(whoami)/www
cd /home/$(whoami)/www
sudo cp /home/$(whoami)/.drush/drush/commands/densite/dist-densite.conf /home/$(whoami)/.drush/drush/commands/densite/densite.conf
sudo cp /home/$(whoami)/.drush/drush/commands/densite/apache2/dist-apache2.conf /home/$(whoami)/.drush/drush/commands/densite/apache2/apache2.conf
sudo mkdir /home/$(whoami)/.drush/drush/commands/densite/sql
read -p "Site domain to create: " NEWSITE
echo
drush densitein "$NEWSITE"
read -p "Install CiviCrm (y/n): " INSTALLCIVI
echo
if [ "$INSTALLCIVI" == "y" ]; then
mkdir /home/$(whoami)/.drush/drush/commands/civicrm
cd /home/$(whoami)/.drush/drush/commands/civicrm
sudo wget http://svn.civicrm.org/tools/branches/v4.0/drupal/drush/civicrm.drush.inc
cd ~
wget wget -O /home/$(whoami)/civicrm-4.0.5-drupal.tar.gz http://voxel.dl.sourceforge.net/project/civicrm/civicrm-stable/4.0.5/civicrm-4.0.5-drupal.tar.gz
cd /home/$(whoami)/www/$NEWSITE/htdocs
read -p "CiviCrm database name: " CIVIDB
echo
drush civicrm-install --dbuser=root --dbpass=mm07e1bca901~mm --dbhost=localhost --dbname=$CIVIDB --tarfile=/home/$(whoami)/civicrm-4.0.5-drupal.tar.gz --destination=sites/all/modules
drush dl panels
drush dl ctools
drush dl features
drush dl rules
drush en -y panels
drush en -y ctools
drush en -y features
drush en -y rules
drush en -y rules_admin
fi
#PASTE back the extra stuff when needed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment