You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by sa...@apache.org on 2012/10/11 18:31:14 UTC

svn commit: r1397149 - /jena/trunk/jena-fuseki/fuseki

Author: sallen
Date: Thu Oct 11 16:31:13 2012
New Revision: 1397149

URL: http://svn.apache.org/viewvc?rev=1397149&view=rev
Log:
JENA-334 Fuseki start script fails when invoked with full pathname

Modified:
    jena/trunk/jena-fuseki/fuseki

Modified: jena/trunk/jena-fuseki/fuseki
URL: http://svn.apache.org/viewvc/jena/trunk/jena-fuseki/fuseki?rev=1397149&r1=1397148&r2=1397149&view=diff
==============================================================================
--- jena/trunk/jena-fuseki/fuseki (original)
+++ jena/trunk/jena-fuseki/fuseki Thu Oct 11 16:31:13 2012
@@ -78,16 +78,23 @@ case "`uname`" in
 esac
 
 # Set FUSKEI_HOME to the script invocation directory if it is not specified
-# TODO Make this better, it will only really work with relative paths
 if [ -z "$FUSEKI_HOME" ]
 then
-  SCRIPT_PATH=`dirname $BASH_SOURCE`
-  if [ "$SCRIPT_PATH" == "." ]
+  SCRIPT="$0"
+  # Catch common issue: script has been symlinked
+  if [ -L "$SCRIPT" ]
   then
-    export FUSEKI_HOME="$PWD"
-  else
-    export FUSEKI_HOME="$PWD/$SCRIPT_PATH"
+    SCRIPT="$(readlink "$0")"
+    # If link is relative
+    case "$SCRIPT" in
+      /*) ;; # fine
+      *) SCRIPT=$( dirname "$0" )/$SCRIPT;; # fix
+    esac
   fi
+
+  # Work out root from script location
+  FUSEKI_HOME="$( cd "$( dirname "$SCRIPT" )" && pwd )"
+
 fi
 
 #echo "DEBUG: FUSEKI_HOME=$FUSEKI_HOME"