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
|
## resolve links - $0 may be a link to maven's home
|
||||||
PRG="$0"
|
PRG="$0"
|
||||||
saveddir=`pwd`
|
|
||||||
|
|
||||||
# need this for relative symlinks
|
# need this for relative symlinks
|
||||||
PRGDIR=`dirname "$PRG"`
|
|
||||||
cd "$PRGDIR"
|
|
||||||
|
|
||||||
while [ -h "$PRG" ] ; do
|
while [ -h "$PRG" ] ; do
|
||||||
ls=`ls -ld "$PRG"`
|
ls=`ls -ld "$PRG"`
|
||||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||||
if expr "$link" : '.*/.*' > /dev/null; then
|
if expr "$link" : '.*/.*' > /dev/null; then
|
||||||
PRG="$link"
|
PRG="$link"
|
||||||
else
|
else
|
||||||
PRG="$PRGDIR/$link"
|
PRG="`dirname "$PRG"`/$link"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
M2_HOME="$PRGDIR/.."
|
saveddir=`pwd`
|
||||||
|
|
||||||
|
M2_HOME=`dirname "$PRG"`/..
|
||||||
|
|
||||||
# make it fully qualified
|
# make it fully qualified
|
||||||
M2_HOME=`cd "$M2_HOME" && pwd`
|
M2_HOME=`cd "$M2_HOME" && pwd`
|
||||||
|
|
||||||
cd "$saveddir"
|
cd "$saveddir"
|
||||||
|
# echo Using m2 at $M2_HOME
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# For Cygwin, ensure paths are in UNIX format before anything is touched
|
# For Cygwin, ensure paths are in UNIX format before anything is touched
|
||||||
|
|
Loading…
Reference in New Issue