Skip to content

Commit

Permalink
[build] template user in install/remove scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
jbudz committed May 27, 2016
1 parent 08c9897 commit 5387167
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion tasks/build/os_packages.js
Expand Up @@ -31,7 +31,8 @@ module.exports = function (grunt) {
'--after-install', resolve(packageScriptsDir, 'post_install.sh'),
'--before-remove', resolve(packageScriptsDir, 'pre_remove.sh'),
'--after-remove', resolve(packageScriptsDir, 'post_remove.sh'),
'--config-files', '/opt/kibana/config/kibana.yml'
'--config-files', '/opt/kibana/config/kibana.yml',
'--template-value', 'user=kibana'
];

const files = buildDir + '/=/opt/kibana';
Expand Down
6 changes: 3 additions & 3 deletions tasks/build/package_scripts/post_install.sh
Expand Up @@ -10,7 +10,7 @@ user_create() {
useradd -r "$1"
}

if ! user_check "kibana" ; then
user_create "kibana"
if ! user_check "<%= user %>" ; then
user_create "<%= user %>"
fi
chown kibana /opt/kibana/optimize
chown <%= user %> /opt/kibana/optimize
4 changes: 2 additions & 2 deletions tasks/build/package_scripts/post_remove.sh
Expand Up @@ -10,8 +10,8 @@ user_remove() {

case $1 in
purge|0)
if user_check "kibana" ; then
user_remove "kibana"
if user_check "<%= user %>" ; then
user_remove "<%= user %>"
fi
;;
esac

0 comments on commit 5387167

Please sign in to comment.