From 1a92df2e150abbab1d0a2a164041f0dc7eb1b491 Mon Sep 17 00:00:00 2001 From: Alexander Koval Date: Fri, 17 May 2024 00:04:39 +0300 Subject: [PATCH] Apply /etc/profile in CLI tools Some operating systems may have a shell without default PATH variable so we apply /etc/profile to set system PATH Signed-off-by: Alexander Koval --- distribution/src/bin/opensearch | 2 ++ distribution/src/bin/opensearch-cli | 2 ++ distribution/src/bin/opensearch-keystore | 2 ++ distribution/src/bin/opensearch-node | 3 +++ distribution/src/bin/opensearch-plugin | 2 ++ distribution/src/bin/opensearch-shard | 2 ++ distribution/src/bin/opensearch-upgrade | 3 +++ 7 files changed, 16 insertions(+) diff --git a/distribution/src/bin/opensearch b/distribution/src/bin/opensearch index 8a3b0a009437f..f7f01ce8ffa7d 100755 --- a/distribution/src/bin/opensearch +++ b/distribution/src/bin/opensearch @@ -15,6 +15,8 @@ set -e -o pipefail +source /etc/profile + source "`dirname "$0"`"/opensearch-env CHECK_KEYSTORE=true diff --git a/distribution/src/bin/opensearch-cli b/distribution/src/bin/opensearch-cli index 19f5d3e46d6c4..56c4d7a461478 100644 --- a/distribution/src/bin/opensearch-cli +++ b/distribution/src/bin/opensearch-cli @@ -2,6 +2,8 @@ set -e -o pipefail +source /etc/profile + source "`dirname "$0"`"/opensearch-env IFS=';' read -r -a additional_sources <<< "$OPENSEARCH_ADDITIONAL_SOURCES" diff --git a/distribution/src/bin/opensearch-keystore b/distribution/src/bin/opensearch-keystore index 9f6cb65feeeeb..27bf8e7527576 100755 --- a/distribution/src/bin/opensearch-keystore +++ b/distribution/src/bin/opensearch-keystore @@ -2,6 +2,8 @@ set -e -o pipefail +source /etc/profile + OPENSEARCH_MAIN_CLASS=org.opensearch.common.settings.KeyStoreCli \ OPENSEARCH_ADDITIONAL_CLASSPATH_DIRECTORIES=lib/tools/keystore-cli \ "`dirname "$0"`"/opensearch-cli \ diff --git a/distribution/src/bin/opensearch-node b/distribution/src/bin/opensearch-node index b8b231cc43d4a..5223718346c88 100755 --- a/distribution/src/bin/opensearch-node +++ b/distribution/src/bin/opensearch-node @@ -1,6 +1,9 @@ #!/usr/bin/env bash + set -e -o pipefail +source /etc/profile + OPENSEARCH_MAIN_CLASS=org.opensearch.cluster.coordination.NodeToolCli \ "`dirname "$0"`"/opensearch-cli \ "$@" diff --git a/distribution/src/bin/opensearch-plugin b/distribution/src/bin/opensearch-plugin index b58a2695d2ecf..9bb95d0652c52 100755 --- a/distribution/src/bin/opensearch-plugin +++ b/distribution/src/bin/opensearch-plugin @@ -2,6 +2,8 @@ set -e -o pipefail +source /etc/profile + OPENSEARCH_MAIN_CLASS=org.opensearch.plugins.PluginCli \ OPENSEARCH_ADDITIONAL_CLASSPATH_DIRECTORIES=lib/tools/plugin-cli \ "`dirname "$0"`"/opensearch-cli \ diff --git a/distribution/src/bin/opensearch-shard b/distribution/src/bin/opensearch-shard index 953c792af16e8..f2f538643a783 100755 --- a/distribution/src/bin/opensearch-shard +++ b/distribution/src/bin/opensearch-shard @@ -2,6 +2,8 @@ set -e -o pipefail +source /etc/profile + OPENSEARCH_MAIN_CLASS=org.opensearch.index.shard.ShardToolCli \ "`dirname "$0"`"/opensearch-cli \ "$@" diff --git a/distribution/src/bin/opensearch-upgrade b/distribution/src/bin/opensearch-upgrade index 5aae184341b6b..9627e1eeab268 100755 --- a/distribution/src/bin/opensearch-upgrade +++ b/distribution/src/bin/opensearch-upgrade @@ -1,6 +1,9 @@ #!/usr/bin/env bash + set -e -o pipefail +source /etc/profile + OPENSEARCH_MAIN_CLASS=org.opensearch.upgrade.UpgradeCli \ OPENSEARCH_ADDITIONAL_CLASSPATH_DIRECTORIES=lib/tools/upgrade-cli \ "`dirname "$0"`"/opensearch-cli \