Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[build] Cleanup dirs on uninstall #7422

Merged
merged 1 commit into from
Jun 15, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion tasks/build/os_packages.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ export default (grunt) => {
'--template-value', `user=${packages.user}`,
'--template-value', `group=${packages.group}`,
'--template-value', `optimizeDir=${packages.path.home}/optimize`,

'--template-value', `configDir=${packages.path.conf}`,
'--template-value', `pluginsDir=${packages.path.plugins}`,
//config folder is moved to path.conf, exclude {path.home}/config
//uses relative path to --prefix, strip the leading /
'--exclude', `${packages.path.home.slice(1)}/config`
Expand Down
22 changes: 21 additions & 1 deletion tasks/build/package_scripts/post_remove.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -40,3 +46,17 @@ 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

if [ -d "<%= configDir %>" ]; then
rmdir --ignore-fail-on-non-empty "<%= configDir %>"
fi
fi
4 changes: 2 additions & 2 deletions tasks/config/packages.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ export default (grunt) => {
const PREFIX_PRODUCTION_RPM = `${FOLDER_PRODUCTION}/${FOLDERNAME_RPM}`;

const FOLDER_CONFIG = '/etc/kibana';
const FOLDER_LOGS = '/var/log/kibana';
const FOLDER_HOME = '/usr/share/kibana';
const FOLDER_PLUGINS = `${FOLDER_HOME}/installedPlugins`;

const FILE_KIBANA_CONF = `${FOLDER_CONFIG}/kibana.yml`;
const FILE_KIBANA_BINARY = `${FOLDER_HOME}/bin/kibana`;
Expand Down Expand Up @@ -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
Expand Down