gitlabhq/gitlab-ci — pull request #469 by barraq (2014-08-26 13:11:21+00:00)
Title: fix gitlab-ci init.d script for debian

This commit addresses an issue with the gitlab-ci init.d script on Debian based systems.
This script makes use of `sudo` which raise two problems on Debian:

1. by default `sudo` is not installed on Debian,
2. even if `sudo` is installed, `root` is not a sudoer by default on Debian

As a result `service gitlab_ci start` or `service gitlab_ci stop` fails throwing the following error: `root is not in the sudoers file. This incident will be reported.`.

This commit replaces the following:

# Switch to the app_user if it is not he/she who is running the script.
if [ "$USER" != "$app_user" ]; then
sudo -u "$app_user" -H -i $0 "$@"; exit;
fi

by

# Switch to the app_user if it is not he/she who is running the script.
if [ "$USER" != "$app_user" ]; then
su "$app_user" -l -c "$0 $@"; exit;
fi

Signed-off-by: Remi BARRAQUAND
Signed-off-by: Charles EYNARD