You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by br...@apache.org on 2005/01/22 12:33:32 UTC

svn commit: r126032 - /maven/maven-1/core/trunk/src/bin/maven

Author: brett
Date: Sat Jan 22 03:33:30 2005
New Revision: 126032

URL: http://svn.apache.org/viewcvs?view=rev&rev=126032
Log:
PR: MAVEN-1532
Submitted By:	James Berry
Resolve symlinked start script on Mac OS X

Modified:
   maven/maven-1/core/trunk/src/bin/maven

Modified: maven/maven-1/core/trunk/src/bin/maven
Url: http://svn.apache.org/viewcvs/maven/maven-1/core/trunk/src/bin/maven?view=diff&rev=126032&p1=maven/maven-1/core/trunk/src/bin/maven&r1=126031&p2=maven/maven-1/core/trunk/src/bin/maven&r2=126032
==============================================================================
--- maven/maven-1/core/trunk/src/bin/maven	(original)
+++ maven/maven-1/core/trunk/src/bin/maven	Sat Jan 22 03:33:30 2005
@@ -49,38 +49,30 @@
            ;;
 esac
 
-if [ -z "$MAVEN_HOME" ] ; then
-  # try to find MAVEN
-  if [ -d /opt/maven ] ; then
-    MAVEN_HOME=/opt/maven
-  fi
-
-  if [ -d "$HOME/maven" ] ; then
-    MAVEN_HOME="$HOME/maven"
-  fi
+# try to find MAVEN in well known locations
+[ -z "$MAVEN_HOME" -a -d /opt/maven ]		&& MAVEN_HOME=/opt/maven
+[ -z "$MAVEN_HOME" -a -d "$HOME/maven" ]	&& MAVEN_HOME="$HOME/maven"
 
+# Otherwise try to determine it from our invocation path
+if [ -z "$MAVEN_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"
-    else
-  PRG="$PRGDIR/$link"
-    fi
+  PRG="$0"    
+  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
-
-  MAVEN_HOME="$PRGDIR/.."
-
-  # make it fully qualified
-  MAVEN_HOME=`cd "$MAVEN_HOME" && pwd`
+    
+  # Make it fully specified
+  cd "`dirname \"$PRG\"`/.."
+  MAVEN_HOME="`pwd -P`"
 
   cd "$saveddir"
 fi

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org