Skip to content

Commit 5cbce31

Browse files
authored
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
1 parent 74a7438 commit 5cbce31

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

distribution/packages/src/common/scripts/postrm

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
# On RedHat,
99
# $1=0 : indicates a removal
1010
# $1=1 : indicates an upgrade
11-
1211
REMOVE_DIRS=false
1312
REMOVE_USER_AND_GROUP=false
1413

@@ -55,6 +54,13 @@ if [ "$REMOVE_DIRS" = "true" ]; then
5554
echo " OK"
5655
fi
5756

57+
# plugins may have contained bin files
58+
if [ -d /usr/share/elasticsearch/bin ]; then
59+
echo -n "Deleting plugin bin directories..."
60+
rm -rf /usr/share/elasticsearch/bin
61+
echo " OK"
62+
fi
63+
5864
if [ -d /var/run/elasticsearch ]; then
5965
echo -n "Deleting PID directory..."
6066
rm -rf /var/run/elasticsearch

qa/vagrant/src/main/java/org/elasticsearch/packaging/test/PackageTestCase.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,9 @@ public void test40StartServer() throws Exception {
169169
public void test50Remove() throws Exception {
170170
assumeThat(installation, is(notNullValue()));
171171

172+
// add fake bin directory as if a plugin was installed
173+
Files.createDirectories(installation.bin.resolve("myplugin"));
174+
172175
remove(distribution());
173176

174177
// removing must stop the service

0 commit comments

Comments
 (0)