Skip to content

Commit

Permalink
Adds temp scripts to test the new java tool
Browse files Browse the repository at this point in the history
Signed-off-by: Darshit Chanpura <[email protected]>
  • Loading branch information
DarshitChanpura committed Nov 6, 2023
1 parent 69cfc4e commit 14d4a8f
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tools/install_demo_configuration_with_java_tool.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@echo off
set DIR=%~dp0

if defined OPENSEARCH_JAVA_HOME (
set BIN_PATH="%OPENSEARCH_JAVA_HOME%\bin\java.exe"
) else if defined JAVA_HOME (
set BIN_PATH="%JAVA_HOME%\bin\java.exe"
) else (
echo Unable to find java runtime
echo OPENSEARCH_JAVA_HOME or JAVA_HOME must be defined
exit /b 1
)

%BIN_PATH% -Dorg.apache.logging.log4j.simplelog.StatusLogger.level=OFF -cp "%DIR%\..\*;%DIR%\..\..\..\lib\*;%DIR%\..\deps\*" org.opensearch.security.tools.InstallDemoConfiguration %* 2> nul
30 changes: 30 additions & 0 deletions tools/install_demo_configuration_with_java_tool.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash
#install_demo_configuration.sh [-y]

SCRIPT_PATH="${BASH_SOURCE[0]}"
if ! [ -x "$(command -v realpath)" ]; then
if [ -L "$SCRIPT_PATH" ]; then

[ -x "$(command -v readlink)" ] || { echo "Not able to resolve symlink. Install realpath or readlink.";exit 1; }

# try readlink (-f not needed because we know its a symlink)
DIR="$( cd "$( dirname $(readlink "$SCRIPT_PATH") )" && pwd -P)"
else
DIR="$( cd "$( dirname "$SCRIPT_PATH" )" && pwd -P)"
fi
else
DIR="$( cd "$( dirname "$(realpath "$SCRIPT_PATH")" )" && pwd -P)"
fi

BIN_PATH="java"

# now set the path to java: first OPENSEARCH_JAVA_HOME, then JAVA_HOME
if [ ! -z "$OPENSEARCH_JAVA_HOME" ]; then
BIN_PATH="$OPENSEARCH_JAVA_HOME/bin/java"
elif [ ! -z "$JAVA_HOME" ]; then
BIN_PATH="$JAVA_HOME/bin/java"
else
echo "WARNING: nor OPENSEARCH_JAVA_HOME nor JAVA_HOME is set, will use $(which $BIN_PATH)"
fi

"$BIN_PATH" $JAVA_OPTS -Dorg.apache.logging.log4j.simplelog.StatusLogger.level=OFF -cp "$DIR/../*:$DIR/../../../lib/*:$DIR/../deps/*" org.opensearch.security.tools.InstallDemoConfiguration "$@" 2>/dev/null

0 comments on commit 14d4a8f

Please sign in to comment.