Skip to content

Commit

Permalink
Respect ES_PATH_CONF during upgrades too (elastic#50246)
Browse files Browse the repository at this point in the history
A previous commit taught Elasticsearch packages to respect ES_PATH_CONF
during installs. Missed in that commit was respecting ES_PATH_CONF on
upgrades. This commit does that. Additionally, while ES_PATH_CONF is not
currently used in pre-install, this commit adds respect to the preinst
script in case we do in the future.
  • Loading branch information
jasontedor authored and SivagurunathanV committed Jan 21, 2020
1 parent 3784e20 commit e4d5a4c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
15 changes: 11 additions & 4 deletions distribution/packages/src/common/scripts/posttrans
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
if [ ! -f /etc/elasticsearch/elasticsearch.keystore ]; then
# source the default env file
if [ -f "${path.env}" ]; then
. "${path.env}"
else
ES_PATH_CONF="${path.conf}"
fi

if [ ! -f "${ES_PATH_CONF}"/elasticsearch.keystore ]; then
/usr/share/elasticsearch/bin/elasticsearch-keystore create
chown root:elasticsearch /etc/elasticsearch/elasticsearch.keystore
chmod 660 /etc/elasticsearch/elasticsearch.keystore
md5sum /etc/elasticsearch/elasticsearch.keystore > /etc/elasticsearch/.elasticsearch.keystore.initial_md5sum
chown root:elasticsearch "${ES_PATH_CONF}"/elasticsearch.keystore
chmod 660 "${ES_PATH_CONF}"/elasticsearch.keystore
md5sum "${ES_PATH_CONF}"/elasticsearch.keystore > "${ES_PATH_CONF}"/.elasticsearch.keystore.initial_md5sum
else
/usr/share/elasticsearch/bin/elasticsearch-keystore upgrade
fi
Expand Down
7 changes: 7 additions & 0 deletions distribution/packages/src/common/scripts/preinst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ err_exit() {
exit 1
}

# source the default env file
if [ -f "${path.env}" ]; then
. "${path.env}"
else
ES_PATH_CONF="${path.conf}"
fi

case "$1" in

# Debian ####################################################
Expand Down

0 comments on commit e4d5a4c

Please sign in to comment.