root/tags/2.2.0/bin/phing

Revision 50, 1.7 kB (checked in by mrook, 3 years ago)

Fix syntax for non-bash sh's (closes issue #25)

  • Property svn:executable set to *
Line 
1 #!/bin/sh
2 # Shell wrapper for Phing
3 # $Id: phing,v 1.2 2006/01/23 21:51:16 mrook Exp $
4 #
5 # This script will do the following:
6 # - check for PHP_COMMAND env, if found, use it.
7 #   - if not found assume php is on the path
8 # - check for PHING_HOME evn, if found use it
9 #   - if not look for it
10 # - check for PHP_CLASSPATH, if found use it
11 #   - if not found set it using PHING_HOME/classes
12
13 if [ -z "$PHING_HOME" ] ; then
14
15   # echo "WARNING: PHING_HOME environment not set. Attempting to guess."
16
17   # try to find PHING
18   if [ -d /opt/phing ] ; then
19     PHING_HOME=/opt/phing
20   fi
21
22   if [ -d "${HOME}/opt/phing" ] ; then
23     PHING_HOME="${HOME}/opt/phing"
24   fi
25
26   if [ -d "/usr/local/phing" ] ; then
27     PHING_HOME="/usr/local/phing"
28   fi
29
30   if [ -d "${HOME}/usr/phing" ] ; then
31     PHING_HOME="${HOME}/usr/phing"
32   fi
33  
34   ## resolve links - $0 may be a link to phing's home
35   PRG="$0"
36   progname=`basename "$0"`
37   saveddir=`pwd`
38
39   # need this for relative symlinks
40   dirname_prg=`dirname "$PRG"`
41   cd "$dirname_prg"
42  
43   while [ -h "$PRG" ] ; do
44     ls=`ls -ld "$PRG"`
45     link=`expr "$ls" : '.*-> \(.*\)$'`
46     if expr "$link" : '/.*' > /dev/null; then
47         PRG="$link"
48     else
49         PRG=`dirname "$PRG"`"/$link"
50     fi
51   done
52  
53   PHING_HOME=`dirname "$PRG"`/..
54
55   cd "$saveddir"
56
57   # make it fully qualified
58   PHING_HOME=`cd "$PHING_HOME" && pwd`
59  
60   # make it available in PHP via getenv("PHING_HOME")
61   export PHING_HOME
62 fi
63
64 if (test -z "$PHP_COMMAND") ; then
65         # echo "WARNING: PHP_COMMAND environment not set. (Assuming php on PATH)"
66         PHP_COMMAND=php
67         export PHP_COMMAND
68 fi
69
70 if (test -z "$PHP_CLASSPATH") ; then
71         PHP_CLASSPATH=$PHING_HOME/classes
72         export PHP_CLASSPATH
73 fi
74
75 $PHP_COMMAND -d html_errors=off -qC $PHING_HOME/bin/phing.php -logger phing.listener.AnsiColorLogger $@
Note: See TracBrowser for help on using the browser.