forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From je...@apache.org
Subject cvs commit: xml-forrest/src/resources/forrestbot/bin forrestbot
Date Thu, 28 Nov 2002 15:34:31 GMT
jefft       2002/11/28 07:34:31

  Modified:    src/resources/forrest-shbat/bin forrest
               src/resources/forrestbot/bin forrestbot
  Log:
  More sophisticated FORREST_HOME handling. Thanks to Bruno Dumon
  
  Revision  Changes    Path
  1.7       +30 -2     xml-forrest/src/resources/forrest-shbat/bin/forrest
  
  Index: forrest
  ===================================================================
  RCS file: /home/cvs/xml-forrest/src/resources/forrest-shbat/bin/forrest,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- forrest	6 Nov 2002 03:29:35 -0000	1.6
  +++ forrest	28 Nov 2002 15:34:31 -0000	1.7
  @@ -2,8 +2,36 @@
   
   # set the current working dir as the PROJECT_HOME variable 
   PROJECT_HOME="$PWD"
  -# use the location of this script to infer $FORREST_HOME
  -FORREST_HOME=`dirname "$0"`/..
  +
  +# Try to determine the FORREST_HOME
  +if [ -z "$FORREST_HOME" ] ; then
  +  # Note: this piece of code is based on ant's shell script
  +
  +  ## resolve links - $0 may be a link to ant's home
  +  PRG=$0
  +  progname=`basename $0`
  +  saveddir=`pwd`
  +
  +  # need this for relative symlinks
  +  cd `dirname $PRG`
  +
  +  while [ -h "$PRG" ] ; do
  +    ls=`ls -ld "$PRG"`
  +    link=`expr "$ls" : '.*-> \(.*\)$'`
  +    if expr "$link" : '.*/.*' > /dev/null; then
  +  PRG="$link"
  +    else
  +  PRG="`dirname $PRG`/$link"
  +    fi
  +  done
  +
  +  FORREST_HOME=`dirname "$PRG"`/..
  +
  +  # make it fully qualified
  +  FORREST_HOME=`cd "$FORREST_HOME" && pwd`
  +
  +  cd $saveddir
  +fi
   
   # set the ant file to use
   ANTFILE="$FORREST_HOME/forrest.build.xml"
  
  
  
  1.3       +30 -2     xml-forrest/src/resources/forrestbot/bin/forrestbot
  
  Index: forrestbot
  ===================================================================
  RCS file: /home/cvs/xml-forrest/src/resources/forrestbot/bin/forrestbot,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- forrestbot	26 Nov 2002 15:30:17 -0000	1.2
  +++ forrestbot	28 Nov 2002 15:34:31 -0000	1.3
  @@ -1,7 +1,35 @@
   #!/bin/sh
   
  -# use the location of this script to infer $FORREST_HOME
  -FORREST_HOME=`dirname "$0"`/..
  +# Try to determine the FORREST_HOME
  +if [ -z "$FORREST_HOME" ] ; then
  +  # Note: this piece of code is based on ant's shell script
  +
  +  ## resolve links - $0 may be a link to ant's home
  +  PRG=$0
  +  progname=`basename $0`
  +  saveddir=`pwd`
  +
  +  # need this for relative symlinks
  +  cd `dirname $PRG`
  +
  +  while [ -h "$PRG" ] ; do
  +    ls=`ls -ld "$PRG"`
  +    link=`expr "$ls" : '.*-> \(.*\)$'`
  +    if expr "$link" : '.*/.*' > /dev/null; then
  +  PRG="$link"
  +    else
  +  PRG="`dirname $PRG`/$link"
  +    fi
  +  done
  +
  +  FORREST_HOME=`dirname "$PRG"`/..
  +
  +  # make it fully qualified
  +  FORREST_HOME=`cd "$FORREST_HOME" && pwd`
  +
  +  cd $saveddir
  +fi
  +
   FORRESTBOT_HOME="$FORREST_HOME/forrestbot"
   
   # set the ant file to use
  
  
  

Mime
View raw message