/[drupal]/contributions/modules/drush/drush
ViewVC logotype

Contents of /contributions/modules/drush/drush

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.9 - (show annotations) (download)
Tue Oct 13 04:36:25 2009 UTC (6 weeks, 2 days ago) by grugnog
Branch: MAIN
CVS Tags: DRUPAL-6--2-1
Changes since 1.8: +7 -3 lines
#529114 - dugh - special cases for XAMPP on Linux and OS X.
1 #!/usr/bin/env bash
2 # $Id: drush,v 1.8 2009/08/18 19:17:29 weitzman Exp $
3 #
4 # This script is a simple wrapper that will run Drush with the most appropriate
5 # php executable it can find.
6 #
7
8 # Get the absolute path of this executable
9 ORIGDIR=$(pwd)
10 SELF_PATH=$(cd -P -- "$(dirname -- "$0")" && pwd -P) && SELF_PATH=$SELF_PATH/$(basename -- "$0")
11
12 # Resolve symlinks - this is the equivalent of "readlink -f", but also works with non-standard OS X readlink.
13 while [ -h $SELF_PATH ]; do
14 # 1) cd to directory of the symlink
15 # 2) cd to the directory of where the symlink points
16 # 3) Get the pwd
17 # 4) Append the basename
18 DIR=$(dirname -- "$SELF_PATH")
19 SYM=$(readlink $SELF_PATH)
20 SELF_PATH=$(cd $DIR && cd $(dirname -- "$SYM") && pwd)/$(basename -- "$SYM")
21 done
22 cd "$ORIGDIR"
23
24 # Build the path to drush.php.
25 SCRIPT_PATH=$(dirname $SELF_PATH)/drush.php
26 [[ $(uname -a) == CYGWIN* ]] && SCRIPT_PATH=$(cygpath -w -a -- "$SCRIPT_PATH")
27
28 # If it is not exported determine and export the number of columns.
29 if [ -z $COLUMNS ]; then
30 export COLUMNS=$(tput cols)
31 fi
32
33 # Special case for *AMP installers, since they normally don't set themselves as the default cli php out of the box.
34 if [ -f /Applications/MAMP/bin/php5/bin/php ]; then # MAMP (OS X)
35 /Applications/MAMP/bin/php5/bin/php $SCRIPT_PATH "$@"
36 elif [ -f /opt/lampp/bin/php ]; then # XAMPP on GNU/Linux
37 /opt/lampp/bin/php $SCRIPT_PATH "$@"
38 elif [ -f /Applications/xampp/xamppfiles/bin/php ]; then # XAMPP on OS X
39 /Applications/xampp/xamppfiles/bin/php $SCRIPT_PATH "$@"
40 else
41 # We check for a command line (cli) version of php, and if found use that.
42 /usr/bin/env php-cli -v &> /dev/null
43 if [ "$?" = 0 ] ; then
44 /usr/bin/env php-cli $SCRIPT_PATH "$@"
45 else
46 # Alternatively we run with straight php, which works on most other systems.
47 /usr/bin/env php $SCRIPT_PATH "$@"
48 fi
49 fi

  ViewVC Help
Powered by ViewVC 1.1.2