diff --git a/scripts/components/OpenSearch/install.sh b/scripts/components/OpenSearch/install.sh index 6ab2d49ac0..c387135957 100755 --- a/scripts/components/OpenSearch/install.sh +++ b/scripts/components/OpenSearch/install.sh @@ -84,7 +84,7 @@ if [ "$DISTRIBUTION" = "tar" ]; then elif [ "$DISTRIBUTION" = "deb" -o "$DISTRIBUTION" = "rpm" ]; then cp -va ../../../scripts/pkg/service_templates/opensearch/* "$OUTPUT/../" cp -va ../../../scripts/pkg/build_templates/opensearch/$DISTRIBUTION/* "$OUTPUT/../" - sed -i "s/CHANGE_VERSION/${VERSION}" "$OUTPUT/../debian/preinst" + sed -i "s/CHANGE_VERSION/${VERSION}/g" "$OUTPUT/../debian/preinst" elif [ "$DISTRIBUTION" = "zip" ] && [ "$PLATFORM" = "windows" ]; then cp -v ../../../scripts/startup/zip/windows/opensearch-windows-install.bat "$OUTPUT/" fi diff --git a/scripts/pkg/build_templates/opensearch/deb/debian/postinst b/scripts/pkg/build_templates/opensearch/deb/debian/postinst index 2b562657fe..58496cfa59 100755 --- a/scripts/pkg/build_templates/opensearch/deb/debian/postinst +++ b/scripts/pkg/build_templates/opensearch/deb/debian/postinst @@ -21,9 +21,8 @@ pid_dir=/var/run/opensearch # Apply Security Settings if [ -d ${product_dir}/plugins/opensearch-security ]; then - bash ${product_dir}/plugins/opensearch-security/tools/install_demo_configuration.sh -y -i -s || echo "Something went wrong during demo configuration installation. Please see the logs in ${log_dir}/install_demo_configuration.log." > ${log_dir}/install_demo_configuration.log 2>&1 + bash ${product_dir}/plugins/opensearch-security/tools/install_demo_configuration.sh -y -i -s > ${log_dir}/install_demo_configuration.log 2>&1 || echo "ERROR: Something went wrong during demo configuration installation. Please see the logs in ${log_dir}/install_demo_configuration.log." && exit 1 fi - # Apply PerformanceAnalyzer Settings chmod a+rw /tmp if ! grep -q '## OpenSearch Performance Analyzer' ${config_dir}/jvm.options; then diff --git a/scripts/pkg/build_templates/opensearch/deb/debian/preinst b/scripts/pkg/build_templates/opensearch/deb/debian/preinst index 8f007fcb01..80693bd166 100755 --- a/scripts/pkg/build_templates/opensearch/deb/debian/preinst +++ b/scripts/pkg/build_templates/opensearch/deb/debian/preinst @@ -12,7 +12,6 @@ set -e OPENSEARCH_VERSION=CHANGE_VERSION -echo $OPENSEARCH_VERSION echo "Running OpenSearch Pre-Installation Script" @@ -30,12 +29,11 @@ fi # NOTE: # 1. This check will need to be modified if there will be a min dist for deb in future (currently there is none) # 2. Currently, the demo config setup is defined to run, in postinst, if `opensearch-security` is present. Cannot apply the same check here since the plugins folder is not available yet. -# 3. There is no version check here as it assumes that this change will be present in preinst scripts for deb distribution of OpenSearch 2.12 and later OPENSEARCH_REQUIRED_VERSION="2.12.0" COMPARE_VERSION=`echo $OPENSEARCH_REQUIRED_VERSION $OPENSEARCH_VERSION | tr ' ' '\n' | sort -V | uniq | head -n 1` if [ "$COMPARE_VERSION" == "$OPENSEARCH_REQUIRED_VERSION" ] && [ -z "$OPENSEARCH_INITIAL_ADMIN_PASSWORD" ]; then echo "Opensearch 2.12 and later requires the env variable OPENSEARCH_INITIAL_ADMIN_PASSWORD to be defined to setup the opensearch-security demo configuration" - exit -1 + exit 1 fi diff --git a/scripts/pkg/build_templates/opensearch/rpm/opensearch.rpm.spec b/scripts/pkg/build_templates/opensearch/rpm/opensearch.rpm.spec index 6b4732e9cd..6485919bcd 100644 --- a/scripts/pkg/build_templates/opensearch/rpm/opensearch.rpm.spec +++ b/scripts/pkg/build_templates/opensearch/rpm/opensearch.rpm.spec @@ -110,6 +110,7 @@ getent passwd %{name} > /dev/null 2>&1 || \ exit 0 %post +set -e # Apply Security Settings if [ -d %{product_dir}/plugins/opensearch-security ]; then sh %{product_dir}/plugins/opensearch-security/tools/install_demo_configuration.sh -y -i -s || echo "Something went wrong during demo configuration installation. Please see the logs in %{log_dir}/install_demo_configuration.log." > %{log_dir}/install_demo_configuration.log 2>&1