Skip to content

Commit d6cfe86

Browse files
authored
Respect ES_PATH_CONF during upgrades too (#50246)
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.
1 parent 207094c commit d6cfe86

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

distribution/packages/src/common/scripts/posttrans

+11-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
1-
if [ ! -f /etc/elasticsearch/elasticsearch.keystore ]; then
1+
# source the default env file
2+
if [ -f "${path.env}" ]; then
3+
. "${path.env}"
4+
else
5+
ES_PATH_CONF="${path.conf}"
6+
fi
7+
8+
if [ ! -f "${ES_PATH_CONF}"/elasticsearch.keystore ]; then
29
/usr/share/elasticsearch/bin/elasticsearch-keystore create
3-
chown root:elasticsearch /etc/elasticsearch/elasticsearch.keystore
4-
chmod 660 /etc/elasticsearch/elasticsearch.keystore
5-
md5sum /etc/elasticsearch/elasticsearch.keystore > /etc/elasticsearch/.elasticsearch.keystore.initial_md5sum
10+
chown root:elasticsearch "${ES_PATH_CONF}"/elasticsearch.keystore
11+
chmod 660 "${ES_PATH_CONF}"/elasticsearch.keystore
12+
md5sum "${ES_PATH_CONF}"/elasticsearch.keystore > "${ES_PATH_CONF}"/.elasticsearch.keystore.initial_md5sum
613
else
714
/usr/share/elasticsearch/bin/elasticsearch-keystore upgrade
815
fi

distribution/packages/src/common/scripts/preinst

+7
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ err_exit() {
1515
exit 1
1616
}
1717

18+
# source the default env file
19+
if [ -f "${path.env}" ]; then
20+
. "${path.env}"
21+
else
22+
ES_PATH_CONF="${path.conf}"
23+
fi
24+
1825
case "$1" in
1926

2027
# Debian ####################################################

0 commit comments

Comments
 (0)