[Packaging] Do not remove scripts directory on upgrade (#20452)

When upgrading elasticsearch using the RPM package, the scripts directory is removed if it's empty but it won't be recreated by the upgraded package. But after that the service won't start because the scripts dir is missing.
This commit is contained in:
Tanguy Leroux 2016-09-13 18:00:11 +02:00
parent 89640965d2
commit 26dc6f1306
3 changed files with 9 additions and 5 deletions

View File

@ -79,12 +79,13 @@ if [ "$REMOVE_SERVICE" = "true" ]; then
if command -v update-rc.d >/dev/null; then
update-rc.d elasticsearch remove >/dev/null || true
fi
SCRIPTS_DIR="/etc/elasticsearch/scripts"
# delete the scripts directory if and only if empty
if [ -d "$SCRIPTS_DIR" ]; then
rmdir --ignore-fail-on-non-empty "$SCRIPTS_DIR"
fi
fi
SCRIPTS_DIR="/etc/elasticsearch/scripts"
# delete the scripts directory if and only if empty
if [ -d "$SCRIPTS_DIR" ]; then
rmdir --ignore-fail-on-non-empty "$SCRIPTS_DIR"
fi
${scripts.footer}

View File

@ -131,6 +131,7 @@ setup() {
# The configuration files are still here
assert_file_exist "/etc/elasticsearch"
assert_file_exist "/etc/elasticsearch/scripts"
assert_file_exist "/etc/elasticsearch/elasticsearch.yml"
assert_file_exist "/etc/elasticsearch/jvm.options"
assert_file_exist "/etc/elasticsearch/log4j2.properties"
@ -152,6 +153,7 @@ setup() {
@test "[DEB] verify package purge" {
# all remaining files are deleted by the purge
assert_file_not_exist "/etc/elasticsearch"
assert_file_not_exist "/etc/elasticsearch/scripts"
assert_file_not_exist "/etc/elasticsearch/elasticsearch.yml"
assert_file_not_exist "/etc/elasticsearch/jvm.options"
assert_file_not_exist "/etc/elasticsearch/log4j2.properties"

View File

@ -119,6 +119,7 @@ setup() {
assert_file_not_exist "/var/run/elasticsearch"
assert_file_not_exist "/etc/elasticsearch"
assert_file_not_exist "/etc/elasticsearch/scripts"
assert_file_not_exist "/etc/elasticsearch/elasticsearch.yml"
assert_file_not_exist "/etc/elasticsearch/jvm.options"
assert_file_not_exist "/etc/elasticsearch/log4j2.properties"