read gitlab_user from debconf

This commit is contained in:
Praveen Arimbrathodiyil 2017-02-16 16:35:08 +05:30
parent 8290440f60
commit 585d4a4df2
3 changed files with 11 additions and 4 deletions

6
debian/adduser.sh vendored
View file

@ -8,9 +8,9 @@ test -n "${gitlab_user}" || gitlab_user="gitlab"
# Create gitlab user with home in /var/lib
echo "Creating/updating ${gitlab_user} user account..."
adduser --system --home /var/lib/${gitlab_user} --gecos "${gitlab_user} user" --shell /bin/sh \
adduser --system --home ${gitlab_data_dir} --gecos "${gitlab_user} user" --shell /bin/sh \
--quiet --disabled-password --group ${gitlab_user} || {
echo "Proceeding with existing ${gitlab_user} user..."
}
echo "Making ${gitlab_user} owner of /var/lib/${gitlab_user}..."
chown -R ${gitlab_user} /var/lib/${gitlab_user}
echo "Making ${gitlab_user} owner of ${gitlab_data_dir}..."
chown -R ${gitlab_user} ${gitlab_data_dir}

View file

@ -1,6 +1,5 @@
RAILS_ENV=production
DB=postgres
gitlab_user=gitlab
gitlab_app_root=/usr/share/gitlab
gitlab_data_dir=/var/lib/gitlab
gitlab_cache_path=/var/cache/gitlab

8
debian/postinst vendored
View file

@ -44,6 +44,14 @@ export $(cat ${gitlab_debian_conf_private})
# If /etc/gitlab/gitlab-debian.conf is already present, use it
test -f ${gitlab_debian_conf} && export $(cat ${gitlab_debian_conf})
# Read gitlab_user from debconf db
db_get gitlab/user
gitlab_user=${RET:-gitlab} >/dev/null
if ! grep gitlab_user ${gitlab_debian_conf_private}; then
echo "gitlab_user=${gitlab_user}" >> ${gitlab_debian_conf_private}
fi
# Create gitlab user
. /usr/lib/gitlab/scripts/adduser.sh