mirror of https://github.com/apache/maven.git
PR: MNG-247
Submitted by: Jerome Lacoste Reviewed by: Brett Porter make m2 shell script find home when it is a symlink git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@293186 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4b0bf293fc
commit
5de7973576
|
@ -55,28 +55,27 @@ if [ -z "$M2_HOME" ] ; then
|
|||
|
||||
## resolve links - $0 may be a link to maven's home
|
||||
PRG="$0"
|
||||
saveddir=`pwd`
|
||||
|
||||
# need this for relative symlinks
|
||||
PRGDIR=`dirname "$PRG"`
|
||||
cd "$PRGDIR"
|
||||
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '.*/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
PRG="$link"
|
||||
else
|
||||
PRG="$PRGDIR/$link"
|
||||
PRG="`dirname "$PRG"`/$link"
|
||||
fi
|
||||
done
|
||||
|
||||
M2_HOME="$PRGDIR/.."
|
||||
saveddir=`pwd`
|
||||
|
||||
M2_HOME=`dirname "$PRG"`/..
|
||||
|
||||
# make it fully qualified
|
||||
M2_HOME=`cd "$M2_HOME" && pwd`
|
||||
|
||||
cd "$saveddir"
|
||||
# echo Using m2 at $M2_HOME
|
||||
fi
|
||||
|
||||
# For Cygwin, ensure paths are in UNIX format before anything is touched
|
||||
|
|
Loading…
Reference in New Issue