Skip to content

Commit

Permalink
deb: use --chuid for setting user and group
Browse files Browse the repository at this point in the history
  • Loading branch information
kenhys committed Jul 26, 2012
1 parent 5ef4cb2 commit 203c8b1
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions packages/debian/groonga-httpd.init
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,28 @@ DEFAULT_FILE=/etc/default/groonga-httpd

[ "$ENABLE" = "yes" ] || exit 0

USER_EXIST=0
if [ -n "${USER}" ]; then
if ! getent passwd | grep -q "^${USER}:"; then
echo "$0: user for running groonga-httpd doesn't exist: ${USER}" >&2
exit 1
else
USER_EXIST=1
fi
START_STOP_DAEMON_ARGS="${START_STOP_DAEMON_ARGS} --user ${USER}"
fi
GROUP_EXIST=0
if [ -n "${GROUP}" ]; then
if ! getent group | grep -q "^${GROUP}:"; then
echo "$0: group for running groonga-httpd doesn't exist: ${GROUP}" >&2
exit 1
else
GROUP_EXIST=1
fi
fi
if [ $USER_EXIST = 1 ]; then
if [ $GROUP_EXIST = 1 ]; then
START_STOP_DAEMON_ARGS="${START_STOP_DAEMON_ARGS} --chuid ${USER}:${GROUP}"
fi
START_STOP_DAEMON_ARGS="${START_STOP_DAEMON_ARGS} --group ${GROUP}"
fi
DAEMON_ARGS="${DAEMON_ARGS} ${OPTION_ARGS}"

Expand Down

0 comments on commit 203c8b1

Please sign in to comment.