Skip to content

Commit a193bbd

Browse files
authoredFeb 14, 2024··
Removes check to validate presence of OPENSEARCH_INITIAL_ADMIN_PASSWORD variable from preinst script of DEB distribution (#4453)
Signed-off-by: Darshit Chanpura <dchanp@amazon.com>
1 parent 0acb9ca commit a193bbd

File tree

3 files changed

+4
-33
lines changed

3 files changed

+4
-33
lines changed
 

‎scripts/components/OpenSearch/install.sh

-3
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,6 @@ if [ "$DISTRIBUTION" = "tar" ]; then
8484
elif [ "$DISTRIBUTION" = "deb" -o "$DISTRIBUTION" = "rpm" ]; then
8585
cp -va ../../../scripts/pkg/service_templates/opensearch/* "$OUTPUT/../"
8686
cp -va ../../../scripts/pkg/build_templates/opensearch/$DISTRIBUTION/* "$OUTPUT/../"
87-
if [ "$DISTRIBUTION" = "deb" ]; then
88-
sed -i "s/CHANGE_VERSION/${VERSION}/g" "$OUTPUT/../debian/preinst"
89-
fi
9087
elif [ "$DISTRIBUTION" = "zip" ] && [ "$PLATFORM" = "windows" ]; then
9188
cp -v ../../../scripts/startup/zip/windows/opensearch-windows-install.bat "$OUTPUT/"
9289
fi

‎scripts/pkg/build_templates/opensearch/deb/debian/preinst

-26
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111

1212
set -e
1313

14-
OPENSEARCH_VERSION=CHANGE_VERSION
15-
1614
echo "Running OpenSearch Pre-Installation Script"
1715

1816
# Stop existing service
@@ -25,30 +23,6 @@ if command -v systemctl >/dev/null && systemctl is-active opensearch-performance
2523
systemctl --no-reload stop opensearch-performance-analyzer.service
2624
fi
2725

28-
# Check if OPENSEARCH_INITIAL_ADMIN_PASSWORD is defined
29-
# TODO:
30-
# 1. This check will need to be modified if there will be a min dist for deb in future (currently there is none)
31-
# 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.
32-
33-
# Check if this is an upgrade by checking whether opensearch already exists
34-
if dpkg-query -W opensearch >/dev/null 2>&1; then
35-
OPENSEARCH_ALREADY_INSTALLED=yes
36-
else
37-
OPENSEARCH_ALREADY_INSTALLED=no
38-
fi
39-
40-
OPENSEARCH_REQUIRED_VERSION="2.12.0"
41-
MINIMUM_OF_TWO_VERSIONS=`echo $OPENSEARCH_REQUIRED_VERSION $OPENSEARCH_VERSION | tr ' ' '\n' | sort -V | uniq | head -n 1`
42-
43-
if [ $OPENSEARCH_ALREADY_INSTALLED = no ]; then
44-
if [ $MINIMUM_OF_TWO_VERSIONS = $OPENSEARCH_REQUIRED_VERSION ] && [ -z "$OPENSEARCH_INITIAL_ADMIN_PASSWORD" ]; then
45-
echo "ERROR: Opensearch 2.12 and later requires the env variable OPENSEARCH_INITIAL_ADMIN_PASSWORD to be defined to setup the opensearch-security demo configuration"
46-
echo "For more details, please visit: https://opensearch.org/docs/latest/install-and-configure/install-opensearch/debian/"
47-
exit 1
48-
fi
49-
fi
50-
51-
5226
# Create user and group if they do not already exist.
5327
getent group opensearch > /dev/null 2>&1 || groupadd -r opensearch
5428
getent passwd opensearch > /dev/null 2>&1 || \

‎scripts/pkg/build_templates/opensearch/rpm/opensearch.rpm.spec

+4-4
Original file line numberDiff line numberDiff line change
@@ -97,17 +97,17 @@ fi
9797

9898
# Check if this is an upgrade by checking whether opensearch already exists
9999
if rpm -q opensearch >/dev/null 2>&1 || yum list installed opensearch >/dev/null 2>&1; then
100-
OPENSEARCH_ALREADY_INSTALLED=yes
100+
OPENSEARCH_ALREADY_INSTALLED="yes"
101101
else
102-
OPENSEARCH_ALREADY_INSTALLED=no
102+
OPENSEARCH_ALREADY_INSTALLED="no"
103103
fi
104104

105105
OPENSEARCH_REQUIRED_VERSION="2.12.0"
106106
OPENSEARCH_VERSION=%{_version}
107107
MINIMUM_OF_TWO_VERSIONS=`echo $OPENSEARCH_REQUIRED_VERSION $OPENSEARCH_VERSION | tr ' ' '\n' | sort -V | uniq | head -n 1`
108108

109-
if [ $OPENSEARCH_ALREADY_INSTALLED = no ]; then
110-
if [ $MINIMUM_OF_TWO_VERSIONS = $OPENSEARCH_REQUIRED_VERSION ] && [ -z "$OPENSEARCH_INITIAL_ADMIN_PASSWORD" ]; then
109+
if [ "$OPENSEARCH_ALREADY_INSTALLED" = "no" ]; then
110+
if [ "$MINIMUM_OF_TWO_VERSIONS" = "$OPENSEARCH_REQUIRED_VERSION" ] && [ -z "$OPENSEARCH_INITIAL_ADMIN_PASSWORD" ]; then
111111
echo "ERROR: Opensearch 2.12 and later requires the env variable OPENSEARCH_INITIAL_ADMIN_PASSWORD to be defined to setup the opensearch-security demo configuration"
112112
echo "For more details, please visit: https://opensearch.org/docs/latest/install-and-configure/install-opensearch/rpm/"
113113
exit 1

0 commit comments

Comments
 (0)
Please sign in to comment.