Skip to content

Commit

Permalink
[build] fix chmod errors (#72768)
Browse files Browse the repository at this point in the history
* inherit data permisions

* tmp add all-platforms flag

* Revert "inherit data permisions"

This reverts commit ce30dd7.

* silent chmod, move to configure sectino

* simplify chown and fix babel cache

* rm empty lines

* Revert "tmp add all-platforms flag"

This reverts commit f1ae815.

Co-authored-by: Elastic Machine <[email protected]>
  • Loading branch information
jbudz and elasticmachine committed Jul 27, 2020
1 parent e112701 commit a77cd9d
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions src/dev/build/tasks/os_packages/package_scripts/post_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,22 @@ set -e

export KBN_PATH_CONF=${KBN_PATH_CONF:-<%= configDir %>}

set_chmod() {
chmod -f 660 ${KBN_PATH_CONF}/kibana.yml || true
chmod -f 2750 <%= dataDir %> || true
chmod -f 2750 ${KBN_PATH_CONF} || true
}

set_chown() {
chown -R <%= user %>:<%= group %> <%= dataDir %>
chown -R root:<%= group %> ${KBN_PATH_CONF}
}

set_access() {
set_chmod
set_chown
}

case $1 in
# Debian
configure)
Expand All @@ -14,6 +30,8 @@ case $1 in
adduser --quiet --system --no-create-home --disabled-password \
--ingroup "<%= group %>" --shell /bin/false "<%= user %>"
fi

set_access
;;
abort-deconfigure|abort-upgrade|abort-remove)
;;
Expand All @@ -28,20 +46,12 @@ case $1 in
useradd -r -g "<%= group %>" -M -s /sbin/nologin \
-c "kibana service user" "<%= user %>"
fi

set_access
;;

*)
echo "post install script called with unknown argument \`$1'" >&2
exit 1
;;
esac

chown -R <%= user %>:<%= group %> <%= dataDir %>
chown -R <%= user %>:<%= group %> <%= optimizeDir %>
chmod 2750 <%= dataDir %>
chmod -R 2755 <%= dataDir %>/*

chown :<%= group %> ${KBN_PATH_CONF}
chown :<%= group %> ${KBN_PATH_CONF}/kibana.yml
chmod 2750 ${KBN_PATH_CONF}
chmod 660 ${KBN_PATH_CONF}/kibana.yml

0 comments on commit a77cd9d

Please sign in to comment.