Web Console agent: Fixed incorrect classpath - Fixes
# limitations under the License.
#
-SOURCE=$(dirname "$0")
-
-source "${SOURCE}"/include/functions.sh
-
-#
-# Discover path to Java executable and check it's version.
-#
-checkJava
-
-#
-# Set IGNITE_HOME.
-#
-export IGNITE_HOME="$(dirname "$(cd "$(dirname "$0")"; "pwd")")";
-
-DIR="$( dirname "$SOURCE" )"
+SOURCE="${BASH_SOURCE[0]}"
+# Resolve $SOURCE until the file is no longer a symlink.
while [ -h "$SOURCE" ]
do
- SOURCE="$(readlink "$SOURCE")"
+ IGNITE_HOME="$(cd -P "$( dirname "$SOURCE" )" && pwd)"
- [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
+ SOURCE="$(readlink "$SOURCE")"
- DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
+ # If $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located.
+ [[ $SOURCE != /* ]] && SOURCE="$IGNITE_HOME/$SOURCE"
done
-DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
+#
+# Set IGNITE_HOME.
+#
+export IGNITE_HOME="$(cd -P "$( dirname "$SOURCE" )" && pwd)"
+
+source "${IGNITE_HOME}"/include/functions.sh
-cd $DIR
+#
+# Discover path to Java executable and check it's version.
+#
+checkJava
#
# JVM options. See http://java.sun.com/javase/technologies/hotspot/vmoptions.jsp for more details.
@@ -94,4 +90,4 @@ elif [ $version -eq 11 ] ; then
${JVM_OPTS}"
fi
-"$JAVA" ${JVM_OPTS} -cp "*" org.apache.ignite.console.agent.AgentLauncher "$@"
+"$JAVA" ${JVM_OPTS} -cp "${IGNITE_HOME}/*" org.apache.ignite.console.agent.AgentLauncher "$@"
