From 2da2f4f7a2f7d73ec953984e2d475c95085460f7 Mon Sep 17 00:00:00 2001 From: Jonathan Budzenski Date: Fri, 17 Jun 2016 10:04:29 -0500 Subject: [PATCH] Backport PR #7422 --------- **Commit 1:** [build] Cleanup dirs on uninstall * Original sha: 29e26de7e234d4e6abcf4127732856fca5ba2727 * Authored by Jonathan Budzenski on 2016-05-25T22:05:28Z --- tasks/build/osPackages.js | 3 ++- tasks/build/package_scripts/post_remove.sh | 18 +++++++++++++++++- tasks/config/packages.js | 4 ++-- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/tasks/build/osPackages.js b/tasks/build/osPackages.js index 7f9f8f71c6bc9..963bb85cf6a2d 100644 --- a/tasks/build/osPackages.js +++ b/tasks/build/osPackages.js @@ -41,7 +41,8 @@ export default (grunt) => { '--config-files', config.path.kibanaConfig, '--template-value', `user=${config.user}`, '--template-value', `group=${config.group}`, - '--template-value', `optimizeDir=${config.path.home}/optimize` + '--template-value', `optimizeDir=${config.path.home}/optimize`, + '--template-value', `pluginsDir=${config.path.plugins}` ]; const debOptions = [ '-t', 'deb', diff --git a/tasks/build/package_scripts/post_remove.sh b/tasks/build/package_scripts/post_remove.sh index 43e8e5e6d4ac5..5c2858e34ad3f 100644 --- a/tasks/build/package_scripts/post_remove.sh +++ b/tasks/build/package_scripts/post_remove.sh @@ -10,20 +10,26 @@ user_remove() { } REMOVE_USER=false +REMOVE_DIRS=false case $1 in # Includes cases for all valid arguments, exit 1 otherwise # Debian purge) REMOVE_USER=true + REMOVE_DIRS=true + ;; + remove) + REMOVE_DIRS=true ;; - remove|failed-upgrade|abort-install|abort-upgrade|disappear|upgrade|disappear) + failed-upgrade|abort-install|abort-upgrade|disappear|upgrade|disappear) ;; # Red Hat 0) REMOVE_USER=true + REMOVE_DIRS=true ;; 1) @@ -40,3 +46,13 @@ if [ "$REMOVE_USER" = "true" ]; then user_remove "<%= user %>" fi fi + +if [ "$REMOVE_DIRS" = "true" ]; then + if [ -d "<%= optimizeDir %>" ]; then + rm -rf "<%= optimizeDir %>" + fi + + if [ -d "<%= pluginsDir %>" ]; then + rm -rf "<%= pluginsDir %>" + fi +fi diff --git a/tasks/config/packages.js b/tasks/config/packages.js index 0fec5b6cd248d..66226e938df50 100644 --- a/tasks/config/packages.js +++ b/tasks/config/packages.js @@ -13,8 +13,8 @@ export default (grunt) => { const PREFIX_PRODUCTION_RPM = `${FOLDER_PRODUCTION}/${FOLDERNAME_RPM}`; const FOLDER_CONFIG = '/opt/kibana/config'; - const FOLDER_LOGS = '/var/log/kibana'; const FOLDER_HOME = '/opt/kibana'; + const FOLDER_PLUGINS = `${FOLDER_HOME}/installedPlugins`; const FILE_KIBANA_CONF = `${FOLDER_CONFIG}/kibana.yml`; const FILE_KIBANA_BINARY = `${FOLDER_HOME}/bin/kibana`; @@ -43,7 +43,7 @@ export default (grunt) => { version: VERSION, path: { conf: FOLDER_CONFIG, - logs: FOLDER_LOGS, + plugins: FOLDER_PLUGINS, home: FOLDER_HOME, kibanaBin: FILE_KIBANA_BINARY, kibanaConfig: FILE_KIBANA_CONF