Cleanup plugin bin directories (#41907)

This commit adds deletion of the bin directory to postrm cleanup. While
the package's bin files are cleaned up by the package manager, plugins
may have created subdirectories under bin. We already cleanup plugins,
but not the extra bin dirs their installation created.

closes #18109
This commit is contained in:
Ryan Ernst 2019-05-10 11:00:17 -07:00
parent 3e59c31a12
commit 69824ed908
2 changed files with 10 additions and 1 deletions

View File

@ -8,7 +8,6 @@
# On RedHat,
# $1=0 : indicates a removal
# $1=1 : indicates an upgrade
REMOVE_DIRS=false
REMOVE_USER_AND_GROUP=false
@ -55,6 +54,13 @@ if [ "$REMOVE_DIRS" = "true" ]; then
echo " OK"
fi
# plugins may have contained bin files
if [ -d /usr/share/elasticsearch/bin ]; then
echo -n "Deleting plugin bin directories..."
rm -rf /usr/share/elasticsearch/bin
echo " OK"
fi
if [ -d /var/run/elasticsearch ]; then
echo -n "Deleting PID directory..."
rm -rf /var/run/elasticsearch

View File

@ -170,6 +170,9 @@ public abstract class PackageTestCase extends PackagingTestCase {
public void test50Remove() throws Exception {
assumeThat(installation, is(notNullValue()));
// add fake bin directory as if a plugin was installed
Files.createDirectories(installation.bin.resolve("myplugin"));
remove(distribution());
// removing must stop the service