Startup script: resolve symlinked JAVA_HOME directories 41/8741/1
Clément DAVID [Mon, 20 Aug 2012 09:23:07 +0000 (11:23 +0200)]
Change-Id: I483faeb2d5a88244ed2b13fd06614c8b1c5c4eec

scilab/bin/scilab

index 2cfc43a..384019b 100755 (executable)
@@ -425,10 +425,15 @@ detect_java_vm() {
                         echo "Trying to find Java in $DIR "
                     fi
                     if test -x "${DIR}/bin/java" ; then
-                        JAVA_HOME=$DIR
+                        # resolve symlinked dir
+                        pushd . >/dev/null
+                        cd $DIR
+                        JAVA_HOME=$(pwd -P)
+                        popd >/dev/null
+
                         export JAVA_HOME
                         if test $SCIVERBOSE -ne 0; then
-                            echo "found"
+                            echo "Java found in $JAVA_HOME"
                         fi
                         break
                     fi
@@ -436,7 +441,7 @@ detect_java_vm() {
             fi
 
 # if JAVA_HOME still haven't been found. Well, we can now try to find it in the path
-            if test ! -d "$JAVA_HOME" -o ! -h "$JAVA_HOME"; then
+            if test ! -d "$JAVA_HOME"; then
 
                 PATH_SEPARATOR=:
                 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR