#!/bin/bash # ============================ # DRUSH INSTALLATION SCRIPT # ============================ # Download Drush v3 from D.O and make it work on `drush` (OS X / Linux / *nix). # Script is designed to be re-run any time Drush needs to be updated. # Created by stemount, adapted by KarenS. # Script also retrieves and installs Drush Make, Provision, and Module Builder. # Those parts can be commented out if not desired. # We put Drush Make, Provision, and Module Builder in the Drush commands # directory to make it easy to wipe and replace them with newer # versions by re-running this script without affecting # custom files that might be in the .drush folder. # ============================ # SETUP # ============================ # Recommended paths are either ~./drush to enable Drush # for a single user or /usr/share/drush to allow # all users to use Drush. The final Drush location # will end up being /usr/share/drush/drush because # we are extracting files in /usr/share/drush. # Create the desired directory if it doesn't already # exist and drop this script into it, then cd into it. # Be sure to do u+x drush_downloader.sh # to make the script executable, then execute it. # Remove current drush (if existent). rm -rf /usr/share/drush/drush # Create drush directory in case it does not already exist. mkdir /usr/share/drush/ # Move to new directory. cd /usr/share/drush # ============================ # GET DRUSH CORE # ============================ # get Drush v3 curl -C - -O http://ftp.drupal.org/files/projects/drush-All-versions-3.0.tar.gz # extract Drush v3 tar -xf drush*.tar.gz # bin Drush tar rm -f drush-All*.tar.gz # Get Pear Console Table library. cd drush/includes curl -C - -O http://download.pear.php.net/package/Console_Table-1.1.3.tgz # extract Pear tar -xf Console_Table*.tgz # copy the file we need cp Console_Table-1.1.3/Table.php table.inc # bin Console_Table tar rm -r Console_Table-1.1.3 rm -f Console_Table*.tgz # ============================ # GET DRUSH MAKE # ============================ cd .. cd drush/commands curl -C - -O http://ftp.drupal.org/files/projects/drush_make-6.x-2.x-dev.tar.gz # extract Drush Make tar -xf drush*.tar.gz # bin Drush tar rm -f drush_make*.tar.gz # ============================ # GET PROVISION # ============================ curl -C - -O http://ftp.drupal.org/files/projects/provision-6.x-0.3.tar.gz # extract Provision tar -xf provision*.tar.gz # bin Provision tar rm -f provision*.tar.gz # ============================ # GET MODULE BUILDER # ============================ curl -C - -O http://ftp.drupal.org/files/projects/module_builder-6.x-2.x-dev.tar.gz # extract Module Builder tar -xf module_builder*.tar.gz # bin Module Builder tar rm -f module_builder*.tar.gz # ============================ # FINALIZATION # ============================ # Make drush command executable. cd /usr/share/drush chmod u+x drush/drush # Either alias the Drush path or add a symbolic link. # Hide one or the other of the following options: # Alias drush and put in bash profile # echo "alias drush='/usr/share/drush/drush'" >> ~/.bash_profile # Add symbolic link to drush files so they are executable anywhere rm /usr/bin/drush ln -s /usr/share/drush/drush /usr/bin/drush # Make and alias .drush in case it is needed for custom files. mkdir /usr/share/drush/.drush echo "alias drush='drush --config= /usr/share/drush/.drush'" >> ~/.bash_profile